mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-01-14 09:17:55 -05:00
adding empty return statements -- they return null
This commit is contained in:
@@ -38,7 +38,8 @@ prechigh
|
||||
right THROW FOR NEW SUPER
|
||||
left EXTENDS
|
||||
left ASSIGN '||=' '&&='
|
||||
right RETURN '=>' UNLESS IF ELSE WHILE
|
||||
right RETURN
|
||||
right '=>' UNLESS IF ELSE WHILE
|
||||
preclow
|
||||
|
||||
rule
|
||||
@@ -124,6 +125,7 @@ rule
|
||||
# A return statement.
|
||||
Return:
|
||||
RETURN Expression { result = ReturnNode.new(val[1]) }
|
||||
| RETURN { result = ReturnNode.new(ValueNode.new(Value.new('null'))) }
|
||||
;
|
||||
|
||||
# A comment.
|
||||
|
||||
8
test/fixtures/execution/test_literals.coffee
vendored
8
test/fixtures/execution/test_literals.coffee
vendored
@@ -11,4 +11,10 @@ print(!!words.match(regex))
|
||||
|
||||
neg: (3 -4)
|
||||
|
||||
print(neg is -1)
|
||||
print(neg is -1)
|
||||
|
||||
|
||||
func: =>
|
||||
return if true
|
||||
|
||||
print(func() is null)
|
||||
Reference in New Issue
Block a user