Fix #4464: backticked expressions in class body (#4712)

* Fix #4464: backticked expressions in class body should be left in the body, not hoisted

* Fix #4464: backticked expressions in class body should be left in the body, not hoisted

* Simplify fix for #4464

This uses more of the existing machinery for moving class body
expressions into the initializer.

* Clarify the purpose of Class::addInitializerExpression

* Further clarify the purpose of Class::addInitializerExpression

* Add reference to class fields; format
 comment wrapping

* Reapply 1d3af8c432, that got lost because of rebase/force-push shenanigans

* Updated output
This commit is contained in:
Chris Connelly
2017-09-21 03:11:05 +01:00
committed by Geoffrey Booth
parent 5cbd25f5d4
commit 27eff5ca77
3 changed files with 47 additions and 6 deletions

View File

@@ -1833,3 +1833,18 @@ test "#4591: super.x.y, super['x'].y", ->
eq 2, b.t
eq 2, b.s
eq 2, b.r
test "#4464: backticked expressions in class body", ->
class A
`get x() { return 42; }`
class B
`get x() { return 42; }`
constructor: ->
@y = 84
a = new A
eq 42, a.x
b = new B
eq 42, b.x
eq 84, b.y