Fix #3846: Fix odd start token of implicit objects

Now the same hack as for reserved identifier tokens in the lexer is used
instead.
This commit is contained in:
Simon Lydell 2015-02-12 19:41:12 +01:00
parent 8130e63e43
commit 57846ea5c0
2 changed files with 7 additions and 3 deletions

View File

@ -216,7 +216,7 @@
return i += 1; return i += 1;
}; };
startImplicitObject = function(j, startsLine) { startImplicitObject = function(j, startsLine) {
var idx; var idx, val;
if (startsLine == null) { if (startsLine == null) {
startsLine = true; startsLine = true;
} }
@ -228,7 +228,9 @@
ours: true ours: true
} }
]); ]);
tokens.splice(idx, 0, generate('{', generate(new String('{')), token)); val = new String('{');
val.generated = true;
tokens.splice(idx, 0, generate('{', val, token));
if (j == null) { if (j == null) {
return i += 1; return i += 1;
} }

View File

@ -171,7 +171,9 @@ class exports.Rewriter
startImplicitObject = (j, startsLine = yes) -> startImplicitObject = (j, startsLine = yes) ->
idx = j ? i idx = j ? i
stack.push ['{', idx, sameLine: yes, startsLine: startsLine, ours: yes] stack.push ['{', idx, sameLine: yes, startsLine: startsLine, ours: yes]
tokens.splice idx, 0, generate '{', generate(new String('{')), token val = new String '{'
val.generated = yes
tokens.splice idx, 0, generate '{', val, token
i += 1 if not j? i += 1 if not j?
endImplicitObject = (j) -> endImplicitObject = (j) ->