Skip to content

Commit

Permalink
Merge pull request #848 from rhendric/fix/keyword-literal-slices
Browse files Browse the repository at this point in the history
fix keyword literals in object slices
  • Loading branch information
vendethiel committed Feb 10, 2016
2 parents fbc1502 + c0651c8 commit 63c19f5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/ast.js

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

2 changes: 2 additions & 0 deletions src/ast.ls
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,8 @@ class exports.Literal extends Atom
else
super ...

maybe-key: -> if ID.test @value then Key @value else this

compile: (o, level ? o.level) ->
switch val = "#{@value}"
| \this => return sn(this, o.scope.fun?bound or val)
Expand Down
8 changes: 8 additions & 0 deletions test/chaining.ls
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,11 @@ eq void f!?p

f = void
eq void f?!

# Keyword literals in object slices
keywords = arguments: 1 eval: 2 void: 3 on: 4 debugger: 5
eq 1 keywords{arguments}arguments
eq 2 keywords{eval}eval
eq 3 keywords{void}void
eq 4 keywords{on}on
eq 5 keywords{debugger}debugger

0 comments on commit 63c19f5

Please sign in to comment.