[Pkg-javascript-commits] [less.js] 231/285: Method for how it will work asyncronously (broken)

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:23:57 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 ebdda843012ab1a505660a735f0c0c58f99c9c4f
Author: Luke Page <luke.a.page at gmail.com>
Date:   Thu Oct 23 22:26:22 2014 +0100

    Method for how it will work asyncronously (broken)
---
 lib/less/visitors/import-visitor.js | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/lib/less/visitors/import-visitor.js b/lib/less/visitors/import-visitor.js
index 6a8f3d2..1855dcd 100644
--- a/lib/less/visitors/import-visitor.js
+++ b/lib/less/visitors/import-visitor.js
@@ -15,7 +15,7 @@ var ImportVisitor = function(importer, finish) {
 };
 
 ImportVisitor.prototype = {
-    isReplacing: true,
+    isReplacing: false,
     run: function (root) {
         var error;
         try {
@@ -40,17 +40,26 @@ ImportVisitor.prototype = {
             //if (importNode.isVariableImport()) {
             //    console.log("variable import detected");
             //}
-            importNode = this.processImportNode(importNode, this.context);
+            var context = new contexts.Eval(this.context, this.context.frames.slice(0));
+
+            var importParent = context.frames[0];
+            var newImportNode = this.processImportNode(importNode, context);
+            for(var i = 0; i < importParent.rules.length; i++) {
+                if (importParent.rules[i] === importNode) {
+                    importParent.rules[i] = newImportNode;
+                    break;
+                }
+            }
         }
         visitArgs.visitDeeper = false;
         return importNode;
     },
-    processImportNode: function(importNode, currentContext) {
+    processImportNode: function(importNode, context) {
         var evaldImportNode,
             inlineCSS = importNode.options.inline;
 
         try {
-            evaldImportNode = importNode.evalForImport(currentContext);
+            evaldImportNode = importNode.evalForImport(context);
         } catch(e){
             if (!e.filename) { e.index = importNode.index; e.filename = importNode.currentFileInfo.filename; }
             // attempt to eval properly and treat as css
@@ -62,7 +71,6 @@ ImportVisitor.prototype = {
         if (evaldImportNode && (!evaldImportNode.css || inlineCSS)) {
             importNode = evaldImportNode;
             this.importCount++;
-            var context = new contexts.Eval(currentContext, currentContext.frames.slice(0));
 
             if (importNode.options.multiple) {
                 context.importMultiple = true;

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