Comparing version 3.5.0-beta.3 to 3.5.0-beta.4
@@ -40,3 +40,4 @@ var tree = Object.create(null); | ||
tree.VariableCall = require('./variable-call'); | ||
tree.NamespaceValue = require('./namespace-value'); | ||
module.exports = tree; |
@@ -31,2 +31,4 @@ var Node = require('./node'), | ||
this.selector = this.selector.eval(context); | ||
function calcDefGroup(mixin, mixinPath) { | ||
@@ -33,0 +35,0 @@ var f, p, namespace; |
@@ -5,2 +5,3 @@ var Selector = require('./selector'), | ||
Declaration = require('./declaration'), | ||
DetachedRuleset = require('./detached-ruleset'), | ||
Expression = require('./expression'), | ||
@@ -101,3 +102,9 @@ contexts = require('../contexts'), | ||
if (val) { | ||
val = val.eval(context); | ||
// This was a mixin call, pass in a detached ruleset of it's eval'd rules | ||
if (Array.isArray(val)) { | ||
val = new DetachedRuleset(new Ruleset('', val)); | ||
} | ||
else { | ||
val = val.eval(context); | ||
} | ||
} else if (params[i].value) { | ||
@@ -104,0 +111,0 @@ val = params[i].value.eval(mixinEnv); |
var Node = require('./node'), | ||
Variable = require('./variable'); | ||
Variable = require('./variable'), | ||
Ruleset = require('./ruleset'), | ||
DetachedRuleset = require('./detached-ruleset'), | ||
LessError = require('../less-error'); | ||
var VariableCall = function (variable) { | ||
var VariableCall = function (variable, index, currentFileInfo) { | ||
this.variable = variable; | ||
this._index = index; | ||
this._fileInfo = currentFileInfo; | ||
this.allowRoot = true; | ||
@@ -11,5 +16,22 @@ }; | ||
VariableCall.prototype.eval = function (context) { | ||
var detachedRuleset = new Variable(this.variable).eval(context); | ||
return detachedRuleset.callEval(context); | ||
var rules, detachedRuleset = new Variable(this.variable, this.getIndex(), this.fileInfo()).eval(context), | ||
error = new LessError({message: 'Could not evaluate variable call ' + this.variable}); | ||
if (!detachedRuleset.ruleset) { | ||
if (Array.isArray(detachedRuleset)) { | ||
rules = detachedRuleset; | ||
} | ||
else if (Array.isArray(detachedRuleset.value)) { | ||
rules = detachedRuleset.value; | ||
} | ||
else { | ||
throw error; | ||
} | ||
detachedRuleset = new DetachedRuleset(new Ruleset('', rules)); | ||
} | ||
if (detachedRuleset.ruleset) { | ||
return detachedRuleset.callEval(context); | ||
} | ||
throw error; | ||
}; | ||
module.exports = VariableCall; |
{ | ||
"name": "less", | ||
"version": "3.5.0-beta.3", | ||
"version": "3.5.0-beta.4", | ||
"description": "Leaner CSS", | ||
@@ -5,0 +5,0 @@ "homepage": "http://lesscss.org", |
@@ -10,2 +10,3 @@ var lessTest = require('./less-test'), | ||
var testMap = [ | ||
[{}, 'edge/'], | ||
[{ | ||
@@ -12,0 +13,0 @@ strictMath: false, |
@@ -252,3 +252,3 @@ /* jshint latedef: nofunc */ | ||
fs.readdirSync(path.join(baseFolder, foldername)).forEach(function (file) { | ||
if (!/\.less/.test(file)) { return; } | ||
if (!/\.less$/.test(file)) { return; } | ||
@@ -255,0 +255,0 @@ var name = getBasename(file); |
@@ -1,4 +0,4 @@ | ||
ParseError: Expected ')' in {path}detached-ruleset-2.less on line 5, column 9: | ||
ParseError: Missing '[...]' lookup in variable call in {path}detached-ruleset-2.less on line 5, column 8: | ||
4 .a { | ||
5 a: @a(); | ||
6 } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2224543
955
42407