[Pkg-javascript-commits] [less.js] 88/285: parser no longer needs to expose imports (they are on the parseTree) and can use a variable instead of a reference to itself

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:23:41 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 9af3819822ecd70af2b311c866b46532a6dd03c0
Author: Luke Page <luke.a.page at gmail.com>
Date:   Thu Sep 4 17:56:12 2014 +0100

    parser no longer needs to expose imports (they are on the parseTree) and can use a variable instead of a reference to itself
---
 lib/less/parser/imports.js |  2 +-
 lib/less/parser/parser.js  | 18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/less/parser/imports.js b/lib/less/parser/imports.js
index 7b2fd56..b45e533 100644
--- a/lib/less/parser/imports.js
+++ b/lib/less/parser/imports.js
@@ -3,7 +3,7 @@ module.exports = function(environment, env, Parser) {
     var rootFilename = env && env.filename;
     return {
         paths: env.paths || [],  // Search paths, when importing
-            queue: [],               // Files which haven't been imported yet
+        queue: [],               // Files which haven't been imported yet
         files: env.files,        // Holds the imported parse trees
         contents: env.contents,  // Holds the imported file contents
         contentsIgnoredChars: env.contentsIgnoredChars, // lines inserted, not in the original less
diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js
index aadef58..efbe0f7 100644
--- a/lib/less/parser/parser.js
+++ b/lib/less/parser/parser.js
@@ -53,7 +53,7 @@ var Parser = function Parser(env) {
     }
     this.env = env;
 
-    var imports = this.imports = getImportManager(environment, env, Parser);
+    var imports = getImportManager(environment, env, Parser);
 
     function expect(arg, msg, index) {
         // some older browsers return typeof 'function' for RegExp
@@ -110,13 +110,13 @@ var Parser = function Parser(env) {
 
             if (globalVars || (additionalData && additionalData.banner)) {
                 preText = ((additionalData && additionalData.banner) ? additionalData.banner : "") + globalVars;
-                parser.imports.contentsIgnoredChars[env.currentFileInfo.filename] = preText.length;
+                imports.contentsIgnoredChars[env.currentFileInfo.filename] = preText.length;
             }
 
             str = str.replace(/\r\n/g, '\n');
             // Remove potential UTF Byte Order Mark
             str = preText + str.replace(/^\uFEFF/, '') + modifyVars;
-            parser.imports.contents[env.currentFileInfo.filename] = str;
+            imports.contents[env.currentFileInfo.filename] = str;
 
             // Start with the primary rule.
             // The whole syntax tree is held under a Ruleset node,
@@ -129,7 +129,7 @@ var Parser = function Parser(env) {
                 root.root = true;
                 root.firstRoot = true;
             } catch (e) {
-                return callback(new LessError(e, parser.imports, env.currentFileInfo.filename));
+                return callback(new LessError(e, imports, env.currentFileInfo.filename));
             }
 
             // If `i` is smaller than the `input.length - 1`,
@@ -161,27 +161,27 @@ var Parser = function Parser(env) {
                     message: message,
                     index: endInfo.furthest,
                     filename: env.currentFileInfo.filename
-                }, parser.imports);
+                }, imports);
             }
 
             var finish = function (e) {
-                e = error || e || parser.imports.error;
+                e = error || e || imports.error;
 
                 if (e) {
                     if (!(e instanceof LessError)) {
-                        e = new LessError(e, parser.imports, env.currentFileInfo.filename);
+                        e = new LessError(e, imports, env.currentFileInfo.filename);
                     }
 
                     return callback(e);
                 }
                 else {
                     return callback(null,
-                        returnSubParseTree ? root : new ParseTree(root, parser.imports));
+                        returnSubParseTree ? root : new ParseTree(root, imports));
                 }
             };
 
             if (env.processImports !== false) {
-                new visitor.ImportVisitor(this.imports, finish)
+                new visitor.ImportVisitor(imports, finish)
                     .run(root);
             } else {
                 return finish();

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