Better error message for unexpected CALL_END

This commit is contained in:
Simon Lydell 2015-01-12 20:40:59 +01:00
parent bec8f27e8a
commit 62712060c0
3 changed files with 7 additions and 2 deletions

View File

@ -194,7 +194,7 @@
};
endImplicitCall = function() {
stack.pop();
tokens.splice(i, 0, generate('CALL_END', ')'));
tokens.splice(i, 0, generate('CALL_END', ')', ['', 'end of input', token[2]]));
return i += 1;
};
startImplicitObject = function(j, startsLine) {

View File

@ -157,7 +157,7 @@ class exports.Rewriter
endImplicitCall = ->
stack.pop()
tokens.splice i, 0, generate 'CALL_END', ')'
tokens.splice i, 0, generate 'CALL_END', ')', ['', 'end of input', token[2]]
i += 1
startImplicitObject = (j, startsLine = yes) ->

View File

@ -111,6 +111,11 @@ test "#1096: unexpected generated tokens", ->
a:
^
'''
assertErrorFormat 'a +', '''
[stdin]:1:4: error: unexpected end of input
a +
^
'''
# Unexpected implicit object
assertErrorFormat '''
for i in [1]: