mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Closes #1082. Puts back use of function calls in parameter lists.
This commit is contained in:
parent
cf6c21a0d2
commit
5fbbfbcbe3
3 changed files with 7 additions and 3 deletions
|
@ -436,9 +436,10 @@
|
|||
stack.push(tok);
|
||||
break;
|
||||
case '(':
|
||||
case 'CALL_START':
|
||||
if (stack.length) {
|
||||
stack.pop();
|
||||
} else {
|
||||
} else if (tok[0] === '(') {
|
||||
tok[0] = 'PARAM_START';
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -369,9 +369,9 @@ exports.Lexer = class Lexer
|
|||
switch tok[0]
|
||||
when ')'
|
||||
stack.push tok
|
||||
when '('
|
||||
when '(', 'CALL_START'
|
||||
if stack.length then stack.pop()
|
||||
else
|
||||
else if tok[0] is '('
|
||||
tok[0] = 'PARAM_START'
|
||||
return this
|
||||
this
|
||||
|
|
|
@ -148,6 +148,9 @@ test "default values with splatted arguments", ->
|
|||
eq 1, withSplats(1,1,1)
|
||||
eq 2, withSplats(1,1,1,1)
|
||||
|
||||
test "default values with function calls", ->
|
||||
doesNotThrow -> CoffeeScript.compile "(x = f()) ->"
|
||||
|
||||
test "arguments vs parameters", ->
|
||||
doesNotThrow -> CoffeeScript.compile "f(x) ->"
|
||||
f = (g) -> g()
|
||||
|
|
Loading…
Reference in a new issue