mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-19 03:44:23 -05:00
complete implicit functions, I think these are done.
This commit is contained in:
@@ -19,7 +19,7 @@ module CoffeeScript
|
|||||||
EXPRESSION_CLOSE = [:CATCH, :WHEN, :ELSE, :FINALLY] + EXPRESSION_TAIL
|
EXPRESSION_CLOSE = [:CATCH, :WHEN, :ELSE, :FINALLY] + EXPRESSION_TAIL
|
||||||
|
|
||||||
# Tokens pairs that, in immediate succession, indicate an implicit call.
|
# Tokens pairs that, in immediate succession, indicate an implicit call.
|
||||||
IMPLICIT_FUNC = [:IDENTIFIER, :SUPER]
|
IMPLICIT_FUNC = [:IDENTIFIER, :SUPER, ')', :CALL_END, ']', :INDEX_END]
|
||||||
IMPLICIT_END = [:IF, :UNLESS, :FOR, :WHILE, "\n", :OUTDENT]
|
IMPLICIT_END = [:IF, :UNLESS, :FOR, :WHILE, "\n", :OUTDENT]
|
||||||
IMPLICIT_CALL = [:IDENTIFIER, :NUMBER, :STRING, :JS, :REGEX, :NEW, :PARAM_START,
|
IMPLICIT_CALL = [:IDENTIFIER, :NUMBER, :STRING, :JS, :REGEX, :NEW, :PARAM_START,
|
||||||
:TRY, :DELETE, :INSTANCEOF, :TYPEOF, :SWITCH, :ARGUMENTS,
|
:TRY, :DELETE, :INSTANCEOF, :TYPEOF, :SWITCH, :ARGUMENTS,
|
||||||
|
|||||||
12
test/fixtures/execution/test_functions.coffee
vendored
12
test/fixtures/execution/test_functions.coffee
vendored
@@ -64,3 +64,15 @@ result: call ->
|
|||||||
Math.Add(5, 5)
|
Math.Add(5, 5)
|
||||||
|
|
||||||
print result is 10
|
print result is 10
|
||||||
|
|
||||||
|
|
||||||
|
# And even with strange things like this:
|
||||||
|
|
||||||
|
funcs: [(x) -> x, (x) -> x * x]
|
||||||
|
result: funcs[1] 5
|
||||||
|
|
||||||
|
print result is 25
|
||||||
|
|
||||||
|
result: ("hello".slice) 3
|
||||||
|
|
||||||
|
print result is 'lo'
|
||||||
Reference in New Issue
Block a user