mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 11:31:20 -05:00
fixing static class properties that are implicit objects.
This commit is contained in:
@@ -241,6 +241,8 @@
|
|||||||
return $1;
|
return $1;
|
||||||
}), o("ThisProperty : Expression", function() {
|
}), o("ThisProperty : Expression", function() {
|
||||||
return new AssignNode(new ValueNode($1), $3, 'this');
|
return new AssignNode(new ValueNode($1), $3, 'this');
|
||||||
|
}), o("ThisProperty : INDENT Expression OUTDENT", function() {
|
||||||
|
return new AssignNode(new ValueNode($1), $4, 'this');
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
ClassBody: [
|
ClassBody: [
|
||||||
|
|||||||
218
lib/parser.js
218
lib/parser.js
File diff suppressed because one or more lines are too long
@@ -286,6 +286,7 @@ grammar =
|
|||||||
ClassAssign: [
|
ClassAssign: [
|
||||||
o "AssignObj", -> $1
|
o "AssignObj", -> $1
|
||||||
o "ThisProperty : Expression", -> new AssignNode new ValueNode($1), $3, 'this'
|
o "ThisProperty : Expression", -> new AssignNode new ValueNode($1), $3, 'this'
|
||||||
|
o "ThisProperty : INDENT Expression OUTDENT", -> new AssignNode new ValueNode($1), $4, 'this'
|
||||||
]
|
]
|
||||||
|
|
||||||
# A list of assignments to a class.
|
# A list of assignments to a class.
|
||||||
|
|||||||
@@ -246,3 +246,13 @@ obj =
|
|||||||
|
|
||||||
instance = new obj.klass
|
instance = new obj.klass
|
||||||
ok instance.method() is 'value'
|
ok instance.method() is 'value'
|
||||||
|
|
||||||
|
|
||||||
|
# Implicit objects as static properties.
|
||||||
|
class Static
|
||||||
|
@static:
|
||||||
|
one: 1
|
||||||
|
two: 2
|
||||||
|
|
||||||
|
ok Static.static.one is 1
|
||||||
|
ok Static.static.two is 2
|
||||||
|
|||||||
Reference in New Issue
Block a user