8000 no need for context passing · rusongyu/less.js@5c1f326 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5c1f326

Browse files
author
cloudhead
committed
no need for context passing
1 parent 3f51a5f commit 5c1f326

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

lib/less.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var less = {
4545
require(path.join('less', 'tree', n));
4646
});
4747

48-
less.Parser.importer = function (file, paths, callback, context) {
48+
less.Parser.importer = function (file, paths, callback) {
4949
var pathname;
5050

5151
paths.unshift('.');
@@ -74,7 +74,7 @@ less.Parser.importer = function (file, paths, callback, context) {
7474
paths: [path.dirname(pathname)]
7575
}).parse(data, function (e, root) {
7676
if (e) process.stdio.writeError(e);
77-
callback.call(context || null, root);
77+
callback(root);
7878
});
7979
});
8080
});

lib/less/parser.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,20 @@ less.Parser = function Parser(env) {
6161
queue: [], // Files which haven't been imported yet
6262
files: {}, // Holds the imported parse trees
6363
push: function (path, callback) {
64+
var that = this;
6465
this.queue.push(path);
6566

6667
//
6768
// Import a file asynchronously
6869
//
6970
less.Parser.importer(path, this.paths, function (root) {
70-
this.queue.splice(this.queue.indexOf(path), 1); // Remove the path from the queue
71-
this.files[path] = root; // Store the root
71+
that.queue.splice(that.queue.indexOf(path), 1); // Remove the path from the queue
72+
that.files[path] = root; // Store the root
7273

7374
callback(root);
7475

75-
if (this.queue.length === 0) { finish() } // Call `finish` if we're done importing
76-
}, this);
76+
if (that.queue.length === 0) { finish() } // Call `finish` if we're done importing
77+
});
7778
}
7879
};
7980

0 commit comments

Comments
 (0)
0