Skip to content

Commit 97d9a63

Browse files
author
Marc Häfner
committed
Fixes #3232 -- Tag all class properties static
1 parent 138c25f commit 97d9a63

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

lib/coffee-script/nodes.js

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/nodes.coffee

+4
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,10 @@ exports.Class = class Class extends Base
10051005
else if node instanceof Code
10061006
node.klass = name
10071007
node.context = name if node.bound
1008+
else if node instanceof Assign and
1009+
node.variable.base.value in ['this', name] and
1010+
node.variable.properties[0]?.name?.value isnt 'prototype'
1011+
node.value.static = yes
10081012

10091013
# Ensure that all functions bound to the instance are proxied in the
10101014
# constructor.

test/classes.coffee

+9
Original file line numberDiff line numberDiff line change
@@ -816,3 +816,12 @@ test "#2949: super in static method with reserved name", ->
816816
@static: -> super
817817

818818
eq Bar.static(), 'baz'
819+
820+
test "#3232: super in static methods (not object-assigned)", ->
821+
class Foo
822+
@fn = -> true
823+
824+
class Bar extends Foo
825+
@fn = -> super
826+
827+
ok Bar.fn()

0 commit comments

Comments
 (0)