jshint: boss

This commit is contained in:
Luke Page
2013-12-16 23:23:34 +00:00
parent 4f7c06c9c8
commit 3818727bf7
16 changed files with 214 additions and 134 deletions

View File

@@ -1,10 +1,10 @@
{
"evil": true,
"boss": true,
"laxbreak": true,
"latedef": true,
"node": true,
"undef": true,
"unused": "vars",
"noarg": true
"noarg": true,
"eqnull": true
}

View File

@@ -615,10 +615,11 @@ less.watch = function () {
less.env = 'development';
initRunningMode();
}
return this.watchMode = true;
this.watchMode = true;
return true;
};
less.unwatch = function () {clearInterval(less.watchTimer); return this.watchMode = false; };
less.unwatch = function () {clearInterval(less.watchTimer); this.watchMode = false; return false; };
if (/!watch/.test(location.hash)) {
less.watch();

View File

@@ -263,7 +263,6 @@ tree.functions = {
},
_math: function (fn, unit, n) {
if (n instanceof tree.Dimension) {
/*jshint eqnull:true */
return new(tree.Dimension)(fn(parseFloat(n.value)), unit == null ? n.unit : unit);
} else if (typeof(n) === 'number') {
return fn(n);
@@ -565,7 +564,6 @@ var mathFunctions = [{name:"ceil"}, {name:"floor"}, {name: "sqrt"}, {name:"abs"}
{name:"atan", unit: "rad"}, {name:"asin", unit: "rad"}, {name:"acos", unit: "rad"}],
createMathFunction = function(name, unit) {
return function(n) {
/*jshint eqnull:true */
if (unit != null) {
n = n.unify();
}

View File

@@ -22,7 +22,8 @@
this.contexts.push(paths);
if (! rulesetNode.root) {
if (selectors = rulesetNode.selectors) {
selectors = rulesetNode.selectors;
if (selectors) {
selectors = selectors.filter(function(selector) { return selector.getIsOutput(); });
rulesetNode.selectors = selectors.length ? selectors : (selectors = null);
if (selectors) { rulesetNode.joinSelectors(paths, context, selectors); }

View File

@@ -340,7 +340,7 @@ less.Parser = function Parser(env) {
//
// The Parser
//
return parser = {
parser = {
imports: imports,
//
@@ -730,7 +730,9 @@ less.Parser = function Parser(env) {
if (input.charAt(i + 1) === '/') {
return new(tree.Comment)($re(/^\/\/.*/), true, i, env.currentFileInfo);
} else if (comment = $re(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/)) {
}
comment = $re(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/);
if (comment) {
return new(tree.Comment)(comment, false, i, env.currentFileInfo);
}
},
@@ -738,7 +740,11 @@ less.Parser = function Parser(env) {
comments: function () {
var comment, comments = [];
while(comment = this.comment()) {
while(true) {
comment = this.comment();
if (!comment) {
break;
}
comments.push(comment);
}
@@ -762,7 +768,8 @@ less.Parser = function Parser(env) {
if (e) { $char('~'); }
if (str = $re(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/)) {
str = $re(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);
if (str) {
return new(tree.Quoted)(str[0], str[1] || str[2], e, index, env.currentFileInfo);
}
},
@@ -775,7 +782,8 @@ less.Parser = function Parser(env) {
keyword: function () {
var k;
if (k = $re(/^[_A-Za-z-][_A-Za-z0-9-]*/)) {
k = $re(/^[_A-Za-z-][_A-Za-z0-9-]*/);
if (k) {
var color = tree.Color.fromKeyword(k);
if (color) {
return color;
@@ -797,7 +805,8 @@ less.Parser = function Parser(env) {
call: function () {
var name, nameLC, args, alpha_ret, index = i;
if (! (name = /^([\w-]+|%|progid:[\w\.]+)\(/.exec(current))) { return; }
name = /^([\w-]+|%|progid:[\w\.]+)\(/.exec(current);
if (!name) { return; }
name = name[1];
nameLC = name.toLowerCase();
@@ -827,7 +836,11 @@ less.Parser = function Parser(env) {
arguments: function () {
var args = [], arg;
while (arg = this.assignment() || parsers.expression()) {
while (true) {
arg = this.assignment() || parsers.expression();
if (!arg) {
break;
}
args.push(arg);
if (! $char(',')) {
break;
@@ -850,7 +863,15 @@ less.Parser = function Parser(env) {
assignment: function () {
var key, value;
if ((key = $re(/^\w+(?=\s?=)/i)) && $char('=') && (value = parsers.entity())) {
key = $re(/^\w+(?=\s?=)/i);
if (!key) {
return;
}
if (!$char('=')) {
return;
}
value = parsers.entity();
if (value) {
return new(tree.Assignment)(key, value);
}
},
@@ -874,7 +895,6 @@ less.Parser = function Parser(env) {
expectChar(')');
/*jshint eqnull:true */
return new(tree.URL)((value.value != null || value instanceof tree.Variable)
? value : new(tree.Anonymous)(value), env.currentFileInfo);
},
@@ -931,7 +951,8 @@ less.Parser = function Parser(env) {
return;
}
if (value = $re(/^([+-]?\d*\.?\d+)(%|[a-z]+)?/)) {
value = $re(/^([+-]?\d*\.?\d+)(%|[a-z]+)?/);
if (value) {
return new(tree.Dimension)(value[1], value[2]);
}
},
@@ -943,8 +964,9 @@ less.Parser = function Parser(env) {
//
unicodeDescriptor: function () {
var ud;
if (ud = $re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/)) {
ud = $re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/);
if (ud) {
return new(tree.UnicodeDescriptor)(ud[0]);
}
},
@@ -965,7 +987,8 @@ less.Parser = function Parser(env) {
if (e) { $char('~'); }
if (str = $re(/^`([^`]*)`/)) {
str = $re(/^`([^`]*)`/);
if (str) {
return new(tree.JavaScript)(str[1], i, e);
}
}
@@ -1045,7 +1068,11 @@ less.Parser = function Parser(env) {
save(); // stop us absorbing part of an invalid selector
while (e = $re(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)) {
while (true) {
e = $re(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/);
if (!e) {
break;
}
elem = new(tree.Element)(c, e, i, env.currentFileInfo);
if (elements) { elements.push(elem); } else { elements = [ elem ]; }
c = $char('>');
@@ -1192,7 +1219,8 @@ less.Parser = function Parser(env) {
save();
if (match = $re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)) {
match = $re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/);
if (match) {
name = match[1];
var argInfo = this.args(false);
@@ -1253,7 +1281,8 @@ less.Parser = function Parser(env) {
var value;
if (! $re(/^\(opacity=/i)) { return; }
if (value = $re(/^\d+/) || this.entities.variable()) {
value = $re(/^\d+/) || this.entities.variable();
if (value) {
expectChar(')');
return new(tree.Alpha)(value);
}
@@ -1362,7 +1391,8 @@ less.Parser = function Parser(env) {
key = expect(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/);
}
if (op = $re(/^[|~*$^]?=/)) {
op = $re(/^[|~*$^]?=/);
if (op) {
val = entities.quoted() || $re(/^[0-9]+%/) || $re(/^[\w-]+/) || entities.variableCurly();
}
@@ -1394,7 +1424,11 @@ less.Parser = function Parser(env) {
debugInfo = getDebugInfo(i, input, env);
}
while (s = this.lessSelector()) {
while (true) {
s = this.lessSelector();
if (!s) {
break;
}
if (selectors) { selectors.push(s); } else { selectors = [ s ]; }
this.comments();
if (! $char(',')) { break; }
@@ -1422,7 +1456,8 @@ less.Parser = function Parser(env) {
if (c === '.' || c === '#' || c === '&') { return; }
if (name = this.variable() || this.ruleProperty()) {
name = this.variable() || this.ruleProperty();
if (name) {
// prefer to try to parse first if its a variable or we are compressing
// but always fallback on the other one
value = !tryAnonymous && (env.compress || (name.charAt(0) === '@')) ?
@@ -1449,7 +1484,8 @@ less.Parser = function Parser(env) {
},
anonymousValue: function () {
var match;
if (match = /^([^@+\/'"*`(;{}-]*);/.exec(current)) {
match = /^([^@+\/'"*`(;{}-]*);/.exec(current);
if (match) {
i += match[0].length - 1;
return new(tree.Anonymous)(match[1]);
}
@@ -1491,7 +1527,8 @@ less.Parser = function Parser(env) {
// list of options, surrounded by parens
if (! $char('(')) { return null; }
do {
if (o = this.importOption()) {
o = this.importOption();
if (o) {
optionName = o;
value = true;
switch(optionName) {
@@ -1522,7 +1559,8 @@ less.Parser = function Parser(env) {
mediaFeature: function () {
var entities = this.entities, nodes = [], e, p;
do {
if (e = entities.keyword() || entities.variable()) {
e = entities.keyword() || entities.variable();
if (e) {
nodes.push(e);
} else if ($char('(')) {
p = this.property();
@@ -1547,13 +1585,17 @@ less.Parser = function Parser(env) {
mediaFeatures: function () {
var entities = this.entities, features = [], e;
do {
if (e = this.mediaFeature()) {
features.push(e);
if (! $char(',')) { break; }
} else if (e = entities.variable()) {
features.push(e);
if (! $char(',')) { break; }
}
e = this.mediaFeature();
if (e) {
features.push(e);
if (! $char(',')) { break; }
} else {
e = entities.variable();
if (e) {
features.push(e);
if (! $char(',')) { break; }
}
}
} while (e);
return features.length > 0 ? features : null;
@@ -1569,7 +1611,8 @@ less.Parser = function Parser(env) {
if ($re(/^@media/)) {
features = this.mediaFeatures();
if (rules = this.block()) {
rules = this.block();
if (rules) {
media = new(tree.Media)(rules, features, i, env.currentFileInfo);
if (env.dumpLineNumbers) {
media.debugInfo = debugInfo;
@@ -1590,7 +1633,8 @@ less.Parser = function Parser(env) {
if (input.charAt(i) !== '@') { return; }
if (value = this['import']() || this.media()) {
value = this['import']() || this.media();
if (value) {
return value;
}
@@ -1649,11 +1693,13 @@ less.Parser = function Parser(env) {
}
if (hasBlock) {
if (rules = this.block()) {
rules = this.block();
if (rules) {
return new(tree.Directive)(name, rules, i, env.currentFileInfo);
}
} else {
if ((value = hasExpression ? this.expression() : this.entity()) && $char(';')) {
value = hasExpression ? this.expression() : this.entity();
if (value && $char(';')) {
var directive = new(tree.Directive)(name, value, i, env.currentFileInfo);
if (env.dumpLineNumbers) {
directive.debugInfo = getDebugInfo(i, input, env);
@@ -1676,10 +1722,13 @@ less.Parser = function Parser(env) {
value: function () {
var e, expressions = [];
while (e = this.expression()) {
expressions.push(e);
if (! $char(',')) { break; }
}
do {
e = this.expression();
if (e) {
expressions.push(e);
if (! $char(',')) { break; }
}
} while(e);
if (expressions.length > 0) {
return new(tree.Value)(expressions);
@@ -1694,7 +1743,8 @@ less.Parser = function Parser(env) {
var a, e;
if ($char('(')) {
if (a = this.addition()) {
a = this.addition();
if (a) {
e = new(tree.Expression)([a]);
expectChar(')');
e.parens = true;
@@ -1704,27 +1754,44 @@ less.Parser = function Parser(env) {
},
multiplication: function () {
var m, a, op, operation, isSpaced;
if (m = this.operand()) {
m = this.operand();
if (m) {
isSpaced = isWhitespace(input, i - 1);
while (!peek(/^\/[*\/]/) && (op = ($char('/') || $char('*')))) {
if (a = this.operand()) {
m.parensInOp = true;
a.parensInOp = true;
operation = new(tree.Operation)(op, [operation || m, a], isSpaced);
isSpaced = isWhitespace(input, i - 1);
} else {
while (true) {
if (peek(/^\/[*\/]/)) {
break;
}
op = $char('/') || $char('*');
if (!op) { break; }
a = this.operand();
if (!a) { break; }
m.parensInOp = true;
a.parensInOp = true;
operation = new(tree.Operation)(op, [operation || m, a], isSpaced);
isSpaced = isWhitespace(input, i - 1);
}
return operation || m;
}
},
addition: function () {
var m, a, op, operation, isSpaced;
if (m = this.multiplication()) {
m = this.multiplication();
if (m) {
isSpaced = isWhitespace(input, i - 1);
while ((op = $re(/^[-+]\s+/) || (!isSpaced && ($char('+') || $char('-')))) &&
(a = this.multiplication())) {
while (true) {
op = $re(/^[-+]\s+/) || (!isSpaced && ($char('+') || $char('-')));
if (!op) {
break;
}
a = this.multiplication();
if (!a) {
break;
}
m.parensInOp = true;
a.parensInOp = true;
operation = new(tree.Operation)(op, [operation || m, a], isSpaced);
@@ -1736,8 +1803,16 @@ less.Parser = function Parser(env) {
conditions: function () {
var a, b, index = i, condition;
if (a = this.condition()) {
while (peek(/^,\s*(not\s*)?\(/) && $char(',') && (b = this.condition())) {
a = this.condition();
if (a) {
while (true) {
if (!peek(/^,\s*(not\s*)?\(/) || !$char(',')) {
break;
}
b = this.condition();
if (!b) {
break;
}
condition = new(tree.Condition)('or', condition || a, b, index);
}
return condition || a;
@@ -1749,9 +1824,12 @@ less.Parser = function Parser(env) {
if ($re(/^not/)) { negate = true; }
expectChar('(');
if (a = this.addition() || entities.keyword() || entities.quoted()) {
if (op = $re(/^(?:>=|<=|=<|[<=>])/)) {
if (b = this.addition() || entities.keyword() || entities.quoted()) {
a = this.addition() || entities.keyword() || entities.quoted();
if (a) {
op = $re(/^(?:>=|<=|=<|[<=>])/);
if (op) {
b = this.addition() || entities.keyword() || entities.quoted();
if (b) {
c = new(tree.Condition)(op, a, b, index, negate);
} else {
error('expected expression');
@@ -1795,32 +1873,37 @@ less.Parser = function Parser(env) {
expression: function () {
var entities = [], e, delim;
while (e = this.addition() || this.entity()) {
entities.push(e);
// operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here
if (!peek(/^\/[\/*]/) && (delim = $char('/'))) {
entities.push(new(tree.Anonymous)(delim));
do {
e = this.addition() || this.entity();
if (e) {
entities.push(e);
// operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here
if (!peek(/^\/[\/*]/)) {
delim = $char('/');
if (delim) {
entities.push(new(tree.Anonymous)(delim));
}
}
}
}
} while (e);
if (entities.length > 0) {
return new(tree.Expression)(entities);
}
},
property: function () {
var name;
if (name = $re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/)) {
var name = $re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);
if (name) {
return name[1];
}
},
ruleProperty: function () {
var name;
if (name = $re(/^(\*?-?[_a-zA-Z0-9-]+)\s*(\+?)\s*:/)) {
var name = $re(/^(\*?-?[_a-zA-Z0-9-]+)\s*(\+?)\s*:/);
if (name) {
return name[1] + (name[2] || "");
}
}
}
};
return parser;
};

View File

@@ -118,15 +118,18 @@
}
visitArgs.visitDeeper = false;
if (nodeRules = rulesetNode.rules) {
nodeRules = rulesetNode.rules;
if (nodeRules) {
this._mergeRules(nodeRules);
nodeRules = rulesetNode.rules;
}
if (nodeRules = rulesetNode.rules) {
if (nodeRules) {
this._removeDuplicateRules(nodeRules);
nodeRules = rulesetNode.rules;
}
// now decide whether we keep the ruleset
if ((nodeRules = rulesetNode.rules) && nodeRules.length > 0 && rulesetNode.paths.length > 0) {
if (nodeRules && nodeRules.length > 0 && rulesetNode.paths.length > 0) {
rulesets.splice(0, 0, rulesetNode);
}
} else {

View File

@@ -35,7 +35,8 @@ tree.debugInfo.asMediaQuery = function(ctx) {
tree.find = function (obj, fun) {
for (var i = 0, r; i < obj.length; i++) {
if (r = fun.call(obj, obj[i])) { return r; }
r = fun.call(obj, obj[i]);
if (r) { return r; }
}
return null;
};

View File

@@ -12,9 +12,8 @@ tree.Call = function (name, args, index, currentFileInfo) {
tree.Call.prototype = {
type: "Call",
accept: function (visitor) {
var args;
if (args = this.args) {
this.args = visitor.visitArray(args);
if (this.args) {
this.args = visitor.visitArray(this.args);
}
},
//
@@ -39,7 +38,6 @@ tree.Call.prototype = {
try {
func = new tree.functionCall(env, this.currentFileInfo);
result = func[nameLC].apply(func, args);
/*jshint eqnull:true */
if (result != null) {
return result;
}

View File

@@ -15,12 +15,11 @@ tree.Directive = function (name, value, index, currentFileInfo) {
tree.Directive.prototype = {
type: "Directive",
accept: function (visitor) {
var rules, value;
if (rules = this.rules) {
this.rules = visitor.visitArray(rules);
if (this.rules) {
this.rules = visitor.visitArray(this.rules);
}
if (value = this.value) {
this.value = visitor.visit(value);
if (this.value) {
this.value = visitor.visit(this.value);
}
},
genCSS: function (env, output) {

View File

@@ -4,9 +4,8 @@ tree.Expression = function (value) { this.value = value; };
tree.Expression.prototype = {
type: "Expression",
accept: function (visitor) {
var value;
if (value = this.value) {
this.value = visitor.visitArray(value);
if (this.value) {
this.value = visitor.visitArray(this.value);
}
},
eval: function (env) {

View File

@@ -13,12 +13,11 @@ tree.Media = function (value, features, index, currentFileInfo) {
tree.Media.prototype = {
type: "Media",
accept: function (visitor) {
var features, rules;
if (features = this.features) {
this.features = visitor.visit(features);
if (this.features) {
this.features = visitor.visit(this.features);
}
if (rules = this.rules) {
this.rules = visitor.visitArray(rules);
if (this.rules) {
this.rules = visitor.visitArray(this.rules);
}
},
genCSS: function (env, output) {

View File

@@ -11,12 +11,11 @@ tree.mixin.Call = function (elements, args, index, currentFileInfo, important) {
tree.mixin.Call.prototype = {
type: "MixinCall",
accept: function (visitor) {
var selector, args;
if (selector = this.selector) {
this.selector = visitor.visit(selector);
if (this.selector) {
this.selector = visitor.visit(this.selector);
}
if (args = this.arguments) {
this.arguments = visitor.visitArray(args);
if (this.arguments) {
this.arguments = visitor.visitArray(this.arguments);
}
},
eval: function (env) {
@@ -121,13 +120,12 @@ tree.mixin.Definition = function (name, params, rules, condition, variadic) {
tree.mixin.Definition.prototype = {
type: "MixinDefinition",
accept: function (visitor) {
var params, condition;
if ((params = this.params) && params.length) {
this.params = visitor.visitArray(params);
if (this.params && this.params.length) {
this.params = visitor.visitArray(this.params);
}
this.rules = visitor.visitArray(this.rules);
if (condition = this.condition) {
this.condition = visitor.visit(condition);
if (this.condition) {
this.condition = visitor.visit(this.condition);
}
},
variable: function (name) { return this.parent.variable.call(this, name); },

View File

@@ -9,14 +9,13 @@ tree.Ruleset = function (selectors, rules, strictImports) {
tree.Ruleset.prototype = {
type: "Ruleset",
accept: function (visitor) {
var paths, selectors, rules;
if (paths = this.paths) {
visitor.visitArray(paths, true);
} else if (selectors = this.selectors) {
this.selectors = visitor.visitArray(selectors);
if (this.paths) {
visitor.visitArray(this.paths, true);
} else if (this.selectors) {
this.selectors = visitor.visitArray(this.selectors);
}
if ((rules = this.rules) && rules.length) {
this.rules = visitor.visitArray(rules);
if (this.rules && this.rules.length) {
this.rules = visitor.visitArray(this.rules);
}
},
eval: function (env) {
@@ -153,15 +152,15 @@ tree.Ruleset.prototype = {
this._lookups = {};
},
variables: function () {
if (this._variables) { return this._variables; }
else {
return this._variables = !this.rules ? {} : this.rules.reduce(function (hash, r) {
if (!this._variables) {
this._variables = !this.rules ? {} : this.rules.reduce(function (hash, r) {
if (r instanceof tree.Rule && r.variable === true) {
hash[r.name] = r;
}
return hash;
}, {});
}
return this._variables;
},
variable: function (name) {
return this.variables()[name];
@@ -196,7 +195,8 @@ tree.Ruleset.prototype = {
this.rulesets().forEach(function (rule) {
if (rule !== self) {
for (var j = 0; j < rule.selectors.length; j++) {
if (match = selector.match(rule.selectors[j])) {
match = selector.match(rule.selectors[j]);
if (match) {
if (selector.elements.length > match) {
Array.prototype.push.apply(rules, rule.find(
new(tree.Selector)(selector.elements.slice(match)), self));
@@ -208,7 +208,8 @@ tree.Ruleset.prototype = {
}
}
});
return this._lookups[key] = rules;
this._lookups[key] = rules;
return rules;
},
genCSS: function (env, output) {
var i, j,
@@ -299,7 +300,8 @@ tree.Ruleset.prototype = {
}
sep = (env.compress ? "" : "\n") + (this.root ? tabRuleStr : tabSetStr);
if (rulesetNodeCnt = rulesetNodes.length) {
rulesetNodeCnt = rulesetNodes.length;
if (rulesetNodeCnt) {
if (ruleNodes.length && sep) { output.add(sep); }
rulesetNodes[0].genCSS(env, output);
for (i = 1; i < rulesetNodeCnt; i++) {

View File

@@ -13,19 +13,17 @@ tree.Selector = function (elements, extendList, condition, index, currentFileInf
tree.Selector.prototype = {
type: "Selector",
accept: function (visitor) {
var elements, extendList, condition;
if (elements = this.elements) {
this.elements = visitor.visitArray(elements);
if (this.elements) {
this.elements = visitor.visitArray(this.elements);
}
if (extendList = this.extendList) {
this.extendList = visitor.visitArray(extendList);
if (this.extendList) {
this.extendList = visitor.visitArray(this.extendList);
}
if (condition = this.condition) {
this.condition = visitor.visit(condition);
if (this.condition) {
this.condition = visitor.visit(this.condition);
}
},
createDerived: function(elements, extendList, evaldCondition) {
/*jshint eqnull:true */
evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition;
var newSelector = new(tree.Selector)(elements, extendList || this.extendList, this.condition, this.index, this.currentFileInfo, this.isReferenced);
newSelector.evaldCondition = evaldCondition;

View File

@@ -6,9 +6,8 @@ tree.Value = function (value) {
tree.Value.prototype = {
type: "Value",
accept: function (visitor) {
var value;
if (value = this.value) {
this.value = visitor.visitArray(value);
if (this.value) {
this.value = visitor.visitArray(this.value);
}
},
eval: function (env) {

View File

@@ -8,7 +8,7 @@ tree.Variable = function (name, index, currentFileInfo) {
tree.Variable.prototype = {
type: "Variable",
eval: function (env) {
var variable, v, name = this.name;
var variable, name = this.name;
if (name.indexOf('@@') === 0) {
name = '@' + new(tree.Variable)(name.slice(1)).eval(env).value;
@@ -23,15 +23,16 @@ tree.Variable.prototype = {
this.evaluating = true;
if (variable = tree.find(env.frames, function (frame) {
if (v = frame.variable(name)) {
variable = tree.find(env.frames, function (frame) {
var v = frame.variable(name);
if (v) {
return v.value.eval(env);
}
})) {
});
if (variable) {
this.evaluating = false;
return variable;
}
else {
} else {
throw { type: 'Name',
message: "variable " + name + " is undefined",
filename: this.currentFileInfo.filename,