[Pkg-javascript-commits] [less.js] 192/285: Whitespace - undo unusual new() syntax
Jonas Smedegaard
dr at jones.dk
Mon Oct 26 23:23:53 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag v2.0.0
in repository less.js.
commit 9d535c0470eb852b8d69ba2f3b1e10d55f946a4f
Author: Luke Page <luke.a.page at gmail.com>
Date: Sun Oct 19 16:57:22 2014 +0100
Whitespace - undo unusual new() syntax
---
benchmark/less-benchmark.js | 4 ++--
lib/less-browser/cache.js | 4 ++--
lib/less/functions/color-blending.js | 2 +-
lib/less/functions/color.js | 36 ++++++++++++++++++------------------
lib/less/functions/math.js | 2 +-
lib/less/functions/number.js | 18 +++++++++---------
lib/less/functions/string.js | 8 ++++----
lib/less/functions/types.js | 4 ++--
lib/less/transform-tree.js | 24 ++++++++++++------------
lib/less/tree/assignment.js | 2 +-
lib/less/tree/attribute.js | 2 +-
lib/less/tree/color.js | 6 +++---
lib/less/tree/dimension.js | 8 ++++----
lib/less/tree/directive.js | 2 +-
lib/less/tree/element.js | 4 ++--
lib/less/tree/expression.js | 4 ++--
lib/less/tree/extend.js | 4 ++--
lib/less/tree/import.js | 12 ++++++------
lib/less/tree/javascript.js | 8 ++++----
lib/less/tree/js-eval-node.js | 4 ++--
lib/less/tree/keyword.js | 4 ++--
lib/less/tree/media.js | 24 ++++++++++++------------
lib/less/tree/mixin-call.js | 2 +-
lib/less/tree/mixin-definition.js | 14 +++++++-------
lib/less/tree/negative.js | 4 ++--
lib/less/tree/operation.js | 2 +-
lib/less/tree/paren.js | 2 +-
lib/less/tree/quoted.js | 4 ++--
lib/less/tree/rule.js | 6 +++---
lib/less/tree/ruleset-call.js | 2 +-
lib/less/tree/ruleset.js | 12 ++++++------
lib/less/tree/selector.js | 2 +-
lib/less/tree/value.js | 2 +-
lib/less/tree/variable.js | 2 +-
lib/less/visitors/import-visitor.js | 2 +-
35 files changed, 121 insertions(+), 121 deletions(-)
diff --git a/benchmark/less-benchmark.js b/benchmark/less-benchmark.js
index de67623..58a0d71 100644
--- a/benchmark/less-benchmark.js
+++ b/benchmark/less-benchmark.js
@@ -12,9 +12,9 @@ fs.readFile(file, 'utf8', function (e, data) {
console.log("Benchmarking...\n", path.basename(file) + " (" +
parseInt(data.length / 1024) + " KB)", "");
- start = new(Date);
+ start = new Date();
- new(less.Parser)().parse(data, function (err, tree) {
+ new less.Parser().parse(data, function (err, tree) {
end = new Date();
total = end - start;
diff --git a/lib/less-browser/cache.js b/lib/less-browser/cache.js
index fd7a454..3a4a709 100644
--- a/lib/less-browser/cache.js
+++ b/lib/less-browser/cache.js
@@ -25,8 +25,8 @@ module.exports = function(window, options, logger) {
timestamp = cache && cache.getItem(path + ':timestamp');
if (timestamp && webInfo.lastModified &&
- (new(Date)(webInfo.lastModified).valueOf() ===
- new(Date)(timestamp).valueOf())) {
+ (new Date(webInfo.lastModified).valueOf() ===
+ new Date(timestamp).valueOf())) {
// Use local copy
return css;
}
diff --git a/lib/less/functions/color-blending.js b/lib/less/functions/color-blending.js
index 5370451..4d62c9a 100644
--- a/lib/less/functions/color-blending.js
+++ b/lib/less/functions/color-blending.js
@@ -21,7 +21,7 @@ function colorBlend(mode, color1, color2) {
r[i] = cr * 255;
}
- return new(Color)(r, ar);
+ return new Color(r, ar);
}
var colorBlendModeFunctions = {
diff --git a/lib/less/functions/color.js b/lib/less/functions/color.js
index 5355823..5158132 100644
--- a/lib/less/functions/color.js
+++ b/lib/less/functions/color.js
@@ -37,7 +37,7 @@ colorFunctions = {
rgba: function (r, g, b, a) {
var rgb = [r, g, b].map(function (c) { return scaled(c, 255); });
a = number(a);
- return new(Color)(rgb, a);
+ return new Color(rgb, a);
},
hsl: function (h, s, l) {
return colorFunctions.hsla(h, s, l, 1.0);
@@ -93,37 +93,37 @@ colorFunctions = {
},
hue: function (color) {
- return new(Dimension)(color.toHSL().h);
+ return new Dimension(color.toHSL().h);
},
saturation: function (color) {
- return new(Dimension)(color.toHSL().s * 100, '%');
+ return new Dimension(color.toHSL().s * 100, '%');
},
lightness: function (color) {
- return new(Dimension)(color.toHSL().l * 100, '%');
+ return new Dimension(color.toHSL().l * 100, '%');
},
hsvhue: function(color) {
- return new(Dimension)(color.toHSV().h);
+ return new Dimension(color.toHSV().h);
},
hsvsaturation: function (color) {
- return new(Dimension)(color.toHSV().s * 100, '%');
+ return new Dimension(color.toHSV().s * 100, '%');
},
hsvvalue: function (color) {
- return new(Dimension)(color.toHSV().v * 100, '%');
+ return new Dimension(color.toHSV().v * 100, '%');
},
red: function (color) {
- return new(Dimension)(color.rgb[0]);
+ return new Dimension(color.rgb[0]);
},
green: function (color) {
- return new(Dimension)(color.rgb[1]);
+ return new Dimension(color.rgb[1]);
},
blue: function (color) {
- return new(Dimension)(color.rgb[2]);
+ return new Dimension(color.rgb[2]);
},
alpha: function (color) {
- return new(Dimension)(color.toHSL().a);
+ return new Dimension(color.toHSL().a);
},
luma: function (color) {
- return new(Dimension)(color.luma() * color.alpha * 100, '%');
+ return new Dimension(color.luma() * color.alpha * 100, '%');
},
luminance: function (color) {
var luminance =
@@ -131,7 +131,7 @@ colorFunctions = {
+ (0.7152 * color.rgb[1] / 255)
+ (0.0722 * color.rgb[2] / 255);
- return new(Dimension)(luminance * color.alpha * 100, '%');
+ return new Dimension(luminance * color.alpha * 100, '%');
},
saturate: function (color, amount) {
// filter: saturate(3.2);
@@ -201,7 +201,7 @@ colorFunctions = {
//
mix: function (color1, color2, weight) {
if (!weight) {
- weight = new(Dimension)(50);
+ weight = new Dimension(50);
}
var p = weight.value / 100.0;
var w = p * 2 - 1;
@@ -216,10 +216,10 @@ colorFunctions = {
var alpha = color1.alpha * p + color2.alpha * (1 - p);
- return new(Color)(rgb, alpha);
+ return new Color(rgb, alpha);
},
greyscale: function (color) {
- return colorFunctions.desaturate(color, new(Dimension)(100));
+ return colorFunctions.desaturate(color, new Dimension(100));
},
contrast: function (color, dark, light, threshold) {
// filter: contrast(3.2);
@@ -251,12 +251,12 @@ colorFunctions = {
}
},
argb: function (color) {
- return new(Anonymous)(color.toARGB());
+ return new Anonymous(color.toARGB());
},
color: function(c) {
if ((c instanceof Quoted) &&
(/^#([a-f0-9]{6}|[a-f0-9]{3})$/i.test(c.value))) {
- return new(Color)(c.value.slice(1));
+ return new Color(c.value.slice(1));
}
if ((c instanceof Color) || (c = Color.fromKeyword(c.value))) {
c.keyword = undefined;
diff --git a/lib/less/functions/math.js b/lib/less/functions/math.js
index b345fc3..2067519 100644
--- a/lib/less/functions/math.js
+++ b/lib/less/functions/math.js
@@ -24,7 +24,7 @@ function _math(fn, unit, n) {
} else {
n = n.unify();
}
- return new(Dimension)(fn(parseFloat(n.value)), unit);
+ return new Dimension(fn(parseFloat(n.value)), unit);
}
for (var f in mathFunctions) {
diff --git a/lib/less/functions/number.js b/lib/less/functions/number.js
index c4fb3ae..464323f 100644
--- a/lib/less/functions/number.js
+++ b/lib/less/functions/number.js
@@ -19,7 +19,7 @@ var minMax = function (isMin, args) {
}
continue;
}
- currentUnified = current.unit.toString() === "" && unitClone !== undefined ? new(Dimension)(current.value, unitClone).unify() : current.unify();
+ currentUnified = current.unit.toString() === "" && unitClone !== undefined ? new Dimension(current.value, unitClone).unify() : current.unify();
unit = currentUnified.unit.toString() === "" && unitStatic !== undefined ? unitStatic : currentUnified.unit.toString();
unitStatic = unit !== "" && unitStatic === undefined || unit !== "" && order[0].unify().unit.toString() === "" ? unit : unitStatic;
unitClone = unit !== "" && unitClone === undefined ? current.unit.toString() : unitClone;
@@ -32,7 +32,7 @@ var minMax = function (isMin, args) {
order.push(current);
continue;
}
- referenceUnified = order[j].unit.toString() === "" && unitClone !== undefined ? new(Dimension)(order[j].value, unitClone).unify() : order[j].unify();
+ referenceUnified = order[j].unit.toString() === "" && unitClone !== undefined ? new Dimension(order[j].value, unitClone).unify() : order[j].unify();
if ( isMin && currentUnified.value < referenceUnified.value ||
!isMin && currentUnified.value > referenceUnified.value) {
order[j] = current;
@@ -42,7 +42,7 @@ var minMax = function (isMin, args) {
return order[0];
}
args = order.map(function (a) { return a.toCSS(this.context); }).join(this.context.compress ? "," : ", ");
- return new(Anonymous)((isMin ? "min" : "max") + "(" + args + ")");
+ return new Anonymous((isMin ? "min" : "max") + "(" + args + ")");
};
functionRegistry.addMultiple({
min: function () {
@@ -55,22 +55,22 @@ functionRegistry.addMultiple({
return val.convertTo(unit.value);
},
pi: function () {
- return new(Dimension)(Math.PI);
+ return new Dimension(Math.PI);
},
mod: function(a, b) {
- return new(Dimension)(a.value % b.value, a.unit);
+ return new Dimension(a.value % b.value, a.unit);
},
pow: function(x, y) {
if (typeof x === "number" && typeof y === "number") {
- x = new(Dimension)(x);
- y = new(Dimension)(y);
+ x = new Dimension(x);
+ y = new Dimension(y);
} else if (!(x instanceof Dimension) || !(y instanceof Dimension)) {
throw { type: "Argument", message: "arguments must be numbers" };
}
- return new(Dimension)(Math.pow(x.value, y.value), x.unit);
+ return new Dimension(Math.pow(x.value, y.value), x.unit);
},
percentage: function (n) {
- return new(Dimension)(n.value * 100, '%');
+ return new Dimension(n.value * 100, '%');
}
});
diff --git a/lib/less/functions/string.js b/lib/less/functions/string.js
index efeb810..1b55d4c 100644
--- a/lib/less/functions/string.js
+++ b/lib/less/functions/string.js
@@ -5,16 +5,16 @@ var Quoted = require("../tree/quoted"),
functionRegistry.addMultiple({
e: function (str) {
- return new(Anonymous)(str instanceof JavaScript ? str.evaluated : str.value);
+ return new Anonymous(str instanceof JavaScript ? str.evaluated : str.value);
},
escape: function (str) {
- return new(Anonymous)(encodeURI(str.value).replace(/=/g, "%3D").replace(/:/g, "%3A").replace(/#/g, "%23").replace(/;/g, "%3B").replace(/\(/g, "%28").replace(/\)/g, "%29"));
+ return new Anonymous(encodeURI(str.value).replace(/=/g, "%3D").replace(/:/g, "%3A").replace(/#/g, "%23").replace(/;/g, "%3B").replace(/\(/g, "%28").replace(/\)/g, "%29"));
},
replace: function (string, pattern, replacement, flags) {
var result = string.value;
result = result.replace(new RegExp(pattern.value, flags ? flags.value : ''), replacement.value);
- return new(Quoted)(string.quote || '', result, string.escaped);
+ return new Quoted(string.quote || '', result, string.escaped);
},
'%': function (string /* arg, arg, ...*/) {
var args = Array.prototype.slice.call(arguments, 1),
@@ -28,6 +28,6 @@ functionRegistry.addMultiple({
});
}
result = result.replace(/%%/g, '%');
- return new(Quoted)(string.quote || '', result, string.escaped);
+ return new Quoted(string.quote || '', result, string.escaped);
}
});
diff --git a/lib/less/functions/types.js b/lib/less/functions/types.js
index 2870f03..d1a58be 100644
--- a/lib/less/functions/types.js
+++ b/lib/less/functions/types.js
@@ -52,10 +52,10 @@ functionRegistry.addMultiple({
} else {
unit = "";
}
- return new(Dimension)(val.value, unit);
+ return new Dimension(val.value, unit);
},
"get-unit": function (n) {
- return new(Anonymous)(n.unit);
+ return new Anonymous(n.unit);
},
extract: function(values, index) {
index = index.value - 1; // (1-based index)
diff --git a/lib/less/transform-tree.js b/lib/less/transform-tree.js
index 5a456de..5b2f1db 100644
--- a/lib/less/transform-tree.js
+++ b/lib/less/transform-tree.js
@@ -11,12 +11,12 @@ module.exports = function(root, options) {
//
// Allows setting variables with a hash, so:
//
- // `{ color: new(tree.Color)('#f01') }` will become:
+ // `{ color: new tree.Color('#f01') }` will become:
//
- // new(tree.Rule)('@color',
- // new(tree.Value)([
- // new(tree.Expression)([
- // new(tree.Color)('#f01')
+ // new tree.Rule('@color',
+ // new tree.Value([
+ // new tree.Expression([
+ // new tree.Color('#f01')
// ])
// ])
// )
@@ -27,20 +27,20 @@ module.exports = function(root, options) {
if (! (value instanceof tree.Value)) {
if (! (value instanceof tree.Expression)) {
- value = new(tree.Expression)([value]);
+ value = new tree.Expression([value]);
}
- value = new(tree.Value)([value]);
+ value = new tree.Value([value]);
}
- return new(tree.Rule)('@' + k, value, false, null, 0);
+ return new tree.Rule('@' + k, value, false, null, 0);
});
- evalEnv.frames = [new(tree.Ruleset)(null, variables)];
+ evalEnv.frames = [new tree.Ruleset(null, variables)];
}
var preEvalVisitors = [],
visitors = [
- new(visitor.JoinSelectorVisitor)(),
- new(visitor.ExtendVisitor)(),
- new(visitor.ToCSSVisitor)({compress: Boolean(options.compress)})
+ new visitor.JoinSelectorVisitor(),
+ new visitor.ExtendVisitor(),
+ new visitor.ToCSSVisitor({compress: Boolean(options.compress)})
], i;
if (options.pluginManager) {
diff --git a/lib/less/tree/assignment.js b/lib/less/tree/assignment.js
index d647b4e..ec91263 100644
--- a/lib/less/tree/assignment.js
+++ b/lib/less/tree/assignment.js
@@ -12,7 +12,7 @@ Assignment.prototype.accept = function (visitor) {
};
Assignment.prototype.eval = function (context) {
if (this.value.eval) {
- return new(Assignment)(this.key, this.value.eval(context));
+ return new Assignment(this.key, this.value.eval(context));
}
return this;
};
diff --git a/lib/less/tree/attribute.js b/lib/less/tree/attribute.js
index 3596315..488ded7 100644
--- a/lib/less/tree/attribute.js
+++ b/lib/less/tree/attribute.js
@@ -8,7 +8,7 @@ var Attribute = function (key, op, value) {
Attribute.prototype = new Node();
Attribute.prototype.type = "Attribute";
Attribute.prototype.eval = function (context) {
- return new(Attribute)(this.key.eval ? this.key.eval(context) : this.key,
+ return new Attribute(this.key.eval ? this.key.eval(context) : this.key,
this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.value);
};
Attribute.prototype.genCSS = function (context, output) {
diff --git a/lib/less/tree/color.js b/lib/less/tree/color.js
index de903c5..cfaccf3 100644
--- a/lib/less/tree/color.js
+++ b/lib/less/tree/color.js
@@ -101,7 +101,7 @@ Color.prototype.operate = function (context, op, other) {
for (var c = 0; c < 3; c++) {
rgb[c] = this._operate(context, op, this.rgb[c], other.rgb[c]);
}
- return new(Color)(rgb, alpha);
+ return new Color(rgb, alpha);
};
Color.prototype.toRGB = function () {
return toHex(this.rgb);
@@ -172,10 +172,10 @@ Color.prototype.compare = function (x) {
Color.fromKeyword = function(keyword) {
var c, key = keyword.toLowerCase();
if (colors.hasOwnProperty(key)) {
- c = new(Color)(colors[key].slice(1));
+ c = new Color(colors[key].slice(1));
}
else if (key === "transparent") {
- c = new(Color)([0, 0, 0], 0);
+ c = new Color([0, 0, 0], 0);
}
if (c) {
diff --git a/lib/less/tree/dimension.js b/lib/less/tree/dimension.js
index c5bf453..1f8de7b 100644
--- a/lib/less/tree/dimension.js
+++ b/lib/less/tree/dimension.js
@@ -9,7 +9,7 @@ var Node = require("./node"),
var Dimension = function (value, unit) {
this.value = parseFloat(value);
this.unit = (unit && unit instanceof Unit) ? unit :
- new(Unit)(unit ? [unit] : undefined);
+ new Unit(unit ? [unit] : undefined);
};
Dimension.prototype = new Node();
@@ -21,7 +21,7 @@ Dimension.prototype.eval = function (context) {
return this;
};
Dimension.prototype.toColor = function () {
- return new(Color)([this.value, this.value, this.value]);
+ return new Color([this.value, this.value, this.value]);
};
Dimension.prototype.genCSS = function (context, output) {
if ((context && context.strictUnits) && !this.unit.isSingular()) {
@@ -86,7 +86,7 @@ Dimension.prototype.operate = function (context, op, other) {
unit.denominator = unit.denominator.concat(other.unit.numerator).sort();
unit.cancel();
}
- return new(Dimension)(value, unit);
+ return new Dimension(value, unit);
};
Dimension.prototype.compare = function (other) {
var a, b;
@@ -150,6 +150,6 @@ Dimension.prototype.convertTo = function (conversions) {
unit.cancel();
- return new(Dimension)(value, unit);
+ return new Dimension(value, unit);
};
module.exports = Dimension;
diff --git a/lib/less/tree/directive.js b/lib/less/tree/directive.js
index 37c5cb1..3645cb0 100644
--- a/lib/less/tree/directive.js
+++ b/lib/less/tree/directive.js
@@ -52,7 +52,7 @@ Directive.prototype.eval = function (context) {
rules = rules.eval(context);
rules.root = true;
}
- return new(Directive)(this.name, value, rules,
+ return new Directive(this.name, value, rules,
this.index, this.currentFileInfo, this.debugInfo);
};
Directive.prototype.variable = function (name) { if (this.rules) return Ruleset.prototype.variable.call(this.rules, name); };
diff --git a/lib/less/tree/element.js b/lib/less/tree/element.js
index df46b00..2285281 100644
--- a/lib/less/tree/element.js
+++ b/lib/less/tree/element.js
@@ -4,7 +4,7 @@ var Node = require("./node"),
var Element = function (combinator, value, index, currentFileInfo) {
this.combinator = combinator instanceof Combinator ?
- combinator : new(Combinator)(combinator);
+ combinator : new Combinator(combinator);
if (typeof(value) === 'string') {
this.value = value.trim();
@@ -26,7 +26,7 @@ Element.prototype.accept = function (visitor) {
}
};
Element.prototype.eval = function (context) {
- return new(Element)(this.combinator,
+ return new Element(this.combinator,
this.value.eval ? this.value.eval(context) : this.value,
this.index,
this.currentFileInfo);
diff --git a/lib/less/tree/expression.js b/lib/less/tree/expression.js
index 3083e3b..00024ce 100644
--- a/lib/less/tree/expression.js
+++ b/lib/less/tree/expression.js
@@ -21,7 +21,7 @@ Expression.prototype.eval = function (context) {
context.inParenthesis();
}
if (this.value.length > 1) {
- returnValue = new(Expression)(this.value.map(function (e) {
+ returnValue = new Expression(this.value.map(function (e) {
return e.eval(context);
}));
} else if (this.value.length === 1) {
@@ -36,7 +36,7 @@ Expression.prototype.eval = function (context) {
context.outOfParenthesis();
}
if (this.parens && this.parensInOp && !(context.isMathOn()) && !doubleParen) {
- returnValue = new(Paren)(returnValue);
+ returnValue = new Paren(returnValue);
}
return returnValue;
};
diff --git a/lib/less/tree/extend.js b/lib/less/tree/extend.js
index 7758ea1..f95d0af 100644
--- a/lib/less/tree/extend.js
+++ b/lib/less/tree/extend.js
@@ -26,10 +26,10 @@ Extend.prototype.accept = function (visitor) {
this.selector = visitor.visit(this.selector);
};
Extend.prototype.eval = function (context) {
- return new(Extend)(this.selector.eval(context), this.option, this.index);
+ return new Extend(this.selector.eval(context), this.option, this.index);
};
Extend.prototype.clone = function (context) {
- return new(Extend)(this.selector, this.option, this.index);
+ return new Extend(this.selector, this.option, this.index);
};
Extend.prototype.findSelfSelectors = function (selectors) {
var selfElements = [],
diff --git a/lib/less/tree/import.js b/lib/less/tree/import.js
index f1e5cae..5183d76 100644
--- a/lib/less/tree/import.js
+++ b/lib/less/tree/import.js
@@ -79,7 +79,7 @@ Import.prototype.evalForImport = function (context) {
if (path instanceof URL) {
path = path.value;
}
- return new(Import)(path.eval(context), this.features, this.options, this.index, this.currentFileInfo);
+ return new Import(path.eval(context), this.features, this.options, this.index, this.currentFileInfo);
};
Import.prototype.evalPath = function (context) {
var path = this.path.eval(context);
@@ -111,20 +111,20 @@ Import.prototype.eval = function (context) {
}
if (this.options.inline) {
- var contents = new(Anonymous)(this.root, 0, {filename: this.importedFilename}, true, true);
- return this.features ? new(Media)([contents], this.features.value) : [contents];
+ var contents = new Anonymous(this.root, 0, {filename: this.importedFilename}, true, true);
+ return this.features ? new Media([contents], this.features.value) : [contents];
} else if (this.css) {
- var newImport = new(Import)(this.evalPath(context), features, this.options, this.index);
+ var newImport = new Import(this.evalPath(context), features, this.options, this.index);
if (!newImport.css && this.error) {
throw this.error;
}
return newImport;
} else {
- ruleset = new(Ruleset)(null, this.root.rules.slice(0));
+ ruleset = new Ruleset(null, this.root.rules.slice(0));
ruleset.evalImports(context);
- return this.features ? new(Media)(ruleset.rules, this.features.value) : ruleset.rules;
+ return this.features ? new Media(ruleset.rules, this.features.value) : ruleset.rules;
}
};
module.exports = Import;
diff --git a/lib/less/tree/javascript.js b/lib/less/tree/javascript.js
index b951bfa..7f17787 100644
--- a/lib/less/tree/javascript.js
+++ b/lib/less/tree/javascript.js
@@ -15,13 +15,13 @@ JavaScript.prototype.eval = function(context) {
var result = this.evaluateJavaScript(this.expression, context);
if (typeof(result) === 'number') {
- return new(Dimension)(result);
+ return new Dimension(result);
} else if (typeof(result) === 'string') {
- return new(Quoted)('"' + result + '"', result, this.escaped, this.index);
+ return new Quoted('"' + result + '"', result, this.escaped, this.index);
} else if (Array.isArray(result)) {
- return new(Anonymous)(result.join(', '));
+ return new Anonymous(result.join(', '));
} else {
- return new(Anonymous)(result);
+ return new Anonymous(result);
}
};
diff --git a/lib/less/tree/js-eval-node.js b/lib/less/tree/js-eval-node.js
index c9f86c7..30fbbfa 100644
--- a/lib/less/tree/js-eval-node.js
+++ b/lib/less/tree/js-eval-node.js
@@ -17,11 +17,11 @@ JsEvalNode.prototype.evaluateJavaScript = function (expression, context) {
}
expression = expression.replace(/@\{([\w-]+)\}/g, function (_, name) {
- return that.jsify(new(Variable)('@' + name, that.index, that.currentFileInfo).eval(context));
+ return that.jsify(new Variable('@' + name, that.index, that.currentFileInfo).eval(context));
});
try {
- expression = new(Function)('return (' + expression + ')');
+ expression = new Function('return (' + expression + ')');
} catch (e) {
throw { message: "JavaScript evaluation error: " + e.message + " from `" + expression + "`" ,
filename: this.currentFileInfo.filename,
diff --git a/lib/less/tree/keyword.js b/lib/less/tree/keyword.js
index cbf3db4..cbb508e 100644
--- a/lib/less/tree/keyword.js
+++ b/lib/less/tree/keyword.js
@@ -8,7 +8,7 @@ Keyword.prototype.genCSS = function (context, output) {
output.add(this.value);
};
-Keyword.True = new(Keyword)('true');
-Keyword.False = new(Keyword)('false');
+Keyword.True = new Keyword('true');
+Keyword.False = new Keyword('false');
module.exports = Keyword;
diff --git a/lib/less/tree/media.js b/lib/less/tree/media.js
index 8ec9927..e1436c1 100644
--- a/lib/less/tree/media.js
+++ b/lib/less/tree/media.js
@@ -12,8 +12,8 @@ var Media = function (value, features, index, currentFileInfo) {
var selectors = this.emptySelectors();
- this.features = new(Value)(features);
- this.rules = [new(Ruleset)(selectors, value)];
+ this.features = new Value(features);
+ this.rules = [new Ruleset(selectors, value)];
this.rules[0].allowImports = true;
};
Media.prototype = new Directive();
@@ -38,7 +38,7 @@ Media.prototype.eval = function (context) {
context.mediaPath = [];
}
- var media = new(Media)(null, [], this.index, this.currentFileInfo);
+ var media = new Media(null, [], this.index, this.currentFileInfo);
if(this.debugInfo) {
this.rules[0].debugInfo = this.debugInfo;
media.debugInfo = this.debugInfo;
@@ -74,8 +74,8 @@ Media.prototype.variable = function (name) { return Ruleset.prototype.variable.c
Media.prototype.find = function () { return Ruleset.prototype.find.apply(this.rules[0], arguments); };
Media.prototype.rulesets = function () { return Ruleset.prototype.rulesets.apply(this.rules[0]); };
Media.prototype.emptySelectors = function() {
- var el = new(Element)('', '&', this.index, this.currentFileInfo),
- sels = [new(Selector)([el], null, null, this.index, this.currentFileInfo)];
+ var el = new Element('', '&', this.index, this.currentFileInfo),
+ sels = [new Selector([el], null, null, this.index, this.currentFileInfo)];
sels[0].mediaEmpty = true;
return sels;
};
@@ -95,7 +95,7 @@ Media.prototype.evalTop = function (context) {
// Render all dependent Media blocks.
if (context.mediaBlocks.length > 1) {
var selectors = this.emptySelectors();
- result = new(Ruleset)(selectors, context.mediaBlocks);
+ result = new Ruleset(selectors, context.mediaBlocks);
result.multiMedia = true;
}
@@ -122,20 +122,20 @@ Media.prototype.evalNested = function (context) {
// a and e
// b and c and d
// b and c and e
- this.features = new(Value)(this.permute(path).map(function (path) {
+ this.features = new Value(this.permute(path).map(function (path) {
path = path.map(function (fragment) {
- return fragment.toCSS ? fragment : new(Anonymous)(fragment);
+ return fragment.toCSS ? fragment : new Anonymous(fragment);
});
for(i = path.length - 1; i > 0; i--) {
- path.splice(i, 0, new(Anonymous)("and"));
+ path.splice(i, 0, new Anonymous("and"));
}
- return new(Expression)(path);
+ return new Expression(path);
}));
// Fake a tree-node that doesn't output anything.
- return new(Ruleset)([], []);
+ return new Ruleset([], []);
};
Media.prototype.permute = function (arr) {
if (arr.length === 0) {
@@ -156,6 +156,6 @@ Media.prototype.permute = function (arr) {
Media.prototype.bubbleSelectors = function (selectors) {
if (!selectors)
return;
- this.rules = [new(Ruleset)(selectors.slice(0), [this.rules[0]])];
+ this.rules = [new Ruleset(selectors.slice(0), [this.rules[0]])];
};
module.exports = Media;
diff --git a/lib/less/tree/mixin-call.js b/lib/less/tree/mixin-call.js
index b5e93b4..c4cf32d 100644
--- a/lib/less/tree/mixin-call.js
+++ b/lib/less/tree/mixin-call.js
@@ -4,7 +4,7 @@ var Node = require("./node"),
defaultFunc = require("../functions/default");
var MixinCall = function (elements, args, index, currentFileInfo, important) {
- this.selector = new(Selector)(elements);
+ this.selector = new Selector(elements);
this.arguments = (args && args.length) ? args : null;
this.index = index;
this.currentFileInfo = currentFileInfo;
diff --git a/lib/less/tree/mixin-definition.js b/lib/less/tree/mixin-definition.js
index 26dc699..41b74a1 100644
--- a/lib/less/tree/mixin-definition.js
+++ b/lib/less/tree/mixin-definition.js
@@ -7,7 +7,7 @@ var Selector = require("./selector"),
var Definition = function (name, params, rules, condition, variadic, frames) {
this.name = name;
- this.selectors = [new(Selector)([new(Element)(null, name, this.index, this.currentFileInfo)])];
+ this.selectors = [new Selector([new Element(null, name, this.index, this.currentFileInfo)])];
this.params = params;
this.condition = condition;
this.variadic = variadic;
@@ -34,7 +34,7 @@ Definition.prototype.accept = function (visitor) {
};
Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArguments) {
/*jshint boss:true */
- var frame = new(Ruleset)(null, null),
+ var frame = new Ruleset(null, null),
varargs, arg,
params = this.params.slice(0),
i, j, val, name, isNamedFound, argIndex, argsLength = 0;
@@ -52,7 +52,7 @@ Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArgume
for(j = 0; j < params.length; j++) {
if (!evaldArguments[j] && name === params[j].name) {
evaldArguments[j] = arg.value.eval(context);
- frame.prependRule(new(Rule)(name, arg.value.eval(context)));
+ frame.prependRule(new Rule(name, arg.value.eval(context)));
isNamedFound = true;
break;
}
@@ -80,7 +80,7 @@ Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArgume
for (j = argIndex; j < argsLength; j++) {
varargs.push(args[j].value.eval(context));
}
- frame.prependRule(new(Rule)(name, new(Expression)(varargs).eval(context)));
+ frame.prependRule(new Rule(name, new Expression(varargs).eval(context)));
} else {
val = arg && arg.value;
if (val) {
@@ -93,7 +93,7 @@ Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArgume
' (' + argsLength + ' for ' + this.arity + ')' };
}
- frame.prependRule(new(Rule)(name, val));
+ frame.prependRule(new Rule(name, val));
evaldArguments[i] = val;
}
}
@@ -117,11 +117,11 @@ Definition.prototype.evalCall = function (context, args, important) {
frame = this.evalParams(context, new contexts.Eval(context, mixinFrames), args, _arguments),
rules, ruleset;
- frame.prependRule(new(Rule)('@arguments', new Expression(_arguments).eval(context)));
+ frame.prependRule(new Rule('@arguments', new Expression(_arguments).eval(context)));
rules = this.rules.slice(0);
- ruleset = new(Ruleset)(null, rules);
+ ruleset = new Ruleset(null, rules);
ruleset.originalRuleset = this;
ruleset = ruleset.eval(new contexts.Eval(context, [this, frame].concat(mixinFrames)));
if (important) {
diff --git a/lib/less/tree/negative.js b/lib/less/tree/negative.js
index 30b1a98..228e8a6 100644
--- a/lib/less/tree/negative.js
+++ b/lib/less/tree/negative.js
@@ -13,8 +13,8 @@ Negative.prototype.genCSS = function (context, output) {
};
Negative.prototype.eval = function (context) {
if (context.isMathOn()) {
- return (new(Operation)('*', [new(Dimension)(-1), this.value])).eval(context);
+ return (new Operation('*', [new Dimension(-1), this.value])).eval(context);
}
- return new(Negative)(this.value.eval(context));
+ return new Negative(this.value.eval(context));
};
module.exports = Negative;
diff --git a/lib/less/tree/operation.js b/lib/less/tree/operation.js
index a95021a..ec40d3c 100644
--- a/lib/less/tree/operation.js
+++ b/lib/less/tree/operation.js
@@ -30,7 +30,7 @@ Operation.prototype.eval = function (context) {
return a.operate(context, this.op, b);
} else {
- return new(Operation)(this.op, [a, b], this.isSpaced);
+ return new Operation(this.op, [a, b], this.isSpaced);
}
};
Operation.prototype.genCSS = function (context, output) {
diff --git a/lib/less/tree/paren.js b/lib/less/tree/paren.js
index a6f7792..a02ae32 100644
--- a/lib/less/tree/paren.js
+++ b/lib/less/tree/paren.js
@@ -11,6 +11,6 @@ Paren.prototype.genCSS = function (context, output) {
output.add(')');
};
Paren.prototype.eval = function (context) {
- return new(Paren)(this.value.eval(context));
+ return new Paren(this.value.eval(context));
};
module.exports = Paren;
diff --git a/lib/less/tree/quoted.js b/lib/less/tree/quoted.js
index 6974ab6..c7d8305 100644
--- a/lib/less/tree/quoted.js
+++ b/lib/less/tree/quoted.js
@@ -26,7 +26,7 @@ Quoted.prototype.eval = function (context) {
return String(that.evaluateJavaScript(exp, context));
};
var interpolationReplacement = function (_, name) {
- var v = new(Variable)('@' + name, that.index, that.currentFileInfo).eval(context, true);
+ var v = new Variable('@' + name, that.index, that.currentFileInfo).eval(context, true);
return (v instanceof Quoted) ? v.value : v.toCSS();
};
function iterativeReplace(value, regexp, replacementFnc) {
@@ -39,7 +39,7 @@ Quoted.prototype.eval = function (context) {
}
value = iterativeReplace(value, /`([^`]+)`/g, javascriptReplacement);
value = iterativeReplace(value, /@\{([\w-]+)\}/g, interpolationReplacement);
- return new(Quoted)(this.quote + value + this.quote, value, this.escaped, this.index, this.currentFileInfo);
+ return new Quoted(this.quote + value + this.quote, value, this.escaped, this.index, this.currentFileInfo);
};
Quoted.prototype.compare = function (other) {
// when comparing quoted strings allow the quote to differ
diff --git a/lib/less/tree/rule.js b/lib/less/tree/rule.js
index f395c6a..402ebc5 100644
--- a/lib/less/tree/rule.js
+++ b/lib/less/tree/rule.js
@@ -4,7 +4,7 @@ var Node = require("./node"),
var Rule = function (name, value, important, merge, index, currentFileInfo, inline, variable) {
this.name = name;
- this.value = (value instanceof Node) ? value : new(Value)([value]); //value instanceof tree.Value || value instanceof tree.Ruleset ??
+ this.value = (value instanceof Node) ? value : new Value([value]); //value instanceof tree.Value || value instanceof tree.Ruleset ??
this.important = important ? ' ' + important.trim() : '';
this.merge = merge;
this.index = index;
@@ -59,7 +59,7 @@ Rule.prototype.eval = function (context) {
index: this.index, filename: this.currentFileInfo.filename };
}
- return new(Rule)(name,
+ return new Rule(name,
evaldValue,
this.important,
this.merge,
@@ -80,7 +80,7 @@ Rule.prototype.eval = function (context) {
}
};
Rule.prototype.makeImportant = function () {
- return new(Rule)(this.name,
+ return new Rule(this.name,
this.value,
"!important",
this.merge,
diff --git a/lib/less/tree/ruleset-call.js b/lib/less/tree/ruleset-call.js
index 3cb91c9..7a62c14 100644
--- a/lib/less/tree/ruleset-call.js
+++ b/lib/less/tree/ruleset-call.js
@@ -7,7 +7,7 @@ var RulesetCall = function (variable) {
RulesetCall.prototype = new Node();
RulesetCall.prototype.type = "RulesetCall";
RulesetCall.prototype.eval = function (context) {
- var detachedRuleset = new(Variable)(this.variable).eval(context);
+ var detachedRuleset = new Variable(this.variable).eval(context);
return detachedRuleset.callEval(context);
};
module.exports = RulesetCall;
diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js
index 23c3ec4..9895263 100644
--- a/lib/less/tree/ruleset.js
+++ b/lib/less/tree/ruleset.js
@@ -49,7 +49,7 @@ Ruleset.prototype.eval = function (context) {
}
var rules = this.rules ? this.rules.slice(0) : null,
- ruleset = new(Ruleset)(selectors, rules, this.strictImports),
+ ruleset = new Ruleset(selectors, rules, this.strictImports),
rule, subRule;
ruleset.originalRuleset = this;
@@ -259,7 +259,7 @@ Ruleset.prototype.find = function (selector, self, filter) {
if (match) {
if (selector.elements.length > match) {
if (!filter || filter(rule)) {
- foundMixins = rule.find(new(Selector)(selector.elements.slice(match)), self, filter);
+ foundMixins = rule.find(new Selector(selector.elements.slice(match)), self, filter);
for (var i = 0; i < foundMixins.length; ++i) {
foundMixins[i].path.push(rule);
}
@@ -485,7 +485,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) {
// it is not lost
if (sel.length > 0) {
sel[0].elements = sel[0].elements.slice(0);
- sel[0].elements.push(new(Element)(el.combinator, '', el.index, el.currentFileInfo));
+ sel[0].elements.push(new Element(el.combinator, '', el.index, el.currentFileInfo));
}
selectorsMultiplied.push(sel);
}
@@ -532,7 +532,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) {
combinator = parentEl.combinator;
}
// join the elements so far with the first part of the parent
- newJoinedSelector.elements.push(new(Element)(combinator, parentEl.value, el.index, el.currentFileInfo));
+ newJoinedSelector.elements.push(new Element(combinator, parentEl.value, el.index, el.currentFileInfo));
newJoinedSelector.elements = newJoinedSelector.elements.concat(parentSel[0].elements.slice(1));
}
@@ -572,7 +572,7 @@ Ruleset.prototype.mergeElementsOnToSelectors = function(elements, selectors) {
var i, sel;
if (selectors.length === 0) {
- selectors.push([ new(Selector)(elements) ]);
+ selectors.push([ new Selector(elements) ]);
return;
}
@@ -584,7 +584,7 @@ Ruleset.prototype.mergeElementsOnToSelectors = function(elements, selectors) {
sel[sel.length - 1] = sel[sel.length - 1].createDerived(sel[sel.length - 1].elements.concat(elements));
}
else {
- sel.push(new(Selector)(elements));
+ sel.push(new Selector(elements));
}
}
};
diff --git a/lib/less/tree/selector.js b/lib/less/tree/selector.js
index e2987b6..406130b 100644
--- a/lib/less/tree/selector.js
+++ b/lib/less/tree/selector.js
@@ -25,7 +25,7 @@ Selector.prototype.accept = function (visitor) {
};
Selector.prototype.createDerived = function(elements, extendList, evaldCondition) {
evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition;
- var newSelector = new(Selector)(elements, extendList || this.extendList, null, this.index, this.currentFileInfo, this.isReferenced);
+ var newSelector = new Selector(elements, extendList || this.extendList, null, this.index, this.currentFileInfo, this.isReferenced);
newSelector.evaldCondition = evaldCondition;
newSelector.mediaEmpty = this.mediaEmpty;
return newSelector;
diff --git a/lib/less/tree/value.js b/lib/less/tree/value.js
index ee31c83..38f2a23 100644
--- a/lib/less/tree/value.js
+++ b/lib/less/tree/value.js
@@ -17,7 +17,7 @@ Value.prototype.eval = function (context) {
if (this.value.length === 1) {
return this.value[0].eval(context);
} else {
- return new(Value)(this.value.map(function (v) {
+ return new Value(this.value.map(function (v) {
return v.eval(context);
}));
}
diff --git a/lib/less/tree/variable.js b/lib/less/tree/variable.js
index b50db18..b19dd21 100644
--- a/lib/less/tree/variable.js
+++ b/lib/less/tree/variable.js
@@ -11,7 +11,7 @@ Variable.prototype.eval = function (context) {
var variable, name = this.name;
if (name.indexOf('@@') === 0) {
- name = '@' + new(Variable)(name.slice(1), this.index, this.currentFileInfo).eval(context).value;
+ name = '@' + new Variable(name.slice(1), this.index, this.currentFileInfo).eval(context).value;
}
if (this.evaluating) {
diff --git a/lib/less/visitors/import-visitor.js b/lib/less/visitors/import-visitor.js
index d74ff0e..38b78fc 100644
--- a/lib/less/visitors/import-visitor.js
+++ b/lib/less/visitors/import-visitor.js
@@ -96,7 +96,7 @@ ImportVisitor.prototype = {
if (!inlineCSS && (context.importMultiple || !duplicateImport)) {
importVisitor.recursionDetector[fullPath] = true;
- new(ImportVisitor)(importVisitor._importer, subFinish, context, importVisitor.onceFileDetectionMap, importVisitor.recursionDetector)
+ new ImportVisitor(importVisitor._importer, subFinish, context, importVisitor.onceFileDetectionMap, importVisitor.recursionDetector)
.run(root);
return;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git
More information about the Pkg-javascript-commits
mailing list