Catch several more classes of undefined variable errors. Fixes TM#278

nohash
Tom MacWright 14 years ago
parent f201dd6e0d
commit 6626b3257e

@ -23,6 +23,15 @@ tree.Call.prototype = {
eval: function(env) {
var args = this.args.map(function(a) { return a.eval(env) });
for (var i = 0; i < args.length; i++) {
if (args[i].is === 'undefined') {
return {
is: 'undefined',
value: 'undefined'
};
}
}
if (this.name in tree.functions) { // 1.
return tree.functions[this.name].apply(tree.functions, args);
} else { // 2.

@ -11,6 +11,13 @@ tree.Operation.prototype.eval = function(env) {
b = this.operands[1].eval(env),
temp;
if (a.is === 'undefined' || b.is === 'undefined') {
return {
is: 'undefined',
value: 'undefined'
};
}
if (a instanceof tree.Dimension && b instanceof tree.Color) {
if (this.op === '*' || this.op === '+') {
temp = b, b = a, a = temp;

@ -1,3 +1,5 @@
#world[zoom=5] {
polygon-fill: @something;
line-color: @something + #111;
marker-fill: darken(@something, 10);
}

Loading…
Cancel
Save