Skip to content

Commit

Permalink
Throw compile-time error if a label is used with a curried function (r…
Browse files Browse the repository at this point in the history
…esolves gkz#751)
  • Loading branch information
misterfish committed Jun 4, 2016
1 parent b7a0909 commit ad03579
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/ast.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/ast.ls
Original file line number Diff line number Diff line change
Expand Up @@ -2674,6 +2674,7 @@ class exports.If extends Node
# A labeled block or statement.
class exports.Label extends Node
(@label or \_, @it) ->
@carp "can't use label with a curried function (attempted label '#{@label}')" if @it.curried
if fun = it instanceof [Fun, Class] and it or
it.calling and it.it.head
fun.name or fun <<< {name: @label, +labeled}
Expand Down
1 change: 1 addition & 0 deletions test/compilation.ls
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ compileThrows 'unmatched `]`' 3 '[{\n\n]}'

compileThrows 'missing `)CALL`' 1 'f('

compileThrows "can't use label with a curried function (attempted label 'abc')" 1 ':abc (a, b) --> a + b'

throws '''
empty range on line 1
Expand Down

0 comments on commit ad03579

Please sign in to comment.