8000 Merge pull request #595 from hokaccha/fix_parser_error · rusongyu/less.js@222f5e6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 222f5e6

Browse files
committed
Merge pull request less#595 from hokaccha/fix_parser_error
Fix callback called two times
2 parents f69de47 + e58238b commit 222f5e6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/less/parser.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,17 +317,21 @@ less.Parser = function Parser(env) {
317317
}
318318
}
319319
if (level > 0) {
320-
return callback(new(LessError)({
320+
error = new(LessError)({
321321
index: i,
322322
type: 'Parse',
323323
message: "missing closing `}`",
324324
filename: env.filename
325-
}, env));
325+
}, env);
326326
}
327327

328328
return chunks.map(function (c) { return c.join('') });;
329329
})([[]]);
330330

331+
if (error) {
332+
return callback(error);
333+
}
334+
331335
// Start with the primary rule.
332336
// The whole syntax tree is held under a Ruleset node,
333337
// with the `root` property set to true, so no `{}` are

0 commit comments

Comments
 (0)
0