Skip to content

Commit

Permalink
Merge pull request jashkenas#1868 from geraldalewis/1840_invocation_p…
Browse files Browse the repository at this point in the history
…rototype_prop_access

jashkenas#1840 Invocation Prototype Prop Access
  • Loading branch information
jashkenas committed Nov 14, 2011
2 parents d0b8cde + 8762e37 commit 55521a2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/coffee-script/grammar.js

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

2 changes: 1 addition & 1 deletion lib/coffee-script/parser.js

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

2 changes: 1 addition & 1 deletion src/grammar.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ grammar =
SimpleAssignable: [
o 'Identifier', -> new Value $1
o 'Value Accessor', -> $1.add $2
o 'Invocation Accessor', -> new Value $1, [$2]
o 'Invocation Accessor', -> new Value $1, [].concat $2
o 'ThisProperty'
]

Expand Down
12 changes: 12 additions & 0 deletions test/function_invocation.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -506,3 +506,15 @@ test "#1416: don't omit one 'new' when compiling 'new new fn()()'", ->
eq obj.prop, nonce
eq obj.a, argNonceA
eq obj.b, argNonceB

test "#1840: accessing the `prototype` after function invocation should compile", ->
doesNotThrow -> CoffeeScript.compile 'fn()::prop'

nonce = {}
class Test then id: nonce

dotAccess = -> Test::
protoAccess = -> Test

eq dotAccess().id, nonce
eq protoAccess()::id, nonce

0 comments on commit 55521a2

Please sign in to comment.