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);
|
stack.push(tok);
|
||||||
break;
|
break;
|
||||||
case '(':
|
case '(':
|
||||||
|
case 'CALL_START':
|
||||||
if (stack.length) {
|
if (stack.length) {
|
||||||
stack.pop();
|
stack.pop();
|
||||||
} else {
|
} else if (tok[0] === '(') {
|
||||||
tok[0] = 'PARAM_START';
|
tok[0] = 'PARAM_START';
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -369,9 +369,9 @@ exports.Lexer = class Lexer
|
||||||
switch tok[0]
|
switch tok[0]
|
||||||
when ')'
|
when ')'
|
||||||
stack.push tok
|
stack.push tok
|
||||||
when '('
|
when '(', 'CALL_START'
|
||||||
if stack.length then stack.pop()
|
if stack.length then stack.pop()
|
||||||
else
|
else if tok[0] is '('
|
||||||
tok[0] = 'PARAM_START'
|
tok[0] = 'PARAM_START'
|
||||||
return this
|
return this
|
||||||
this
|
this
|
||||||
|
|
|
@ -148,6 +148,9 @@ test "default values with splatted arguments", ->
|
||||||
eq 1, withSplats(1,1,1)
|
eq 1, withSplats(1,1,1)
|
||||||
eq 2, withSplats(1,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", ->
|
test "arguments vs parameters", ->
|
||||||
doesNotThrow -> CoffeeScript.compile "f(x) ->"
|
doesNotThrow -> CoffeeScript.compile "f(x) ->"
|
||||||
f = (g) -> g()
|
f = (g) -> g()
|
||||||
|
|
Loading…
Add table
Reference in a new issue