[Pkg-javascript-commits] [less.js] 151/285: rename env to context to avoid confusion with environment

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:23:49 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 dedf0eee38e9095dff7d71a98a831d1e234869f3
Author: Luke Page <luke.a.page at gmail.com>
Date:   Sun Oct 5 18:50:34 2014 +0100

    rename env to context to avoid confusion with environment
---
 lib/less-browser/browser-import.js    |  2 +-
 lib/less-browser/index.js             |  4 +-
 lib/less/contexts.js                  | 21 ++++----
 lib/less/environment/api.js           |  2 +-
 lib/less/functions/data-uri.js        | 10 ++--
 lib/less/functions/function-caller.js |  4 +-
 lib/less/functions/number.js          |  2 +-
 lib/less/import-manager.js            | 32 ++++++------
 lib/less/parser/parser.js             | 20 ++++----
 lib/less/render.js                    | 10 ++--
 lib/less/source-map-output.js         |  4 +-
 lib/less/transform-tree.js            |  2 +-
 lib/less/tree/alpha.js                |  8 +--
 lib/less/tree/anonymous.js            |  2 +-
 lib/less/tree/assignment.js           |  8 +--
 lib/less/tree/attribute.js            | 16 +++---
 lib/less/tree/call.js                 | 10 ++--
 lib/less/tree/color.js                | 14 +++---
 lib/less/tree/combinator.js           |  4 +-
 lib/less/tree/comment.js              |  8 +--
 lib/less/tree/condition.js            |  4 +-
 lib/less/tree/debug-info.js           |  6 +--
 lib/less/tree/detached-ruleset.js     |  8 +--
 lib/less/tree/dimension.js            | 20 ++++----
 lib/less/tree/directive.js            | 30 +++++------
 lib/less/tree/element.js              | 22 ++++----
 lib/less/tree/expression.js           | 16 +++---
 lib/less/tree/extend.js               |  6 +--
 lib/less/tree/import.js               | 26 +++++-----
 lib/less/tree/javascript.js           |  4 +-
 lib/less/tree/js-eval-node.js         | 16 +++---
 lib/less/tree/keyword.js              |  2 +-
 lib/less/tree/media.js                | 52 +++++++++----------
 lib/less/tree/mixin-call.js           | 22 ++++----
 lib/less/tree/mixin-definition.js     | 42 ++++++++--------
 lib/less/tree/negative.js             | 12 ++---
 lib/less/tree/node.js                 | 12 ++---
 lib/less/tree/operation.js            | 16 +++---
 lib/less/tree/paren.js                |  8 +--
 lib/less/tree/quoted.js               |  8 +--
 lib/less/tree/rule.js                 | 24 ++++-----
 lib/less/tree/ruleset-call.js         |  6 +--
 lib/less/tree/ruleset.js              | 94 +++++++++++++++++------------------
 lib/less/tree/selector.js             | 18 +++----
 lib/less/tree/unit.js                 |  4 +-
 lib/less/tree/url.js                  | 16 +++---
 lib/less/tree/value.js                | 12 ++---
 lib/less/tree/variable.js             |  8 +--
 lib/less/visitors/import-visitor.js   | 30 +++++------
 lib/less/visitors/to-css-visitor.js   | 12 ++---
 50 files changed, 368 insertions(+), 371 deletions(-)

diff --git a/lib/less-browser/browser-import.js b/lib/less-browser/browser-import.js
index d2e49ae..8e4b4a0 100644
--- a/lib/less-browser/browser-import.js
+++ b/lib/less-browser/browser-import.js
@@ -89,7 +89,7 @@ BrowserImport.prototype.loadFile = function loadFile(filename, currentDirectory,
         options = options || {};
 
         // sheet may be set to the stylesheet for the initial load or a collection of properties including
-        // some env variables for imports
+        // some context variables for imports
         var hrefParts = this.extractUrlParts(filename, window.location.href);
         var href      = hrefParts.url;
 
diff --git a/lib/less-browser/index.js b/lib/less-browser/index.js
index 54e038c..2d48326 100644
--- a/lib/less-browser/index.js
+++ b/lib/less-browser/index.js
@@ -445,12 +445,12 @@ function initRunningMode(){
     if (less.env === 'development') {
         less.watchTimer = setInterval(function () {
             if (less.watchMode) {
-                loadStyleSheets(function (e, css, _, sheet, env) {
+                loadStyleSheets(function (e, css, _, sheet, context) {
                     if (e) {
                         error(e, e.href || sheet.href);
                     } else if (css) {
                         css = postProcessCSS(css);
-                        createCSS(css, sheet, env.lastModified);
+                        createCSS(css, sheet, context.lastModified);
                     }
                 });
             }
diff --git a/lib/less/contexts.js b/lib/less/contexts.js
index b486535..84da3e6 100644
--- a/lib/less/contexts.js
+++ b/lib/less/contexts.js
@@ -12,7 +12,7 @@ var copyFromOriginal = function copyFromOriginal(original, destination, properti
 };
 
 /*
- parseEnv is used whilst parsing
+ parse is used whilst parsing
  */
 var parseCopyProperties = [
     // options
@@ -33,7 +33,7 @@ var parseCopyProperties = [
     'reference'         // Used to indicate that the contents are imported by reference
 ];
 
-contexts.parseEnv = function(options) {
+contexts.Parse = function(options) {
     copyFromOriginal(options, this, parseCopyProperties);
 
     if (typeof this.paths === "string") { this.paths = [this.paths]; }
@@ -53,32 +53,32 @@ var evalCopyProperties = [
     'disableDataURIs' // option - disable data URIs (they will be converted to URL())
     ];
 
-contexts.evalEnv = function(options, frames) {
+contexts.Eval = function(options, frames) {
     copyFromOriginal(options, this, evalCopyProperties);
 
     this.frames = frames || [];
 };
 
-contexts.evalEnv.prototype.inParenthesis = function () {
+contexts.Eval.prototype.inParenthesis = function () {
     if (!this.parensStack) {
         this.parensStack = [];
     }
     this.parensStack.push(true);
 };
 
-contexts.evalEnv.prototype.outOfParenthesis = function () {
+contexts.Eval.prototype.outOfParenthesis = function () {
     this.parensStack.pop();
 };
 
-contexts.evalEnv.prototype.isMathOn = function () {
+contexts.Eval.prototype.isMathOn = function () {
     return this.strictMath ? (this.parensStack && this.parensStack.length) : true;
 };
 
-contexts.evalEnv.prototype.isPathRelative = function (path) {
+contexts.Eval.prototype.isPathRelative = function (path) {
     return !/^(?:[a-z-]+:|\/)/.test(path);
 };
 
-contexts.evalEnv.prototype.normalizePath = function( path ) {
+contexts.Eval.prototype.normalizePath = function( path ) {
     var
       segments = path.split("/").reverse(),
       segment;
@@ -105,8 +105,5 @@ contexts.evalEnv.prototype.normalizePath = function( path ) {
     return path.join("/");
 };
 
-//todo - do the same for the toCSS env
-//tree.toCSSEnv = function (options) {
-//};
-
+//todo - do the same for the toCSS ?
 
diff --git a/lib/less/environment/api.js b/lib/less/environment/api.js
index bd72a50..2ba3f6d 100644
--- a/lib/less/environment/api.js
+++ b/lib/less/environment/api.js
@@ -48,7 +48,7 @@ module.exports = {
       * Loads a file for an import aynscronously (or syncronously)
       * @param {String} filename - the filename
       * @param {String} currentDirectory - the current directory we are in
-      * @param {Object} options - the environment or options object
+      * @param {Object} options - the context/options object
       * @param {Function} callback - a function to callback when finished,
       *                   taking the format callback(error, contents, fullfilename, reserved)
       *                   where error is { type: {string}, message: {string} }, contents is {string} and fullfilename is {string}
diff --git a/lib/less/functions/data-uri.js b/lib/less/functions/data-uri.js
index 76d44c1..205dfb4 100644
--- a/lib/less/functions/data-uri.js
+++ b/lib/less/functions/data-uri.js
@@ -2,8 +2,8 @@ module.exports = function(environment) {
     var Anonymous = require("../tree/anonymous"),
         URL = require("../tree/url"),
         functionRegistry = require("./function-registry"),
-        fallback = function(functionContext, node) {
-            return new URL(node, functionContext.index, functionContext.currentFileInfo).eval(functionContext.env);
+        fallback = function(functionThis, node) {
+            return new URL(node, functionThis.index, functionThis.currentFileInfo).eval(functionThis.context);
         };
 
     functionRegistry.add("data-uri", function(mimetypeNode, filePathNode) {
@@ -11,7 +11,7 @@ module.exports = function(environment) {
         var mimetype = mimetypeNode.value;
         var filePath = (filePathNode && filePathNode.value);
 
-        var fileManager = environment.getFileManager(filePath, this.env.currentFileInfo, this.env, environment, true);
+        var fileManager = environment.getFileManager(filePath, this.context.currentFileInfo, this.context, environment, true);
 
         if (!fileManager) {
             return fallback(this, filePathNode || mimetypeNode);
@@ -47,7 +47,7 @@ module.exports = function(environment) {
             useBase64 = /;base64$/.test(mimetype);
         }
 
-        var fileSync = fileManager.loadFileSync(filePath, currentDirectory, this.env, environment);
+        var fileSync = fileManager.loadFileSync(filePath, currentDirectory, this.context, environment);
         if (!fileSync.contents) {
             environment.warn("Skipped data-uri embedding because file not found");
             return fallback(this, filePathNode || mimetypeNode);
@@ -60,7 +60,7 @@ module.exports = function(environment) {
             fileSizeInKB = parseInt((buf.length / 1024), 10);
         if (fileSizeInKB >= DATA_URI_MAX_KB) {
 
-            if (this.env.ieCompat !== false) {
+            if (this.context.ieCompat !== false) {
                 environment.warn("Skipped data-uri embedding of %s because its size (%dKB) exceeds IE8-safe %dKB!", filePath, fileSizeInKB, DATA_URI_MAX_KB);
 
                 return fallback(this, filePathNode || mimetypeNode);
diff --git a/lib/less/functions/function-caller.js b/lib/less/functions/function-caller.js
index 1e4f796..22e1e30 100644
--- a/lib/less/functions/function-caller.js
+++ b/lib/less/functions/function-caller.js
@@ -1,10 +1,10 @@
 var functionRegistry = require("./function-registry");
 
-var functionCaller = function(name, env, index, currentFileInfo) {
+var functionCaller = function(name, context, index, currentFileInfo) {
     this.name = name.toLowerCase();
     this.function = functionRegistry.get(this.name);
     this.index = index;
-    this.env = env;
+    this.context = context;
     this.currentFileInfo = currentFileInfo;
 };
 functionCaller.prototype.isValid = function() {
diff --git a/lib/less/functions/number.js b/lib/less/functions/number.js
index 38d12f5..c4fb3ae 100644
--- a/lib/less/functions/number.js
+++ b/lib/less/functions/number.js
@@ -41,7 +41,7 @@ var minMax = function (isMin, args) {
     if (order.length == 1) {
         return order[0];
     }
-    args = order.map(function (a) { return a.toCSS(this.env); }).join(this.env.compress ? "," : ", ");
+    args = order.map(function (a) { return a.toCSS(this.context); }).join(this.context.compress ? "," : ", ");
     return new(Anonymous)((isMin ? "min" : "max") + "(" + args + ")");
 };
 functionRegistry.addMultiple({
diff --git a/lib/less/import-manager.js b/lib/less/import-manager.js
index 00bedc3..ac550a9 100644
--- a/lib/less/import-manager.js
+++ b/lib/less/import-manager.js
@@ -12,49 +12,49 @@ module.exports = function(environment) {
     //  'entryPath' - absolute path to the entry file
     //  'reference' - whether the file should not be output and only output parts that are referenced
 
-    var ImportManager = function(env, rootFileInfo) {
+    var ImportManager = function(context, rootFileInfo) {
         this.rootFilename = rootFileInfo.filename;
-        this.paths = env.paths || [];  // Search paths, when importing
+        this.paths = context.paths || [];  // Search paths, when importing
         this.contents = {};             // map - filename to contents of all the files
         this.contentsIgnoredChars = {}; // map - filename to lines at the begining of each file to ignore
-        this.mime = env.mime;
+        this.mime = context.mime;
         this.error = null;
-        this.env = env;
+        this.context = context;
         // Deprecated? Unused outside of here, could be useful.
         this.queue = [];        // Files which haven't been imported yet
         this.files = [];        // Holds the imported parse trees.
     };
     ImportManager.prototype.push = function (path, currentFileInfo, importOptions, callback) {
-        var parserImports = this;
+        var importManager = this;
         this.queue.push(path);
 
         var fileParsedFunc = function (e, root, fullPath) {
-            parserImports.queue.splice(parserImports.queue.indexOf(path), 1); // Remove the path from the queue
+            importManager.queue.splice(importManager.queue.indexOf(path), 1); // Remove the path from the queue
 
-            var importedEqualsRoot = fullPath === parserImports.rootFilename;
+            var importedEqualsRoot = fullPath === importManager.rootFilename;
 
-            parserImports.files[fullPath] = root;
+            importManager.files[fullPath] = root;
 
-            if (e && !parserImports.error) { parserImports.error = e; }
+            if (e && !importManager.error) { importManager.error = e; }
 
             callback(e, root, importedEqualsRoot, fullPath);
         };
 
         var newFileInfo = {
-            relativeUrls: this.env.relativeUrls,
+            relativeUrls: this.context.relativeUrls,
             entryPath: currentFileInfo.entryPath,
             rootpath: currentFileInfo.rootpath,
             rootFilename: currentFileInfo.rootFilename
         };
 
-        var fileManager = environment.getFileManager(path, currentFileInfo.currentDirectory, this.env, environment);
+        var fileManager = environment.getFileManager(path, currentFileInfo.currentDirectory, this.context, environment);
 
         if (!fileManager) {
             fileParsedFunc({ message: "Could not find a file-manager for " + path });
             return;
         }
 
-        fileManager.loadFile(path, currentFileInfo.currentDirectory, this.env, environment)
+        fileManager.loadFile(path, currentFileInfo.currentDirectory, this.context, environment)
             .then(function loadFileCallback(loadedFile) {
                 var resolvedFilename = loadedFile.filename,
                     contents = loadedFile.contents;
@@ -69,17 +69,17 @@ module.exports = function(environment) {
                 //   then rootpath should become 'less/../'
                 newFileInfo.currentDirectory = fileManager.getPath(resolvedFilename);
                 if(newFileInfo.relativeUrls) {
-                    newFileInfo.rootpath = fileManager.join((parserImports.env.rootpath || ""), fileManager.pathDiff(newFileInfo.currentDirectory, newFileInfo.entryPath));
+                    newFileInfo.rootpath = fileManager.join((importManager.context.rootpath || ""), fileManager.pathDiff(newFileInfo.currentDirectory, newFileInfo.entryPath));
                     if (!fileManager.isPathAbsolute(newFileInfo.rootpath) && fileManager.alwaysMakePathsAbsolute()) {
                         newFileInfo.rootpath = fileManager.join(newFileInfo.entryPath, newFileInfo.rootpath);
                     }
                 }
                 newFileInfo.filename = resolvedFilename;
 
-                var newEnv = new contexts.parseEnv(parserImports.env);
+                var newEnv = new contexts.Parse(importManager.context);
 
                 newEnv.processImports = false;
-                parserImports.contents[resolvedFilename] = contents;
+                importManager.contents[resolvedFilename] = contents;
 
                 if (currentFileInfo.reference || importOptions.reference) {
                     newFileInfo.reference = true;
@@ -88,7 +88,7 @@ module.exports = function(environment) {
                 if (importOptions.inline) {
                     fileParsedFunc(null, contents, resolvedFilename);
                 } else {
-                    new Parser(newEnv, parserImports, newFileInfo).parse(contents, function (e, root) {
+                    new Parser(newEnv, importManager, newFileInfo).parse(contents, function (e, root) {
                         fileParsedFunc(e, root, resolvedFilename);
                     });
                 }
diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js
index 43a6ba1..b04392b 100644
--- a/lib/less/parser/parser.js
+++ b/lib/less/parser/parser.js
@@ -37,7 +37,7 @@ var LessError = require('../less-error'),
 //    It also takes care of moving all the indices forwards.
 //
 //
-var Parser = function Parser(env, imports, fileInfo) {
+var Parser = function Parser(context, imports, fileInfo) {
     var parsers,
         parserInput = getParserInput();
 
@@ -112,7 +112,7 @@ var Parser = function Parser(env, imports, fileInfo) {
             // with the `root` property set to true, so no `{}` are
             // output. The callback is called when the input is parsed.
             try {
-                parserInput.start(str, env.chunkInput, function fail(msg, index) {
+                parserInput.start(str, context.chunkInput, function fail(msg, index) {
                     throw new(LessError)({
                         index: index,
                         type: 'Parse',
@@ -175,7 +175,7 @@ var Parser = function Parser(env, imports, fileInfo) {
                 }
             };
 
-            if (env.processImports !== false) {
+            if (context.processImports !== false) {
                 new visitors.ImportVisitor(imports, finish)
                     .run(root);
             } else {
@@ -1000,7 +1000,7 @@ var Parser = function Parser(env, imports, fileInfo) {
 
                 parserInput.save();
 
-                if (env.dumpLineNumbers) {
+                if (context.dumpLineNumbers) {
                     debugInfo = getDebugInfo(parserInput.i);
                 }
 
@@ -1023,8 +1023,8 @@ var Parser = function Parser(env, imports, fileInfo) {
 
                 if (selectors && (rules = this.block())) {
                     parserInput.forget();
-                    var ruleset = new(tree.Ruleset)(selectors, rules, env.strictImports);
-                    if (env.dumpLineNumbers) {
+                    var ruleset = new(tree.Ruleset)(selectors, rules, context.strictImports);
+                    if (context.dumpLineNumbers) {
                         ruleset.debugInfo = debugInfo;
                     }
                     return ruleset;
@@ -1056,7 +1056,7 @@ var Parser = function Parser(env, imports, fileInfo) {
 
                         // prefer to try to parse first if its a variable or we are compressing
                         // but always fallback on the other one
-                        var tryValueFirst = !tryAnonymous && (env.compress || isVariable);
+                        var tryValueFirst = !tryAnonymous && (context.compress || isVariable);
 
                         if (tryValueFirst) {
                             value = this.value();
@@ -1221,7 +1221,7 @@ var Parser = function Parser(env, imports, fileInfo) {
             media: function () {
                 var features, rules, media, debugInfo;
 
-                if (env.dumpLineNumbers) {
+                if (context.dumpLineNumbers) {
                     debugInfo = getDebugInfo(parserInput.i);
                 }
 
@@ -1231,7 +1231,7 @@ var Parser = function Parser(env, imports, fileInfo) {
                     rules = this.block();
                     if (rules) {
                         media = new(tree.Media)(rules, features, parserInput.i, fileInfo);
-                        if (env.dumpLineNumbers) {
+                        if (context.dumpLineNumbers) {
                             media.debugInfo = debugInfo;
                         }
                         return media;
@@ -1334,7 +1334,7 @@ var Parser = function Parser(env, imports, fileInfo) {
                 if (rules || (!hasBlock && value && parserInput.$char(';'))) {
                     parserInput.forget();
                     return new(tree.Directive)(name, value, rules, index, fileInfo,
-                        env.dumpLineNumbers ? getDebugInfo(index) : null);
+                        context.dumpLineNumbers ? getDebugInfo(index) : null);
                 }
 
                 parserInput.restore("directive options not recognised");
diff --git a/lib/less/render.js b/lib/less/render.js
index 50d8899..6159df2 100644
--- a/lib/less/render.js
+++ b/lib/less/render.js
@@ -20,7 +20,7 @@ module.exports = function(environment, ParseTree, ImportManager) {
                     callback(error);
                 });
         } else {
-            var env = new contexts.parseEnv(options),
+            var context = new contexts.Parse(options),
                 rootFileInfo;
 
             if (options.rootFileInfo) {
@@ -30,16 +30,16 @@ module.exports = function(environment, ParseTree, ImportManager) {
                 var entryPath = filename.replace(/[^\/\\]*$/, "");
                 rootFileInfo = {
                     filename: filename,
-                    relativeUrls: env.relativeUrls,
-                    rootpath: env.rootpath || "",
+                    relativeUrls: context.relativeUrls,
+                    rootpath: context.rootpath || "",
                     currentDirectory: entryPath,
                     entryPath: entryPath,
                     rootFilename: filename
                 };
             }
 
-            var imports = new ImportManager(env, rootFileInfo);
-            var parser = new Parser(env, imports, rootFileInfo);
+            var imports = new ImportManager(context, rootFileInfo);
+            var parser = new Parser(context, imports, rootFileInfo);
 
             return new PromiseConstructor(function (resolve, reject) {
                 parser.parse(input, function (e, root) {
diff --git a/lib/less/source-map-output.js b/lib/less/source-map-output.js
index 5f4c9de..6c78a47 100644
--- a/lib/less/source-map-output.js
+++ b/lib/less/source-map-output.js
@@ -96,7 +96,7 @@ module.exports = function (environment) {
         return this._css.length === 0;
     };
 
-    SourceMapOutput.prototype.toCSS = function(env) {
+    SourceMapOutput.prototype.toCSS = function(context) {
         this._sourceMapGenerator = new this._sourceMapGeneratorConstructor({ file: this._outputFilename, sourceRoot: null });
 
         if (this._outputSourceFiles) {
@@ -112,7 +112,7 @@ module.exports = function (environment) {
             }
         }
 
-        this._rootNode.genCSS(env, this);
+        this._rootNode.genCSS(context, this);
 
         if (this._css.length > 0) {
             var sourceMapURL,
diff --git a/lib/less/transform-tree.js b/lib/less/transform-tree.js
index 7c88bb0..2a0c69f 100644
--- a/lib/less/transform-tree.js
+++ b/lib/less/transform-tree.js
@@ -6,7 +6,7 @@ module.exports = function(root, options) {
     options = options || {};
     var evaldRoot,
         variables = options.variables,
-        evalEnv = new contexts.evalEnv(options);
+        evalEnv = new contexts.Eval(options);
 
     //
     // Allows setting variables with a hash, so:
diff --git a/lib/less/tree/alpha.js b/lib/less/tree/alpha.js
index 9d4d5fa..82a4ce5 100644
--- a/lib/less/tree/alpha.js
+++ b/lib/less/tree/alpha.js
@@ -9,15 +9,15 @@ Alpha.prototype.type = "Alpha";
 Alpha.prototype.accept = function (visitor) {
     this.value = visitor.visit(this.value);
 };
-Alpha.prototype.eval = function (env) {
-    if (this.value.eval) { return new Alpha(this.value.eval(env)); }
+Alpha.prototype.eval = function (context) {
+    if (this.value.eval) { return new Alpha(this.value.eval(context)); }
     return this;
 };
-Alpha.prototype.genCSS = function (env, output) {
+Alpha.prototype.genCSS = function (context, output) {
     output.add("alpha(opacity=");
 
     if (this.value.genCSS) {
-        this.value.genCSS(env, output);
+        this.value.genCSS(context, output);
     } else {
         output.add(this.value);
     }
diff --git a/lib/less/tree/anonymous.js b/lib/less/tree/anonymous.js
index 0d81a3f..bf30c4a 100644
--- a/lib/less/tree/anonymous.js
+++ b/lib/less/tree/anonymous.js
@@ -18,7 +18,7 @@ Anonymous.prototype.compare = function (other) {
 Anonymous.prototype.isRulesetLike = function() {
     return this.rulesetLike;
 };
-Anonymous.prototype.genCSS = function (env, output) {
+Anonymous.prototype.genCSS = function (context, output) {
     output.add(this.value, this.currentFileInfo, this.index, this.mapLines);
 };
 module.exports = Anonymous;
diff --git a/lib/less/tree/assignment.js b/lib/less/tree/assignment.js
index c9492ce..d647b4e 100644
--- a/lib/less/tree/assignment.js
+++ b/lib/less/tree/assignment.js
@@ -10,16 +10,16 @@ Assignment.prototype.type = "Assignment";
 Assignment.prototype.accept = function (visitor) {
     this.value = visitor.visit(this.value);
 };
-Assignment.prototype.eval = function (env) {
+Assignment.prototype.eval = function (context) {
     if (this.value.eval) {
-        return new(Assignment)(this.key, this.value.eval(env));
+        return new(Assignment)(this.key, this.value.eval(context));
     }
     return this;
 };
-Assignment.prototype.genCSS = function (env, output) {
+Assignment.prototype.genCSS = function (context, output) {
     output.add(this.key + '=');
     if (this.value.genCSS) {
-        this.value.genCSS(env, output);
+        this.value.genCSS(context, output);
     } else {
         output.add(this.value);
     }
diff --git a/lib/less/tree/attribute.js b/lib/less/tree/attribute.js
index 67f336e..3596315 100644
--- a/lib/less/tree/attribute.js
+++ b/lib/less/tree/attribute.js
@@ -7,19 +7,19 @@ var Attribute = function (key, op, value) {
 };
 Attribute.prototype = new Node();
 Attribute.prototype.type = "Attribute";
-Attribute.prototype.eval = function (env) {
-    return new(Attribute)(this.key.eval ? this.key.eval(env) : this.key,
-        this.op, (this.value && this.value.eval) ? this.value.eval(env) : this.value);
+Attribute.prototype.eval = function (context) {
+    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 (env, output) {
-    output.add(this.toCSS(env));
+Attribute.prototype.genCSS = function (context, output) {
+    output.add(this.toCSS(context));
 };
-Attribute.prototype.toCSS = function (env) {
-    var value = this.key.toCSS ? this.key.toCSS(env) : this.key;
+Attribute.prototype.toCSS = function (context) {
+    var value = this.key.toCSS ? this.key.toCSS(context) : this.key;
 
     if (this.op) {
         value += this.op;
-        value += (this.value.toCSS ? this.value.toCSS(env) : this.value);
+        value += (this.value.toCSS ? this.value.toCSS(context) : this.value);
     }
 
     return '[' + value + ']';
diff --git a/lib/less/tree/call.js b/lib/less/tree/call.js
index ef7199b..34a4e0c 100644
--- a/lib/less/tree/call.js
+++ b/lib/less/tree/call.js
@@ -29,9 +29,9 @@ Call.prototype.accept = function (visitor) {
 // we try to pass a variable to a function, like: `saturate(@color)`.
 // The function should receive the value, not the variable.
 //
-Call.prototype.eval = function (env) {
-    var args = this.args.map(function (a) { return a.eval(env); }),
-        result, funcCaller = new FunctionCaller(this.name, env, this.index, this.currentFileInfo);
+Call.prototype.eval = function (context) {
+    var args = this.args.map(function (a) { return a.eval(context); }),
+        result, funcCaller = new FunctionCaller(this.name, context, this.index, this.currentFileInfo);
 
     if (funcCaller.isValid()) { // 1.
         try {
@@ -49,11 +49,11 @@ Call.prototype.eval = function (env) {
 
     return new Call(this.name, args, this.index, this.currentFileInfo);
 };
-Call.prototype.genCSS = function (env, output) {
+Call.prototype.genCSS = function (context, output) {
     output.add(this.name + "(", this.currentFileInfo, this.index);
 
     for(var i = 0; i < this.args.length; i++) {
-        this.args[i].genCSS(env, output);
+        this.args[i].genCSS(context, output);
         if (i + 1 < this.args.length) {
             output.add(", ");
         }
diff --git a/lib/less/tree/color.js b/lib/less/tree/color.js
index c51adf1..de903c5 100644
--- a/lib/less/tree/color.js
+++ b/lib/less/tree/color.js
@@ -50,11 +50,11 @@ Color.prototype.luma = function () {
 
     return 0.2126 * r + 0.7152 * g + 0.0722 * b;
 };
-Color.prototype.genCSS = function (env, output) {
-    output.add(this.toCSS(env));
+Color.prototype.genCSS = function (context, output) {
+    output.add(this.toCSS(context));
 };
-Color.prototype.toCSS = function (env, doNotCompress) {
-    var compress = env && env.compress && !doNotCompress, color, alpha;
+Color.prototype.toCSS = function (context, doNotCompress) {
+    var compress = context && context.compress && !doNotCompress, color, alpha;
 
     // `keyword` is set if this color was originally
     // converted from a named color string so we need
@@ -67,7 +67,7 @@ Color.prototype.toCSS = function (env, doNotCompress) {
     // is via `rgba`. Otherwise, we use the hex representation,
     // which has better compatibility with older browsers.
     // Values are capped between `0` and `255`, rounded and zero-padded.
-    alpha = this.fround(env, this.alpha);
+    alpha = this.fround(context, this.alpha);
     if (alpha < 1) {
         return "rgba(" + this.rgb.map(function (c) {
             return clamp(Math.round(c), 255);
@@ -95,11 +95,11 @@ Color.prototype.toCSS = function (env, doNotCompress) {
 // our result, in the form of an integer triplet,
 // we create a new Color node to hold the result.
 //
-Color.prototype.operate = function (env, op, other) {
+Color.prototype.operate = function (context, op, other) {
     var rgb = [];
     var alpha = this.alpha * (1 - other.alpha) + other.alpha;
     for (var c = 0; c < 3; c++) {
-        rgb[c] = this._operate(env, op, this.rgb[c], other.rgb[c]);
+        rgb[c] = this._operate(context, op, this.rgb[c], other.rgb[c]);
     }
     return new(Color)(rgb, alpha);
 };
diff --git a/lib/less/tree/combinator.js b/lib/less/tree/combinator.js
index 784933c..5342dc0 100644
--- a/lib/less/tree/combinator.js
+++ b/lib/less/tree/combinator.js
@@ -14,8 +14,8 @@ var _noSpaceCombinators = {
     ' ': true,
     '|': true
 };
-Combinator.prototype.genCSS = function (env, output) {
-    var spaceOrEmpty = (env.compress || _noSpaceCombinators[this.value]) ? '' : ' ';
+Combinator.prototype.genCSS = function (context, output) {
+    var spaceOrEmpty = (context.compress || _noSpaceCombinators[this.value]) ? '' : ' ';
     output.add(spaceOrEmpty + this.value + spaceOrEmpty);
 };
 module.exports = Combinator;
diff --git a/lib/less/tree/comment.js b/lib/less/tree/comment.js
index f098970..25842a5 100644
--- a/lib/less/tree/comment.js
+++ b/lib/less/tree/comment.js
@@ -8,15 +8,15 @@ var Comment = function (value, isLineComment, index, currentFileInfo) {
 };
 Comment.prototype = new Node();
 Comment.prototype.type = "Comment";
-Comment.prototype.genCSS = function (env, output) {
+Comment.prototype.genCSS = function (context, output) {
     if (this.debugInfo) {
-        output.add(getDebugInfo(env, this), this.currentFileInfo, this.index);
+        output.add(getDebugInfo(context, this), this.currentFileInfo, this.index);
     }
     output.add(this.value);
 };
-Comment.prototype.isSilent = function(env) {
+Comment.prototype.isSilent = function(context) {
     var isReference = (this.currentFileInfo && this.currentFileInfo.reference && !this.isReferenced),
-        isCompressed = env.compress && this.value[2] !== "!";
+        isCompressed = context.compress && this.value[2] !== "!";
     return this.isLineComment || isReference || isCompressed;
 };
 Comment.prototype.markReferenced = function () {
diff --git a/lib/less/tree/condition.js b/lib/less/tree/condition.js
index ee65e87..a451593 100644
--- a/lib/less/tree/condition.js
+++ b/lib/less/tree/condition.js
@@ -13,7 +13,7 @@ Condition.prototype.accept = function (visitor) {
     this.lvalue = visitor.visit(this.lvalue);
     this.rvalue = visitor.visit(this.rvalue);
 };
-Condition.prototype.eval = function (env) {
+Condition.prototype.eval = function (context) {
     var result = (function (op, a, b) {
         switch (op) {
             case 'and': return a && b;
@@ -26,7 +26,7 @@ Condition.prototype.eval = function (env) {
                         default: return false;
                 }
         }
-    }) (this.op, this.lvalue.eval(env), this.rvalue.eval(env));
+    }) (this.op, this.lvalue.eval(context), this.rvalue.eval(context));
 
     return this.negate ? !result : result;
 };
diff --git a/lib/less/tree/debug-info.js b/lib/less/tree/debug-info.js
index 5af873f..1603019 100644
--- a/lib/less/tree/debug-info.js
+++ b/lib/less/tree/debug-info.js
@@ -1,7 +1,7 @@
-var debugInfo = function(env, ctx, lineSeperator) {
+var debugInfo = function(context, ctx, lineSeperator) {
     var result="";
-    if (env.dumpLineNumbers && !env.compress) {
-        switch(env.dumpLineNumbers) {
+    if (context.dumpLineNumbers && !context.compress) {
+        switch(context.dumpLineNumbers) {
             case 'comments':
                 result = debugInfo.asComment(ctx);
                 break;
diff --git a/lib/less/tree/detached-ruleset.js b/lib/less/tree/detached-ruleset.js
index f0c81e7..01bbbc7 100644
--- a/lib/less/tree/detached-ruleset.js
+++ b/lib/less/tree/detached-ruleset.js
@@ -11,11 +11,11 @@ DetachedRuleset.prototype.evalFirst = true;
 DetachedRuleset.prototype.accept = function (visitor) {
     this.ruleset = visitor.visit(this.ruleset);
 };
-DetachedRuleset.prototype.eval = function (env) {
-    var frames = this.frames || env.frames.slice(0);
+DetachedRuleset.prototype.eval = function (context) {
+    var frames = this.frames || context.frames.slice(0);
     return new DetachedRuleset(this.ruleset, frames);
 };
-DetachedRuleset.prototype.callEval = function (env) {
-    return this.ruleset.eval(this.frames ? new(contexts.evalEnv)(env, this.frames.concat(env.frames)) : env);
+DetachedRuleset.prototype.callEval = function (context) {
+    return this.ruleset.eval(this.frames ? new contexts.Eval(context, this.frames.concat(context.frames)) : context);
 };
 module.exports = DetachedRuleset;
diff --git a/lib/less/tree/dimension.js b/lib/less/tree/dimension.js
index ce59f27..c5bf453 100644
--- a/lib/less/tree/dimension.js
+++ b/lib/less/tree/dimension.js
@@ -17,18 +17,18 @@ Dimension.prototype.type = "Dimension";
 Dimension.prototype.accept = function (visitor) {
     this.unit = visitor.visit(this.unit);
 };
-Dimension.prototype.eval = function (env) {
+Dimension.prototype.eval = function (context) {
     return this;
 };
 Dimension.prototype.toColor = function () {
     return new(Color)([this.value, this.value, this.value]);
 };
-Dimension.prototype.genCSS = function (env, output) {
-    if ((env && env.strictUnits) && !this.unit.isSingular()) {
+Dimension.prototype.genCSS = function (context, output) {
+    if ((context && context.strictUnits) && !this.unit.isSingular()) {
         throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: "+this.unit.toString());
     }
 
-    var value = this.fround(env, this.value),
+    var value = this.fround(context, this.value),
         strValue = String(value);
 
     if (value !== 0 && value < 0.000001 && value > -0.000001) {
@@ -36,7 +36,7 @@ Dimension.prototype.genCSS = function (env, output) {
         strValue = value.toFixed(20).replace(/0+$/, "");
     }
 
-    if (env && env.compress) {
+    if (context && context.compress) {
         // Zero values doesn't need a unit
         if (value === 0 && this.unit.isLength()) {
             output.add(strValue);
@@ -50,15 +50,15 @@ Dimension.prototype.genCSS = function (env, output) {
     }
 
     output.add(strValue);
-    this.unit.genCSS(env, output);
+    this.unit.genCSS(context, output);
 };
 
 // In an operation between two Dimensions,
 // we default to the first Dimension's unit,
 // so `1px + 2` will yield `3px`.
-Dimension.prototype.operate = function (env, op, other) {
+Dimension.prototype.operate = function (context, op, other) {
     /*jshint noempty:false */
-    var value = this._operate(env, op, this.value, other.value),
+    var value = this._operate(context, op, this.value, other.value),
         unit = this.unit.clone();
 
     if (op === '+' || op === '-') {
@@ -70,12 +70,12 @@ Dimension.prototype.operate = function (env, op, other) {
         } else {
             other = other.convertTo(this.unit.usedUnits());
 
-            if(env.strictUnits && other.unit.toString() !== unit.toString()) {
+            if(context.strictUnits && other.unit.toString() !== unit.toString()) {
               throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '" + unit.toString() +
                 "' and '" + other.unit.toString() + "'.");
             }
 
-            value = this._operate(env, op, this.value, other.value);
+            value = this._operate(context, op, this.value, other.value);
         }
     } else if (op === '*') {
         unit.numerator = unit.numerator.concat(other.unit.numerator).sort();
diff --git a/lib/less/tree/directive.js b/lib/less/tree/directive.js
index c69eee2..37c5cb1 100644
--- a/lib/less/tree/directive.js
+++ b/lib/less/tree/directive.js
@@ -30,26 +30,26 @@ Directive.prototype.isRulesetLike = function() {
 Directive.prototype.isCharset = function() {
     return "@charset" === this.name;
 };
-Directive.prototype.genCSS = function (env, output) {
+Directive.prototype.genCSS = function (context, output) {
     var value = this.value, rules = this.rules;
     output.add(this.name, this.currentFileInfo, this.index);
     if (value) {
         output.add(' ');
-        value.genCSS(env, output);
+        value.genCSS(context, output);
     }
     if (rules) {
-        this.outputRuleset(env, output, [rules]);
+        this.outputRuleset(context, output, [rules]);
     } else {
         output.add(';');
     }
 };
-Directive.prototype.eval = function (env) {
+Directive.prototype.eval = function (context) {
     var value = this.value, rules = this.rules;
     if (value) {
-        value = value.eval(env);
+        value = value.eval(context);
     }
     if (rules) {
-        rules = rules.eval(env);
+        rules = rules.eval(context);
         rules.root = true;
     }
     return new(Directive)(this.name, value, rules,
@@ -70,35 +70,35 @@ Directive.prototype.markReferenced = function () {
         }
     }
 };
-Directive.prototype.outputRuleset = function (env, output, rules) {
+Directive.prototype.outputRuleset = function (context, output, rules) {
     var ruleCnt = rules.length, i;
-    env.tabLevel = (env.tabLevel | 0) + 1;
+    context.tabLevel = (context.tabLevel | 0) + 1;
 
     // Compressed
-    if (env.compress) {
+    if (context.compress) {
         output.add('{');
         for (i = 0; i < ruleCnt; i++) {
-            rules[i].genCSS(env, output);
+            rules[i].genCSS(context, output);
         }
         output.add('}');
-        env.tabLevel--;
+        context.tabLevel--;
         return;
     }
 
     // Non-compressed
-    var tabSetStr = '\n' + Array(env.tabLevel).join("  "), tabRuleStr = tabSetStr + "  ";
+    var tabSetStr = '\n' + Array(context.tabLevel).join("  "), tabRuleStr = tabSetStr + "  ";
     if (!ruleCnt) {
         output.add(" {" + tabSetStr + '}');
     } else {
         output.add(" {" + tabRuleStr);
-        rules[0].genCSS(env, output);
+        rules[0].genCSS(context, output);
         for (i = 1; i < ruleCnt; i++) {
             output.add(tabRuleStr);
-            rules[i].genCSS(env, output);
+            rules[i].genCSS(context, output);
         }
         output.add(tabSetStr + '}');
     }
 
-    env.tabLevel--;
+    context.tabLevel--;
 };
 module.exports = Directive;
diff --git a/lib/less/tree/element.js b/lib/less/tree/element.js
index f62f656..df46b00 100644
--- a/lib/less/tree/element.js
+++ b/lib/less/tree/element.js
@@ -25,29 +25,29 @@ Element.prototype.accept = function (visitor) {
         this.value = visitor.visit(value);
     }
 };
-Element.prototype.eval = function (env) {
+Element.prototype.eval = function (context) {
     return new(Element)(this.combinator,
-                             this.value.eval ? this.value.eval(env) : this.value,
+                             this.value.eval ? this.value.eval(context) : this.value,
                              this.index,
                              this.currentFileInfo);
 };
-Element.prototype.genCSS = function (env, output) {
-    output.add(this.toCSS(env), this.currentFileInfo, this.index);
+Element.prototype.genCSS = function (context, output) {
+    output.add(this.toCSS(context), this.currentFileInfo, this.index);
 };
-Element.prototype.toCSS = function (env) {
-    env = env || {};
-    var value = this.value, firstSelector = env.firstSelector;
+Element.prototype.toCSS = function (context) {
+    context = context || {};
+    var value = this.value, firstSelector = context.firstSelector;
     if (value instanceof Paren) {
         // selector in parens should not be affected by outer selector
         // flags (breaks only interpolated selectors - see #1973)
-        env.firstSelector = true;
+        context.firstSelector = true;
     }
-    value = value.toCSS ? value.toCSS(env) : value;
-    env.firstSelector = firstSelector;
+    value = value.toCSS ? value.toCSS(context) : value;
+    context.firstSelector = firstSelector;
     if (value === '' && this.combinator.value.charAt(0) === '&') {
         return '';
     } else {
-        return this.combinator.toCSS(env) + value;
+        return this.combinator.toCSS(context) + value;
     }
 };
 module.exports = Element;
diff --git a/lib/less/tree/expression.js b/lib/less/tree/expression.js
index 2f25c7e..59e8a40 100644
--- a/lib/less/tree/expression.js
+++ b/lib/less/tree/expression.js
@@ -10,36 +10,36 @@ Expression.prototype.accept = function (visitor) {
         this.value = visitor.visitArray(this.value);
     }
 };
-Expression.prototype.eval = function (env) {
+Expression.prototype.eval = function (context) {
     var returnValue,
         inParenthesis = this.parens && !this.parensInOp,
         doubleParen = false;
     if (inParenthesis) {
-        env.inParenthesis();
+        context.inParenthesis();
     }
     if (this.value.length > 1) {
         returnValue = new(Expression)(this.value.map(function (e) {
-            return e.eval(env);
+            return e.eval(context);
         }));
     } else if (this.value.length === 1) {
         if (this.value[0].parens && !this.value[0].parensInOp) {
             doubleParen = true;
         }
-        returnValue = this.value[0].eval(env);
+        returnValue = this.value[0].eval(context);
     } else {
         returnValue = this;
     }
     if (inParenthesis) {
-        env.outOfParenthesis();
+        context.outOfParenthesis();
     }
-    if (this.parens && this.parensInOp && !(env.isMathOn()) && !doubleParen) {
+    if (this.parens && this.parensInOp && !(context.isMathOn()) && !doubleParen) {
         returnValue = new(Paren)(returnValue);
     }
     return returnValue;
 };
-Expression.prototype.genCSS = function (env, output) {
+Expression.prototype.genCSS = function (context, output) {
     for(var i = 0; i < this.value.length; i++) {
-        this.value[i].genCSS(env, output);
+        this.value[i].genCSS(context, output);
         if (i + 1 < this.value.length) {
             output.add(" ");
         }
diff --git a/lib/less/tree/extend.js b/lib/less/tree/extend.js
index caa7016..7758ea1 100644
--- a/lib/less/tree/extend.js
+++ b/lib/less/tree/extend.js
@@ -25,10 +25,10 @@ Extend.prototype.type = "Extend";
 Extend.prototype.accept = function (visitor) {
     this.selector = visitor.visit(this.selector);
 };
-Extend.prototype.eval = function (env) {
-    return new(Extend)(this.selector.eval(env), this.option, this.index);
+Extend.prototype.eval = function (context) {
+    return new(Extend)(this.selector.eval(context), this.option, this.index);
 };
-Extend.prototype.clone = function (env) {
+Extend.prototype.clone = function (context) {
     return new(Extend)(this.selector, this.option, this.index);
 };
 Extend.prototype.findSelfSelectors = function (selectors) {
diff --git a/lib/less/tree/import.js b/lib/less/tree/import.js
index 9171990..f1e5cae 100644
--- a/lib/less/tree/import.js
+++ b/lib/less/tree/import.js
@@ -54,13 +54,13 @@ Import.prototype.accept = function (visitor) {
         this.root = visitor.visit(this.root);
     }
 };
-Import.prototype.genCSS = function (env, output) {
+Import.prototype.genCSS = function (context, output) {
     if (this.css) {
         output.add("@import ", this.currentFileInfo, this.index);
-        this.path.genCSS(env, output);
+        this.path.genCSS(context, output);
         if (this.features) {
             output.add(" ");
-            this.features.genCSS(env, output);
+            this.features.genCSS(context, output);
         }
         output.add(';');
     }
@@ -74,32 +74,32 @@ Import.prototype.getPath = function () {
     }
     return null;
 };
-Import.prototype.evalForImport = function (env) {
+Import.prototype.evalForImport = function (context) {
     var path = this.path;
     if (path instanceof URL) {
         path = path.value;
     }
-    return new(Import)(path.eval(env), 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 (env) {
-    var path = this.path.eval(env);
+Import.prototype.evalPath = function (context) {
+    var path = this.path.eval(context);
     var rootpath = this.currentFileInfo && this.currentFileInfo.rootpath;
 
     if (!(path instanceof URL)) {
         if (rootpath) {
             var pathValue = path.value;
             // Add the base path if the import is relative
-            if (pathValue && env.isPathRelative(pathValue)) {
+            if (pathValue && context.isPathRelative(pathValue)) {
                 path.value = rootpath +pathValue;
             }
         }
-        path.value = env.normalizePath(path.value);
+        path.value = context.normalizePath(path.value);
     }
 
     return path;
 };
-Import.prototype.eval = function (env) {
-    var ruleset, features = this.features && this.features.eval(env);
+Import.prototype.eval = function (context) {
+    var ruleset, features = this.features && this.features.eval(context);
 
     if (this.skip) {
         if (typeof this.skip === "function") {
@@ -114,7 +114,7 @@ Import.prototype.eval = function (env) {
         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(env), 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;
         }
@@ -122,7 +122,7 @@ Import.prototype.eval = function (env) {
     } else {
         ruleset = new(Ruleset)(null, this.root.rules.slice(0));
 
-        ruleset.evalImports(env);
+        ruleset.evalImports(context);
 
         return this.features ? new(Media)(ruleset.rules, this.features.value) : ruleset.rules;
     }
diff --git a/lib/less/tree/javascript.js b/lib/less/tree/javascript.js
index 05913b8..b951bfa 100644
--- a/lib/less/tree/javascript.js
+++ b/lib/less/tree/javascript.js
@@ -11,8 +11,8 @@ var JavaScript = function (string, escaped, index, currentFileInfo) {
 };
 JavaScript.prototype = new JsEvalNode();
 JavaScript.prototype.type = "JavaScript";
-JavaScript.prototype.eval = function(env) {
-    var result = this.evaluateJavaScript(this.expression, env);
+JavaScript.prototype.eval = function(context) {
+    var result = this.evaluateJavaScript(this.expression, context);
 
     if (typeof(result) === 'number') {
         return new(Dimension)(result);
diff --git a/lib/less/tree/js-eval-node.js b/lib/less/tree/js-eval-node.js
index 2df63bb..c9f86c7 100644
--- a/lib/less/tree/js-eval-node.js
+++ b/lib/less/tree/js-eval-node.js
@@ -5,19 +5,19 @@ var JsEvalNode = function() {
 };
 JsEvalNode.prototype = new Node();
 
-JsEvalNode.prototype.evaluateJavaScript = function (expression, env) {
+JsEvalNode.prototype.evaluateJavaScript = function (expression, context) {
     var result,
         that = this,
-        context = {};
+        evalContext = {};
 
-    if (env.javascriptEnabled !== undefined && !env.javascriptEnabled) {
+    if (context.javascriptEnabled !== undefined && !context.javascriptEnabled) {
         throw { message: "You are using JavaScript, which has been disabled.",
             filename: this.currentFileInfo.filename,
             index: this.index };
     }
 
     expression = expression.replace(/@\{([\w-]+)\}/g, function (_, name) {
-        return that.jsify(new(Variable)('@' + name, that.index, that.currentFileInfo).eval(env));
+        return that.jsify(new(Variable)('@' + name, that.index, that.currentFileInfo).eval(context));
     });
 
     try {
@@ -28,21 +28,21 @@ JsEvalNode.prototype.evaluateJavaScript = function (expression, env) {
             index: this.index };
     }
 
-    var variables = env.frames[0].variables();
+    var variables = context.frames[0].variables();
     for (var k in variables) {
         if (variables.hasOwnProperty(k)) {
             /*jshint loopfunc:true */
-            context[k.slice(1)] = {
+            evalContext[k.slice(1)] = {
                 value: variables[k].value,
                 toJS: function () {
-                    return this.value.eval(env).toCSS();
+                    return this.value.eval(context).toCSS();
                 }
             };
         }
     }
 
     try {
-        result = expression.call(context);
+        result = expression.call(evalContext);
     } catch (e) {
         throw { message: "JavaScript evaluation error: '" + e.name + ': ' + e.message.replace(/["]/g, "'") + "'" ,
             filename: this.currentFileInfo.filename,
diff --git a/lib/less/tree/keyword.js b/lib/less/tree/keyword.js
index 80677a4..cbf3db4 100644
--- a/lib/less/tree/keyword.js
+++ b/lib/less/tree/keyword.js
@@ -3,7 +3,7 @@ var Node = require("./node");
 var Keyword = function (value) { this.value = value; };
 Keyword.prototype = new Node();
 Keyword.prototype.type = "Keyword";
-Keyword.prototype.genCSS = function (env, output) {
+Keyword.prototype.genCSS = function (context, output) {
     if (this.value === '%') { throw { type: "Syntax", message: "Invalid % without number" }; }
     output.add(this.value);
 };
diff --git a/lib/less/tree/media.js b/lib/less/tree/media.js
index 45d008d..8ec9927 100644
--- a/lib/less/tree/media.js
+++ b/lib/less/tree/media.js
@@ -27,15 +27,15 @@ Media.prototype.accept = function (visitor) {
         this.rules = visitor.visitArray(this.rules);
     }
 };
-Media.prototype.genCSS = function (env, output) {
+Media.prototype.genCSS = function (context, output) {
     output.add('@media ', this.currentFileInfo, this.index);
-    this.features.genCSS(env, output);
-    this.outputRuleset(env, output, this.rules);
+    this.features.genCSS(context, output);
+    this.outputRuleset(context, output, this.rules);
 };
-Media.prototype.eval = function (env) {
-    if (!env.mediaBlocks) {
-        env.mediaBlocks = [];
-        env.mediaPath = [];
+Media.prototype.eval = function (context) {
+    if (!context.mediaBlocks) {
+        context.mediaBlocks = [];
+        context.mediaPath = [];
     }
 
     var media = new(Media)(null, [], this.index, this.currentFileInfo);
@@ -44,30 +44,30 @@ Media.prototype.eval = function (env) {
         media.debugInfo = this.debugInfo;
     }
     var strictMathBypass = false;
-    if (!env.strictMath) {
+    if (!context.strictMath) {
         strictMathBypass = true;
-        env.strictMath = true;
+        context.strictMath = true;
     }
     try {
-        media.features = this.features.eval(env);
+        media.features = this.features.eval(context);
     }
     finally {
         if (strictMathBypass) {
-            env.strictMath = false;
+            context.strictMath = false;
         }
     }
 
-    env.mediaPath.push(media);
-    env.mediaBlocks.push(media);
+    context.mediaPath.push(media);
+    context.mediaBlocks.push(media);
 
-    env.frames.unshift(this.rules[0]);
-    media.rules = [this.rules[0].eval(env)];
-    env.frames.shift();
+    context.frames.unshift(this.rules[0]);
+    media.rules = [this.rules[0].eval(context)];
+    context.frames.shift();
 
-    env.mediaPath.pop();
+    context.mediaPath.pop();
 
-    return env.mediaPath.length === 0 ? media.evalTop(env) :
-                media.evalNested(env);
+    return context.mediaPath.length === 0 ? media.evalTop(context) :
+                media.evalNested(context);
 };
 //TODO merge with directive
 Media.prototype.variable = function (name) { return Ruleset.prototype.variable.call(this.rules[0], name); };
@@ -89,24 +89,24 @@ Media.prototype.markReferenced = function () {
         }
     }
 };
-Media.prototype.evalTop = function (env) {
+Media.prototype.evalTop = function (context) {
     var result = this;
 
     // Render all dependent Media blocks.
-    if (env.mediaBlocks.length > 1) {
+    if (context.mediaBlocks.length > 1) {
         var selectors = this.emptySelectors();
-        result = new(Ruleset)(selectors, env.mediaBlocks);
+        result = new(Ruleset)(selectors, context.mediaBlocks);
         result.multiMedia = true;
     }
 
-    delete env.mediaBlocks;
-    delete env.mediaPath;
+    delete context.mediaBlocks;
+    delete context.mediaPath;
 
     return result;
 };
-Media.prototype.evalNested = function (env) {
+Media.prototype.evalNested = function (context) {
     var i, value,
-        path = env.mediaPath.concat([this]);
+        path = context.mediaPath.concat([this]);
 
     // Extract the media-query conditions separated with `,` (OR).
     for (i = 0; i < path.length; i++) {
diff --git a/lib/less/tree/mixin-call.js b/lib/less/tree/mixin-call.js
index 7def79c..b5e93b4 100644
--- a/lib/less/tree/mixin-call.js
+++ b/lib/less/tree/mixin-call.js
@@ -20,7 +20,7 @@ MixinCall.prototype.accept = function (visitor) {
         this.arguments = visitor.visitArray(this.arguments);
     }
 };
-MixinCall.prototype.eval = function (env) {
+MixinCall.prototype.eval = function (context) {
     var mixins, mixin, mixinPath, args, rules = [], match = false, i, m, f, isRecursive, isOneFound, rule,
         candidates = [], candidate, conditionResult = [], defaultResult, defFalseEitherCase=-1,
         defNone = 0, defTrue = 1, defFalse = 2, count, originalRuleset, noArgumentsFilter;
@@ -34,11 +34,11 @@ MixinCall.prototype.eval = function (env) {
             for(p = 0; p < mixinPath.length && conditionResult[f]; p++) {
                 namespace = mixinPath[p];
                 if (namespace.matchCondition) {
-                    conditionResult[f] = conditionResult[f] && namespace.matchCondition(null, env);
+                    conditionResult[f] = conditionResult[f] && namespace.matchCondition(null, context);
                 }
             }
             if (mixin.matchCondition) {
-                conditionResult[f] = conditionResult[f] && mixin.matchCondition(args, env);
+                conditionResult[f] = conditionResult[f] && mixin.matchCondition(args, context);
             }
         }
         if (conditionResult[0] || conditionResult[1]) {
@@ -53,13 +53,13 @@ MixinCall.prototype.eval = function (env) {
     }
 
     args = this.arguments && this.arguments.map(function (a) {
-        return { name: a.name, value: a.value.eval(env) };
+        return { name: a.name, value: a.value.eval(context) };
     });
 
-    noArgumentsFilter = function(rule) {return rule.matchArgs(null, env);};
+    noArgumentsFilter = function(rule) {return rule.matchArgs(null, context);};
 
-    for (i = 0; i < env.frames.length; i++) {
-        if ((mixins = env.frames[i].find(this.selector, null, noArgumentsFilter)).length > 0) {
+    for (i = 0; i < context.frames.length; i++) {
+        if ((mixins = context.frames[i].find(this.selector, null, noArgumentsFilter)).length > 0) {
             isOneFound = true;
 
             // To make `default()` function independent of definition order we have two "subpasses" here.
@@ -71,8 +71,8 @@ MixinCall.prototype.eval = function (env) {
                 mixin = mixins[m].rule;
                 mixinPath = mixins[m].path;
                 isRecursive = false;
-                for(f = 0; f < env.frames.length; f++) {
-                    if ((!(mixin instanceof MixinDefinition)) && mixin === (env.frames[f].originalRuleset || env.frames[f])) {
+                for(f = 0; f < context.frames.length; f++) {
+                    if ((!(mixin instanceof MixinDefinition)) && mixin === (context.frames[f].originalRuleset || context.frames[f])) {
                         isRecursive = true;
                         break;
                     }
@@ -81,7 +81,7 @@ MixinCall.prototype.eval = function (env) {
                     continue;
                 }
 
-                if (mixin.matchArgs(args, env)) {
+                if (mixin.matchArgs(args, context)) {
                     candidate = {mixin: mixin, group: calcDefGroup(mixin, mixinPath)};
 
                     if (candidate.group!==defFalseEitherCase) {
@@ -122,7 +122,7 @@ MixinCall.prototype.eval = function (env) {
                             mixin.originalRuleset = originalRuleset;
                         }
                         Array.prototype.push.apply(
-                            rules, mixin.evalCall(env, args, this.important).rules);
+                            rules, mixin.evalCall(context, args, this.important).rules);
                     } catch (e) {
                         throw { message: e.message, index: this.index, filename: this.currentFileInfo.filename, stack: e.stack };
                     }
diff --git a/lib/less/tree/mixin-definition.js b/lib/less/tree/mixin-definition.js
index e7a8957..26dc699 100644
--- a/lib/less/tree/mixin-definition.js
+++ b/lib/less/tree/mixin-definition.js
@@ -32,14 +32,14 @@ Definition.prototype.accept = function (visitor) {
         this.condition = visitor.visit(this.condition);
     }
 };
-Definition.prototype.evalParams = function (env, mixinEnv, args, evaldArguments) {
+Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArguments) {
     /*jshint boss:true */
     var frame = new(Ruleset)(null, null),
         varargs, arg,
         params = this.params.slice(0),
         i, j, val, name, isNamedFound, argIndex, argsLength = 0;
 
-    mixinEnv = new contexts.evalEnv(mixinEnv, [frame].concat(mixinEnv.frames));
+    mixinEnv = new contexts.Eval(mixinEnv, [frame].concat(mixinEnv.frames));
 
     if (args) {
         args = args.slice(0);
@@ -51,8 +51,8 @@ Definition.prototype.evalParams = function (env, mixinEnv, args, evaldArguments)
                 isNamedFound = false;
                 for(j = 0; j < params.length; j++) {
                     if (!evaldArguments[j] && name === params[j].name) {
-                        evaldArguments[j] = arg.value.eval(env);
-                        frame.prependRule(new(Rule)(name, arg.value.eval(env)));
+                        evaldArguments[j] = arg.value.eval(context);
+                        frame.prependRule(new(Rule)(name, arg.value.eval(context)));
                         isNamedFound = true;
                         break;
                     }
@@ -78,13 +78,13 @@ Definition.prototype.evalParams = function (env, mixinEnv, args, evaldArguments)
             if (params[i].variadic) {
                 varargs = [];
                 for (j = argIndex; j < argsLength; j++) {
-                    varargs.push(args[j].value.eval(env));
+                    varargs.push(args[j].value.eval(context));
                 }
-                frame.prependRule(new(Rule)(name, new(Expression)(varargs).eval(env)));
+                frame.prependRule(new(Rule)(name, new(Expression)(varargs).eval(context)));
             } else {
                 val = arg && arg.value;
                 if (val) {
-                    val = val.eval(env);
+                    val = val.eval(context);
                 } else if (params[i].value) {
                     val = params[i].value.eval(mixinEnv);
                     frame.resetCache();
@@ -100,7 +100,7 @@ Definition.prototype.evalParams = function (env, mixinEnv, args, evaldArguments)
 
         if (params[i].variadic && args) {
             for (j = argIndex; j < argsLength; j++) {
-                evaldArguments[j] = args[j].value.eval(env);
+                evaldArguments[j] = args[j].value.eval(context);
             }
         }
         argIndex++;
@@ -108,38 +108,38 @@ Definition.prototype.evalParams = function (env, mixinEnv, args, evaldArguments)
 
     return frame;
 };
-Definition.prototype.eval = function (env) {
-    return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || env.frames.slice(0));
+Definition.prototype.eval = function (context) {
+    return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || context.frames.slice(0));
 };
-Definition.prototype.evalCall = function (env, args, important) {
+Definition.prototype.evalCall = function (context, args, important) {
     var _arguments = [],
-        mixinFrames = this.frames ? this.frames.concat(env.frames) : env.frames,
-        frame = this.evalParams(env, new(contexts.evalEnv)(env, mixinFrames), args, _arguments),
+        mixinFrames = this.frames ? this.frames.concat(context.frames) : context.frames,
+        frame = this.evalParams(context, new contexts.Eval(context, mixinFrames), args, _arguments),
         rules, ruleset;
 
-    frame.prependRule(new(Rule)('@arguments', new(Expression)(_arguments).eval(env)));
+    frame.prependRule(new(Rule)('@arguments', new Expression(_arguments).eval(context)));
 
     rules = this.rules.slice(0);
 
     ruleset = new(Ruleset)(null, rules);
     ruleset.originalRuleset = this;
-    ruleset = ruleset.eval(new(contexts.evalEnv)(env, [this, frame].concat(mixinFrames)));
+    ruleset = ruleset.eval(new contexts.Eval(context, [this, frame].concat(mixinFrames)));
     if (important) {
         ruleset = this.makeImportant.apply(ruleset);
     }
     return ruleset;
 };
-Definition.prototype.matchCondition = function (args, env) {
+Definition.prototype.matchCondition = function (args, context) {
     if (this.condition && !this.condition.eval(
-        new(contexts.evalEnv)(env,
-            [this.evalParams(env, new(contexts.evalEnv)(env, this.frames ? this.frames.concat(env.frames) : env.frames), args, [])] // the parameter variables
+        new contexts.Eval(context,
+            [this.evalParams(context, new contexts.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])] // the parameter variables
                 .concat(this.frames) // the parent namespace/mixin frames
-                .concat(env.frames)))) { // the current environment frames
+                .concat(context.frames)))) { // the current environment frames
         return false;
     }
     return true;
 };
-Definition.prototype.matchArgs = function (args, env) {
+Definition.prototype.matchArgs = function (args, context) {
     var argsLength = (args && args.length) || 0, len;
 
     if (! this.variadic) {
@@ -153,7 +153,7 @@ Definition.prototype.matchArgs = function (args, env) {
 
     for (var i = 0; i < len; i++) {
         if (!this.params[i].name && !this.params[i].variadic) {
-            if (args[i].value.eval(env).toCSS() != this.params[i].value.eval(env).toCSS()) {
+            if (args[i].value.eval(context).toCSS() != this.params[i].value.eval(context).toCSS()) {
                 return false;
             }
         }
diff --git a/lib/less/tree/negative.js b/lib/less/tree/negative.js
index 4232930..30b1a98 100644
--- a/lib/less/tree/negative.js
+++ b/lib/less/tree/negative.js
@@ -7,14 +7,14 @@ var Negative = function (node) {
 };
 Negative.prototype = new Node();
 Negative.prototype.type = "Negative";
-Negative.prototype.genCSS = function (env, output) {
+Negative.prototype.genCSS = function (context, output) {
     output.add('-');
-    this.value.genCSS(env, output);
+    this.value.genCSS(context, output);
 };
-Negative.prototype.eval = function (env) {
-    if (env.isMathOn()) {
-        return (new(Operation)('*', [new(Dimension)(-1), this.value])).eval(env);
+Negative.prototype.eval = function (context) {
+    if (context.isMathOn()) {
+        return (new(Operation)('*', [new(Dimension)(-1), this.value])).eval(context);
     }
-    return new(Negative)(this.value.eval(env));
+    return new(Negative)(this.value.eval(context));
 };
 module.exports = Negative;
diff --git a/lib/less/tree/node.js b/lib/less/tree/node.js
index dc14c65..cc2d646 100644
--- a/lib/less/tree/node.js
+++ b/lib/less/tree/node.js
@@ -1,8 +1,8 @@
 var Node = function() {
 };
-Node.prototype.toCSS = function (env) {
+Node.prototype.toCSS = function (context) {
     var strs = [];
-    this.genCSS(env, {
+    this.genCSS(context, {
         add: function(chunk, fileInfo, index) {
             strs.push(chunk);
         },
@@ -12,14 +12,14 @@ Node.prototype.toCSS = function (env) {
     });
     return strs.join('');
 };
-Node.prototype.genCSS = function (env, output) {
+Node.prototype.genCSS = function (context, output) {
     output.add(this.value);
 };
 Node.prototype.accept = function (visitor) {
     this.value = visitor.visit(this.value);
 };
 Node.prototype.eval = function () { return this; };
-Node.prototype._operate = function (env, op, a, b) {
+Node.prototype._operate = function (context, op, a, b) {
     switch (op) {
         case '+': return a + b;
         case '-': return a - b;
@@ -27,8 +27,8 @@ Node.prototype._operate = function (env, op, a, b) {
         case '/': return a / b;
     }
 };
-Node.prototype.fround = function(env, value) {
-    var precision = env && env.numPrecision;
+Node.prototype.fround = function(context, value) {
+    var precision = context && context.numPrecision;
     //add "epsilon" to ensure numbers like 1.000000005 (represented as 1.000000004999....) are properly rounded...
     return (precision == null) ? value : Number((value + 2e-16).toFixed(precision));
 };
diff --git a/lib/less/tree/operation.js b/lib/less/tree/operation.js
index a76dda9..a95021a 100644
--- a/lib/less/tree/operation.js
+++ b/lib/less/tree/operation.js
@@ -12,11 +12,11 @@ Operation.prototype.type = "Operation";
 Operation.prototype.accept = function (visitor) {
     this.operands = visitor.visit(this.operands);
 };
-Operation.prototype.eval = function (env) {
-    var a = this.operands[0].eval(env),
-        b = this.operands[1].eval(env);
+Operation.prototype.eval = function (context) {
+    var a = this.operands[0].eval(context),
+        b = this.operands[1].eval(context);
 
-    if (env.isMathOn()) {
+    if (context.isMathOn()) {
         if (a instanceof Dimension && b instanceof Color) {
             a = a.toColor();
         }
@@ -28,13 +28,13 @@ Operation.prototype.eval = function (env) {
                     message: "Operation on an invalid type" };
         }
 
-        return a.operate(env, this.op, b);
+        return a.operate(context, this.op, b);
     } else {
         return new(Operation)(this.op, [a, b], this.isSpaced);
     }
 };
-Operation.prototype.genCSS = function (env, output) {
-    this.operands[0].genCSS(env, output);
+Operation.prototype.genCSS = function (context, output) {
+    this.operands[0].genCSS(context, output);
     if (this.isSpaced) {
         output.add(" ");
     }
@@ -42,7 +42,7 @@ Operation.prototype.genCSS = function (env, output) {
     if (this.isSpaced) {
         output.add(" ");
     }
-    this.operands[1].genCSS(env, output);
+    this.operands[1].genCSS(context, output);
 };
 
 module.exports = Operation;
diff --git a/lib/less/tree/paren.js b/lib/less/tree/paren.js
index 54c71fb..a6f7792 100644
--- a/lib/less/tree/paren.js
+++ b/lib/less/tree/paren.js
@@ -5,12 +5,12 @@ var Paren = function (node) {
 };
 Paren.prototype = new Node();
 Paren.prototype.type = "Paren";
-Paren.prototype.genCSS = function (env, output) {
+Paren.prototype.genCSS = function (context, output) {
     output.add('(');
-    this.value.genCSS(env, output);
+    this.value.genCSS(context, output);
     output.add(')');
 };
-Paren.prototype.eval = function (env) {
-    return new(Paren)(this.value.eval(env));
+Paren.prototype.eval = function (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 11e646b..6974ab6 100644
--- a/lib/less/tree/quoted.js
+++ b/lib/less/tree/quoted.js
@@ -11,7 +11,7 @@ var Quoted = function (str, content, escaped, index, currentFileInfo) {
 };
 Quoted.prototype = new JsEvalNode();
 Quoted.prototype.type = "Quoted";
-Quoted.prototype.genCSS = function (env, output) {
+Quoted.prototype.genCSS = function (context, output) {
     if (!this.escaped) {
         output.add(this.quote, this.currentFileInfo, this.index);
     }
@@ -20,13 +20,13 @@ Quoted.prototype.genCSS = function (env, output) {
         output.add(this.quote);
     }
 };
-Quoted.prototype.eval = function (env) {
+Quoted.prototype.eval = function (context) {
     var that = this, value = this.value;
     var javascriptReplacement = function (_, exp) {
-        return String(that.evaluateJavaScript(exp, env));
+        return String(that.evaluateJavaScript(exp, context));
     };
     var interpolationReplacement = function (_, name) {
-        var v = new(Variable)('@' + name, that.index, that.currentFileInfo).eval(env, 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) {
diff --git a/lib/less/tree/rule.js b/lib/less/tree/rule.js
index fcc5329..f395c6a 100644
--- a/lib/less/tree/rule.js
+++ b/lib/less/tree/rule.js
@@ -14,45 +14,45 @@ var Rule = function (name, value, important, merge, index, currentFileInfo, inli
         : (name.charAt && (name.charAt(0) === '@'));
 };
 
-function evalName(env, name) {
+function evalName(context, name) {
     var value = "", i, n = name.length,
         output = {add: function (s) {value += s;}};
     for (i = 0; i < n; i++) {
-        name[i].eval(env).genCSS(env, output);
+        name[i].eval(context).genCSS(context, output);
     }
     return value;
 }
 
 Rule.prototype = new Node();
 Rule.prototype.type = "Rule";
-Rule.prototype.genCSS = function (env, output) {
-    output.add(this.name + (env.compress ? ':' : ': '), this.currentFileInfo, this.index);
+Rule.prototype.genCSS = function (context, output) {
+    output.add(this.name + (context.compress ? ':' : ': '), this.currentFileInfo, this.index);
     try {
-        this.value.genCSS(env, output);
+        this.value.genCSS(context, output);
     }
     catch(e) {
         e.index = this.index;
         e.filename = this.currentFileInfo.filename;
         throw e;
     }
-    output.add(this.important + ((this.inline || (env.lastRule && env.compress)) ? "" : ";"), this.currentFileInfo, this.index);
+    output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? "" : ";"), this.currentFileInfo, this.index);
 };
-Rule.prototype.eval = function (env) {
+Rule.prototype.eval = function (context) {
     var strictMathBypass = false, name = this.name, evaldValue, variable = this.variable;
     if (typeof name !== "string") {
         // expand 'primitive' name directly to get
         // things faster (~10% for benchmark.less):
         name = (name.length === 1)
             && (name[0] instanceof Keyword)
-                ? name[0].value : evalName(env, name);
+                ? name[0].value : evalName(context, name);
             variable = false; // never treat expanded interpolation as new variable name
     }
-    if (name === "font" && !env.strictMath) {
+    if (name === "font" && !context.strictMath) {
         strictMathBypass = true;
-        env.strictMath = true;
+        context.strictMath = true;
     }
     try {
-        evaldValue = this.value.eval(env);
+        evaldValue = this.value.eval(context);
 
         if (!this.variable && evaldValue.type === "DetachedRuleset") {
             throw { message: "Rulesets cannot be evaluated on a property.",
@@ -75,7 +75,7 @@ Rule.prototype.eval = function (env) {
     }
     finally {
         if (strictMathBypass) {
-            env.strictMath = false;
+            context.strictMath = false;
         }
     }
 };
diff --git a/lib/less/tree/ruleset-call.js b/lib/less/tree/ruleset-call.js
index 3a2e77a..3cb91c9 100644
--- a/lib/less/tree/ruleset-call.js
+++ b/lib/less/tree/ruleset-call.js
@@ -6,8 +6,8 @@ var RulesetCall = function (variable) {
 };
 RulesetCall.prototype = new Node();
 RulesetCall.prototype.type = "RulesetCall";
-RulesetCall.prototype.eval = function (env) {
-    var detachedRuleset = new(Variable)(this.variable).eval(env);
-    return detachedRuleset.callEval(env);
+RulesetCall.prototype.eval = function (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 0760595..74e8fd3 100644
--- a/lib/less/tree/ruleset.js
+++ b/lib/less/tree/ruleset.js
@@ -26,7 +26,7 @@ Ruleset.prototype.accept = function (visitor) {
         this.rules = visitor.visitArray(this.rules);
     }
 };
-Ruleset.prototype.eval = function (env) {
+Ruleset.prototype.eval = function (context) {
     var thisSelectors = this.selectors, selectors,
         selCnt, selector, i, hasOnePassingSelector = false;
 
@@ -37,7 +37,7 @@ Ruleset.prototype.eval = function (env) {
             message: "it is currently only allowed in parametric mixin guards,"
         });
         for (i = 0; i < selCnt; i++) {
-            selector = thisSelectors[i].eval(env);
+            selector = thisSelectors[i].eval(context);
             selectors.push(selector);
             if (selector.evaldCondition) {
                 hasOnePassingSelector = true;
@@ -66,19 +66,19 @@ Ruleset.prototype.eval = function (env) {
     }
 
     // push the current ruleset to the frames stack
-    var envFrames = env.frames;
-    envFrames.unshift(ruleset);
+    var ctxFrames = context.frames;
+    ctxFrames.unshift(ruleset);
 
     // currrent selectors
-    var envSelectors = env.selectors;
-    if (!envSelectors) {
-        env.selectors = envSelectors = [];
+    var ctxSelectors = context.selectors;
+    if (!ctxSelectors) {
+        context.selectors = ctxSelectors = [];
     }
-    envSelectors.unshift(this.selectors);
+    ctxSelectors.unshift(this.selectors);
 
     // Evaluate imports
     if (ruleset.root || ruleset.allowImports || !ruleset.strictImports) {
-        ruleset.evalImports(env);
+        ruleset.evalImports(context);
     }
 
     // Store the frames around mixin definitions,
@@ -86,17 +86,17 @@ Ruleset.prototype.eval = function (env) {
     var rsRules = ruleset.rules, rsRuleCnt = rsRules ? rsRules.length : 0;
     for (i = 0; i < rsRuleCnt; i++) {
         if (rsRules[i].evalFirst) {
-            rsRules[i] = rsRules[i].eval(env);
+            rsRules[i] = rsRules[i].eval(context);
         }
     }
 
-    var mediaBlockCount = (env.mediaBlocks && env.mediaBlocks.length) || 0;
+    var mediaBlockCount = (context.mediaBlocks && context.mediaBlocks.length) || 0;
 
     // Evaluate mixin calls.
     for (i = 0; i < rsRuleCnt; i++) {
         if (rsRules[i].type === "MixinCall") {
             /*jshint loopfunc:true */
-            rules = rsRules[i].eval(env).filter(function(r) {
+            rules = rsRules[i].eval(context).filter(function(r) {
                 if ((r instanceof Rule) && r.variable) {
                     // do not pollute the scope if the variable is
                     // already there. consider returning false here
@@ -111,7 +111,7 @@ Ruleset.prototype.eval = function (env) {
             ruleset.resetCache();
         } else if (rsRules[i].type === "RulesetCall") {
             /*jshint loopfunc:true */
-            rules = rsRules[i].eval(env).rules.filter(function(r) {
+            rules = rsRules[i].eval(context).rules.filter(function(r) {
                 if ((r instanceof Rule) && r.variable) {
                     // do not pollute the scope at all
                     return false;
@@ -129,7 +129,7 @@ Ruleset.prototype.eval = function (env) {
     for (i = 0; i < rsRules.length; i++) {
         rule = rsRules[i];
         if (!rule.evalFirst) {
-            rsRules[i] = rule = rule.eval ? rule.eval(env) : rule;
+            rsRules[i] = rule = rule.eval ? rule.eval(context) : rule;
         }
     }
 
@@ -153,24 +153,24 @@ Ruleset.prototype.eval = function (env) {
     }
 
     // Pop the stack
-    envFrames.shift();
-    envSelectors.shift();
+    ctxFrames.shift();
+    ctxSelectors.shift();
 
-    if (env.mediaBlocks) {
-        for (i = mediaBlockCount; i < env.mediaBlocks.length; i++) {
-            env.mediaBlocks[i].bubbleSelectors(selectors);
+    if (context.mediaBlocks) {
+        for (i = mediaBlockCount; i < context.mediaBlocks.length; i++) {
+            context.mediaBlocks[i].bubbleSelectors(selectors);
         }
     }
 
     return ruleset;
 };
-Ruleset.prototype.evalImports = function(env) {
+Ruleset.prototype.evalImports = function(context) {
     var rules = this.rules, i, importRules;
     if (!rules) { return; }
 
     for (i = 0; i < rules.length; i++) {
         if (rules[i].type === "Import") {
-            importRules = rules[i].eval(env);
+            importRules = rules[i].eval(context);
             if (importRules && importRules.length) {
                 rules.splice.apply(rules, [i, 1].concat(importRules));
                 i+= importRules.length-1;
@@ -194,15 +194,15 @@ Ruleset.prototype.matchArgs = function (args) {
     return !args || args.length === 0;
 };
 // lets you call a css selector with a guard
-Ruleset.prototype.matchCondition = function (args, env) {
+Ruleset.prototype.matchCondition = function (args, context) {
     var lastSelector = this.selectors[this.selectors.length-1];
     if (!lastSelector.evaldCondition) {
         return false;
     }
     if (lastSelector.condition &&
         !lastSelector.condition.eval(
-            new(contexts.evalEnv)(env,
-                env.frames))) {
+            new contexts.Eval(context,
+                context.frames))) {
         return false;
     }
     return true;
@@ -276,7 +276,7 @@ Ruleset.prototype.find = function (selector, self, filter) {
     this._lookups[key] = rules;
     return rules;
 };
-Ruleset.prototype.genCSS = function (env, output) {
+Ruleset.prototype.genCSS = function (context, output) {
     var i, j,
         charsetRuleNodes = [],
         ruleNodes = [],
@@ -286,14 +286,14 @@ Ruleset.prototype.genCSS = function (env, output) {
         rule,
         path;
 
-    env.tabLevel = (env.tabLevel || 0);
+    context.tabLevel = (context.tabLevel || 0);
 
     if (!this.root) {
-        env.tabLevel++;
+        context.tabLevel++;
     }
 
-    var tabRuleStr = env.compress ? '' : Array(env.tabLevel + 1).join("  "),
-        tabSetStr = env.compress ? '' : Array(env.tabLevel).join("  "),
+    var tabRuleStr = context.compress ? '' : Array(context.tabLevel + 1).join("  "),
+        tabSetStr = context.compress ? '' : Array(context.tabLevel).join("  "),
         sep;
 
     function isRulesetLikeNode(rule, root) {
@@ -330,7 +330,7 @@ Ruleset.prototype.genCSS = function (env, output) {
     // If this is the root node, we don't render
     // a selector, or {}.
     if (!this.root) {
-        debugInfo = getDebugInfo(env, this, tabSetStr);
+        debugInfo = getDebugInfo(context, this, tabSetStr);
 
         if (debugInfo) {
             output.add(debugInfo);
@@ -340,23 +340,23 @@ Ruleset.prototype.genCSS = function (env, output) {
         var paths = this.paths, pathCnt = paths.length,
             pathSubCnt;
 
-        sep = env.compress ? ',' : (',\n' + tabSetStr);
+        sep = context.compress ? ',' : (',\n' + tabSetStr);
 
         for (i = 0; i < pathCnt; i++) {
             path = paths[i];
             if (!(pathSubCnt = path.length)) { continue; }
             if (i > 0) { output.add(sep); }
 
-            env.firstSelector = true;
-            path[0].genCSS(env, output);
+            context.firstSelector = true;
+            path[0].genCSS(context, output);
 
-            env.firstSelector = false;
+            context.firstSelector = false;
             for (j = 1; j < pathSubCnt; j++) {
-                path[j].genCSS(env, output);
+                path[j].genCSS(context, output);
             }
         }
 
-        output.add((env.compress ? '{' : ' {\n') + tabRuleStr);
+        output.add((context.compress ? '{' : ' {\n') + tabRuleStr);
     }
 
     // Compile rules and rulesets
@@ -366,39 +366,39 @@ Ruleset.prototype.genCSS = function (env, output) {
         // @page{ directive ends up with root elements inside it, a mix of rules and rulesets
         // In this instance we do not know whether it is the last property
         if (i + 1 === ruleNodes.length && (!this.root || rulesetNodes.length === 0 || this.firstRoot)) {
-            env.lastRule = true;
+            context.lastRule = true;
         }
 
         if (rule.genCSS) {
-            rule.genCSS(env, output);
+            rule.genCSS(context, output);
         } else if (rule.value) {
             output.add(rule.value.toString());
         }
 
-        if (!env.lastRule) {
-            output.add(env.compress ? '' : ('\n' + tabRuleStr));
+        if (!context.lastRule) {
+            output.add(context.compress ? '' : ('\n' + tabRuleStr));
         } else {
-            env.lastRule = false;
+            context.lastRule = false;
         }
     }
 
     if (!this.root) {
-        output.add((env.compress ? '}' : '\n' + tabSetStr + '}'));
-        env.tabLevel--;
+        output.add((context.compress ? '}' : '\n' + tabSetStr + '}'));
+        context.tabLevel--;
     }
 
-    sep = (env.compress ? "" : "\n") + (this.root ? tabRuleStr : tabSetStr);
+    sep = (context.compress ? "" : "\n") + (this.root ? tabRuleStr : tabSetStr);
     rulesetNodeCnt = rulesetNodes.length;
     if (rulesetNodeCnt) {
         if (ruleNodes.length && sep) { output.add(sep); }
-        rulesetNodes[0].genCSS(env, output);
+        rulesetNodes[0].genCSS(context, output);
         for (i = 1; i < rulesetNodeCnt; i++) {
             if (sep) { output.add(sep); }
-            rulesetNodes[i].genCSS(env, output);
+            rulesetNodes[i].genCSS(context, output);
         }
     }
 
-    if (!output.isEmpty() && !env.compress && this.firstRoot) {
+    if (!output.isEmpty() && !context.compress && this.firstRoot) {
         output.add('\n');
     }
 };
diff --git a/lib/less/tree/selector.js b/lib/less/tree/selector.js
index 993d237..e2987b6 100644
--- a/lib/less/tree/selector.js
+++ b/lib/less/tree/selector.js
@@ -53,7 +53,7 @@ Selector.prototype.match = function (other) {
 Selector.prototype.CacheElements = function() {
     if (this._elements)
         return;
-        
+
     var elements = this.elements.map( function(v) {
         return v.combinator.value + (v.value.value || v.value);
     }).join("").match(/[,&#\*\.\w-]([\w-]|(\\.))*/g);
@@ -65,7 +65,7 @@ Selector.prototype.CacheElements = function() {
     } else {
         elements = [];
     }
-    
+
     this._elements = elements;
 };
 Selector.prototype.isJustParentSelector = function() {
@@ -74,25 +74,25 @@ Selector.prototype.isJustParentSelector = function() {
         this.elements[0].value === '&' &&
         (this.elements[0].combinator.value === ' ' || this.elements[0].combinator.value === '');
 };
-Selector.prototype.eval = function (env) {
-    var evaldCondition = this.condition && this.condition.eval(env),
+Selector.prototype.eval = function (context) {
+    var evaldCondition = this.condition && this.condition.eval(context),
         elements = this.elements, extendList = this.extendList;
 
-    elements = elements && elements.map(function (e) { return e.eval(env); });
-    extendList = extendList && extendList.map(function(extend) { return extend.eval(env); });
+    elements = elements && elements.map(function (e) { return e.eval(context); });
+    extendList = extendList && extendList.map(function(extend) { return extend.eval(context); });
 
     return this.createDerived(elements, extendList, evaldCondition);
 };
-Selector.prototype.genCSS = function (env, output) {
+Selector.prototype.genCSS = function (context, output) {
     var i, element;
-    if ((!env || !env.firstSelector) && this.elements[0].combinator.value === "") {
+    if ((!context || !context.firstSelector) && this.elements[0].combinator.value === "") {
         output.add(' ', this.currentFileInfo, this.index);
     }
     if (!this._css) {
         //TODO caching? speed comparison?
         for(i = 0; i < this.elements.length; i++) {
             element = this.elements[i];
-            element.genCSS(env, output);
+            element.genCSS(context, output);
         }
     }
 };
diff --git a/lib/less/tree/unit.js b/lib/less/tree/unit.js
index d9a7459..2a33bc4 100644
--- a/lib/less/tree/unit.js
+++ b/lib/less/tree/unit.js
@@ -12,14 +12,14 @@ Unit.prototype.type = "Unit";
 Unit.prototype.clone = function () {
     return new Unit(this.numerator.slice(0), this.denominator.slice(0), this.backupUnit);
 };
-Unit.prototype.genCSS = function (env, output) {
+Unit.prototype.genCSS = function (context, output) {
     if (this.numerator.length >= 1) {
         output.add(this.numerator[0]);
     } else
     if (this.denominator.length >= 1) {
         output.add(this.denominator[0]);
     } else
-    if ((!env || !env.strictUnits) && this.backupUnit) {
+    if ((!context || !context.strictUnits) && this.backupUnit) {
         output.add(this.backupUnit);
     }
 };
diff --git a/lib/less/tree/url.js b/lib/less/tree/url.js
index b528fff..0c87d02 100644
--- a/lib/less/tree/url.js
+++ b/lib/less/tree/url.js
@@ -11,32 +11,32 @@ URL.prototype.type = "Url";
 URL.prototype.accept = function (visitor) {
     this.value = visitor.visit(this.value);
 };
-URL.prototype.genCSS = function (env, output) {
+URL.prototype.genCSS = function (context, output) {
     output.add("url(");
-    this.value.genCSS(env, output);
+    this.value.genCSS(context, output);
     output.add(")");
 };
-URL.prototype.eval = function (ctx) {
-    var val = this.value.eval(ctx),
+URL.prototype.eval = function (context) {
+    var val = this.value.eval(context),
         rootpath;
 
     if (!this.isEvald) {
         // Add the base path if the URL is relative
         rootpath = this.currentFileInfo && this.currentFileInfo.rootpath;
-        if (rootpath && typeof val.value === "string" && ctx.isPathRelative(val.value)) {
+        if (rootpath && typeof val.value === "string" && context.isPathRelative(val.value)) {
             if (!val.quote) {
                 rootpath = rootpath.replace(/[\(\)'"\s]/g, function(match) { return "\\"+match; });
             }
             val.value = rootpath + val.value;
         }
 
-        val.value = ctx.normalizePath(val.value);
+        val.value = context.normalizePath(val.value);
 
         // Add url args if enabled
-        if (ctx.urlArgs) {
+        if (context.urlArgs) {
             if (!val.value.match(/^\s*data:/)) {
                 var delimiter = val.value.indexOf('?') === -1 ? '?' : '&';
-                var urlArgs = delimiter + ctx.urlArgs;
+                var urlArgs = delimiter + context.urlArgs;
                 if (val.value.indexOf('#') !== -1) {
                     val.value = val.value.replace('#', urlArgs + '#');
                 } else {
diff --git a/lib/less/tree/value.js b/lib/less/tree/value.js
index b550edd..ebdff00 100644
--- a/lib/less/tree/value.js
+++ b/lib/less/tree/value.js
@@ -10,21 +10,21 @@ Value.prototype.accept = function (visitor) {
         this.value = visitor.visitArray(this.value);
     }
 };
-Value.prototype.eval = function (env) {
+Value.prototype.eval = function (context) {
     if (this.value.length === 1) {
-        return this.value[0].eval(env);
+        return this.value[0].eval(context);
     } else {
         return new(Value)(this.value.map(function (v) {
-            return v.eval(env);
+            return v.eval(context);
         }));
     }
 };
-Value.prototype.genCSS = function (env, output) {
+Value.prototype.genCSS = function (context, output) {
     var i;
     for(i = 0; i < this.value.length; i++) {
-        this.value[i].genCSS(env, output);
+        this.value[i].genCSS(context, output);
         if (i+1 < this.value.length) {
-            output.add((env && env.compress) ? ',' : ', ');
+            output.add((context && context.compress) ? ',' : ', ');
         }
     }
 };
diff --git a/lib/less/tree/variable.js b/lib/less/tree/variable.js
index 87428af..b50db18 100644
--- a/lib/less/tree/variable.js
+++ b/lib/less/tree/variable.js
@@ -7,11 +7,11 @@ var Variable = function (name, index, currentFileInfo) {
 };
 Variable.prototype = new Node();
 Variable.prototype.type = "Variable";
-Variable.prototype.eval = function (env) {
+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(env).value;
+        name = '@' + new(Variable)(name.slice(1), this.index, this.currentFileInfo).eval(context).value;
     }
 
     if (this.evaluating) {
@@ -23,10 +23,10 @@ Variable.prototype.eval = function (env) {
 
     this.evaluating = true;
 
-    variable = this.find(env.frames, function (frame) {
+    variable = this.find(context.frames, function (frame) {
         var v = frame.variable(name);
         if (v) {
-            return v.value.eval(env);
+            return v.value.eval(context);
         }
     });
     if (variable) {
diff --git a/lib/less/visitors/import-visitor.js b/lib/less/visitors/import-visitor.js
index 015f3bf..d74ff0e 100644
--- a/lib/less/visitors/import-visitor.js
+++ b/lib/less/visitors/import-visitor.js
@@ -5,7 +5,7 @@ var ImportVisitor = function(importer, finish, evalEnv, onceFileDetectionMap, re
     this._visitor = new Visitor(this);
     this._importer = importer;
     this._finish = finish;
-    this.env = evalEnv || new contexts.evalEnv();
+    this.context = evalEnv || new contexts.Eval();
     this.importCount = 0;
     this.onceFileDetectionMap = onceFileDetectionMap || {};
     this.recursionDetector = {};
@@ -44,7 +44,7 @@ ImportVisitor.prototype = {
         if (!importNode.css || inlineCSS) {
 
             try {
-                evaldImportNode = importNode.evalForImport(this.env);
+                evaldImportNode = importNode.evalForImport(this.context);
             } catch(e){
                 if (!e.filename) { e.index = importNode.index; e.filename = importNode.currentFileInfo.filename; }
                 // attempt to eval properly and treat as css
@@ -56,10 +56,10 @@ ImportVisitor.prototype = {
             if (evaldImportNode && (!evaldImportNode.css || inlineCSS)) {
                 importNode = evaldImportNode;
                 this.importCount++;
-                var env = new contexts.evalEnv(this.env, this.env.frames.slice(0));
+                var context = new contexts.Eval(this.context, this.context.frames.slice(0));
 
                 if (importNode.options.multiple) {
-                    env.importMultiple = true;
+                    context.importMultiple = true;
                 }
 
                 this._importer.push(importNode.getPath(), importNode.currentFileInfo, importNode.options, function (e, root, importedAtRoot, fullPath) {
@@ -68,7 +68,7 @@ ImportVisitor.prototype = {
                     }
 
                     var duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector;
-                    if (!env.importMultiple) {
+                    if (!context.importMultiple) {
                         if (duplicateImport) {
                             importNode.skip = true;
                         } else {
@@ -94,9 +94,9 @@ ImportVisitor.prototype = {
                         importNode.root = root;
                         importNode.importedFilename = fullPath;
 
-                        if (!inlineCSS && (env.importMultiple || !duplicateImport)) {
+                        if (!inlineCSS && (context.importMultiple || !duplicateImport)) {
                             importVisitor.recursionDetector[fullPath] = true;
-                            new(ImportVisitor)(importVisitor._importer, subFinish, env, importVisitor.onceFileDetectionMap, importVisitor.recursionDetector)
+                            new(ImportVisitor)(importVisitor._importer, subFinish, context, importVisitor.onceFileDetectionMap, importVisitor.recursionDetector)
                                 .run(root);
                             return;
                         }
@@ -114,32 +114,32 @@ ImportVisitor.prototype = {
         return ruleNode;
     },
     visitDirective: function (directiveNode, visitArgs) {
-        this.env.frames.unshift(directiveNode);
+        this.context.frames.unshift(directiveNode);
         return directiveNode;
     },
     visitDirectiveOut: function (directiveNode) {
-        this.env.frames.shift();
+        this.context.frames.shift();
     },
     visitMixinDefinition: function (mixinDefinitionNode, visitArgs) {
-        this.env.frames.unshift(mixinDefinitionNode);
+        this.context.frames.unshift(mixinDefinitionNode);
         return mixinDefinitionNode;
     },
     visitMixinDefinitionOut: function (mixinDefinitionNode) {
-        this.env.frames.shift();
+        this.context.frames.shift();
     },
     visitRuleset: function (rulesetNode, visitArgs) {
-        this.env.frames.unshift(rulesetNode);
+        this.context.frames.unshift(rulesetNode);
         return rulesetNode;
     },
     visitRulesetOut: function (rulesetNode) {
-        this.env.frames.shift();
+        this.context.frames.shift();
     },
     visitMedia: function (mediaNode, visitArgs) {
-        this.env.frames.unshift(mediaNode.rules[0]);
+        this.context.frames.unshift(mediaNode.rules[0]);
         return mediaNode;
     },
     visitMediaOut: function (mediaNode) {
-        this.env.frames.shift();
+        this.context.frames.shift();
     }
 };
 module.exports = ImportVisitor;
diff --git a/lib/less/visitors/to-css-visitor.js b/lib/less/visitors/to-css-visitor.js
index e9e19d1..6965898 100644
--- a/lib/less/visitors/to-css-visitor.js
+++ b/lib/less/visitors/to-css-visitor.js
@@ -1,9 +1,9 @@
 var tree = require("../tree"),
     Visitor = require("./visitor");
 
-var ToCSSVisitor = function(env) {
+var ToCSSVisitor = function(context) {
     this._visitor = new Visitor(this);
-    this._env = env;
+    this._context = context;
 };
 
 ToCSSVisitor.prototype = {
@@ -31,7 +31,7 @@ ToCSSVisitor.prototype = {
     },
 
     visitComment: function (commentNode, visitArgs) {
-        if (commentNode.isSilent(this._env)) {
+        if (commentNode.isSilent(this._context)) {
             return [];
         }
         return commentNode;
@@ -57,7 +57,7 @@ ToCSSVisitor.prototype = {
             // be considered illegal css as it has to be on the first line
             if (this.charset) {
                 if (directiveNode.debugInfo) {
-                    var comment = new tree.Comment("/* " + directiveNode.toCSS(this._env).replace(/\n/g, "")+" */\n");
+                    var comment = new tree.Comment("/* " + directiveNode.toCSS(this._context).replace(/\n/g, "")+" */\n");
                     comment.debugInfo = directiveNode.debugInfo;
                     return this._visitor.visit(comment);
                 }
@@ -168,9 +168,9 @@ ToCSSVisitor.prototype = {
                 } else {
                     ruleList = ruleCache[rule.name];
                     if (ruleList instanceof tree.Rule) {
-                        ruleList = ruleCache[rule.name] = [ruleCache[rule.name].toCSS(this._env)];
+                        ruleList = ruleCache[rule.name] = [ruleCache[rule.name].toCSS(this._context)];
                     }
-                    var ruleCSS = rule.toCSS(this._env);
+                    var ruleCSS = rule.toCSS(this._context);
                     if (ruleList.indexOf(ruleCSS) !== -1) {
                         rules.splice(i, 1);
                     } else {

-- 
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