Skip to content

Commit b67403d

Browse files
committed
Add allowRoot property to nodes that can be returned by a function into root or ruleset
1 parent a58bb76 commit b67403d

11 files changed

Lines changed: 13 additions & 10 deletions

File tree

‎lib/less/tree/comment.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var Comment = function (value, isLineComment, index, currentFileInfo) {
55
this.value = value;
66
this.isLineComment = isLineComment;
77
this.currentFileInfo = currentFileInfo;
8+
this.allowRoot = true;
89
};
910
Comment.prototype = new Node();
1011
Comment.prototype.type = "Comment";

‎lib/less/tree/directive.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var Directive = function (name, value, rules, index, currentFileInfo, debugInfo,
2323
this.debugInfo = debugInfo;
2424
this.isRooted = isRooted || false;
2525
this.copyVisibilityInfo(visibilityInfo);
26+
this.allowRoot = true;
2627
};
2728

2829
Directive.prototype = new Node();

‎lib/less/tree/extend.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ var Extend = function Extend(selector, option, index, currentFileInfo, visibilit
99
this.parent_ids = [this.object_id];
1010
this.currentFileInfo = currentFileInfo || {};
1111
this.copyVisibilityInfo(visibilityInfo);
12-
12+
this.allowRoot = true;
13+
1314
switch(option) {
1415
case "all":
1516
this.allowBefore = true;

‎lib/less/tree/import.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var Import = function (path, features, options, index, currentFileInfo, visibili
2323
this.path = path;
2424
this.features = features;
2525
this.currentFileInfo = currentFileInfo;
26+
this.allowRoot = true;
2627

2728
if (this.options.less !== undefined || this.options.inline) {
2829
this.css = !this.options.less || this.options.inline;

‎lib/less/tree/media.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var Media = function (value, features, index, currentFileInfo, visibilityInfo) {
1515
this.rules = [new Ruleset(selectors, value)];
1616
this.rules[0].allowImports = true;
1717
this.copyVisibilityInfo(visibilityInfo);
18+
this.allowRoot = true;
1819
};
1920
Media.prototype = new Directive();
2021
Media.prototype.type = "Media";

‎lib/less/tree/mixin-call.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var MixinCall = function (elements, args, index, currentFileInfo, important) {
99
this.index = index;
1010
this.currentFileInfo = currentFileInfo;
1111
this.important = important;
12+
this.allowRoot = true;
1213
};
1314
MixinCall.prototype = new Node();
1415
MixinCall.prototype.type = "MixinCall";

‎lib/less/tree/mixin-definition.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var Definition = function (name, params, rules, condition, variadic, frames, vis
2727
this.optionalParameters = optionalParameters;
2828
this.frames = frames;
2929
this.copyVisibilityInfo(visibilityInfo);
30+
this.allowRoot = true;
3031
};
3132
Definition.prototype = new Ruleset();
3233
Definition.prototype.type = "MixinDefinition";

‎lib/less/tree/rule.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var Rule = function (name, value, important, merge, index, currentFileInfo, inli
1212
this.inline = inline || false;
1313
this.variable = (variable !== undefined) ? variable
1414
: (name.charAt && (name.charAt(0) === '@'));
15+
this.allowRoot = true;
1516
};
1617

1718
function evalName(context, name) {

‎lib/less/tree/ruleset-call.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var Node = require("./node"),
33

44
var RulesetCall = function (variable) {
55
this.variable = variable;
6+
this.allowRoot = true;
67
};
78
RulesetCall.prototype = new Node();
89
RulesetCall.prototype.type = "RulesetCall";

‎lib/less/tree/ruleset.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ var Ruleset = function (selectors, rules, strictImports, visibilityInfo) {
1414
this._lookups = {};
1515
this.strictImports = strictImports;
1616
this.copyVisibilityInfo(visibilityInfo);
17+
this.allowRoot = true;
1718
};
1819
Ruleset.prototype = new Node();
1920
Ruleset.prototype.type = "Ruleset";

0 commit comments

Comments
 (0)