1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Merge pull request #2627 from int3/master

Parse compound assignment operator followed by a terminator. Closes #2532.
This commit is contained in:
Jeremy Ashkenas 2013-01-05 20:10:32 -08:00
commit 547a271cee
4 changed files with 92 additions and 153 deletions

View file

@ -565,6 +565,9 @@
}), o('SimpleAssignable COMPOUND_ASSIGN\ }), o('SimpleAssignable COMPOUND_ASSIGN\
INDENT Expression OUTDENT', function() { INDENT Expression OUTDENT', function() {
return new Assign($1, $4, $2); return new Assign($1, $4, $2);
}), o('SimpleAssignable COMPOUND_ASSIGN TERMINATOR\
Expression', function() {
return new Assign($1, $4, $2);
}), o('SimpleAssignable EXTENDS Expression', function() { }), o('SimpleAssignable EXTENDS Expression', function() {
return new Extends($1, $3); return new Extends($1, $3);
}) })

File diff suppressed because one or more lines are too long

View file

@ -542,6 +542,8 @@ grammar =
Expression', -> new Assign $1, $3, $2 Expression', -> new Assign $1, $3, $2
o 'SimpleAssignable COMPOUND_ASSIGN o 'SimpleAssignable COMPOUND_ASSIGN
INDENT Expression OUTDENT', -> new Assign $1, $4, $2 INDENT Expression OUTDENT', -> new Assign $1, $4, $2
o 'SimpleAssignable COMPOUND_ASSIGN TERMINATOR
Expression', -> new Assign $1, $4, $2
o 'SimpleAssignable EXTENDS Expression', -> new Extends $1, $3 o 'SimpleAssignable EXTENDS Expression', -> new Extends $1, $3
] ]

View file

@ -365,3 +365,13 @@ test '#2213: invocations within destructured parameters', ->
throws -> CoffeeScript.compile '({a()})->' throws -> CoffeeScript.compile '({a()})->'
throws -> CoffeeScript.compile '({a:b()})->' throws -> CoffeeScript.compile '({a:b()})->'
throws -> CoffeeScript.compile '({a:b.c()})->' throws -> CoffeeScript.compile '({a:b.c()})->'
test '#2532: compound assignment with terminator', ->
doesNotThrow -> CoffeeScript.compile """
a = "hello"
a +=
"
world
!
"
"""