lib/less/js/lib/less/tree/variable.js in less-2.4.0 vs lib/less/js/lib/less/tree/variable.js in less-2.5.0

- old
+ new

@@ -1,14 +1,18 @@ (function (tree) { -tree.Variable = function (name, index, currentFileInfo) { this.name = name, this.index = index, this.currentFileInfo = currentFileInfo }; +tree.Variable = function (name, index, currentFileInfo) { + this.name = name; + this.index = index; + this.currentFileInfo = currentFileInfo || {}; +}; tree.Variable.prototype = { type: "Variable", eval: function (env) { - var variable, v, name = this.name; + var variable, name = this.name; - if (name.indexOf('@@') == 0) { + if (name.indexOf('@@') === 0) { name = '@' + new(tree.Variable)(name.slice(1)).eval(env).value; } if (this.evaluating) { throw { type: 'Name', @@ -17,18 +21,19 @@ index: this.index }; } 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, index: this.index }; }