Closes #1082. Puts back use of function calls in parameter lists.

This commit is contained in:
Timothy Jones 2011-02-23 13:20:01 +13:00
parent cf6c21a0d2
commit 5fbbfbcbe3
3 changed files with 7 additions and 3 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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()