1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Issue #706 -- enchancing empty anonymous classes.

This commit is contained in:
Jeremy Ashkenas 2010-09-27 23:59:47 -04:00
parent 2e3f575f9c
commit c064c90ee9
4 changed files with 147 additions and 127 deletions

View file

@ -235,6 +235,12 @@
return new ClassNode($2, $4, $6);
}), o("CLASS INDENT ClassBody OUTDENT", function() {
return new ClassNode('__temp__', null, $3);
}), o("CLASS", function() {
return new ClassNode('__temp__', null, new Expressions);
}), o("CLASS EXTENDS Value", function() {
return new ClassNode('__temp__', $3, new Expressions);
}), o("CLASS EXTENDS Value INDENT ClassBody OUTDENT", function() {
return new ClassNode('__temp__', $3, $5);
})
],
ClassAssign: [

File diff suppressed because one or more lines are too long

View file

@ -281,6 +281,9 @@ grammar =
o "CLASS SimpleAssignable INDENT ClassBody OUTDENT", -> new ClassNode $2, null, $4
o "CLASS SimpleAssignable EXTENDS Value INDENT ClassBody OUTDENT", -> new ClassNode $2, $4, $6
o "CLASS INDENT ClassBody OUTDENT", -> new ClassNode '__temp__', null, $3
o "CLASS", -> new ClassNode '__temp__', null, new Expressions
o "CLASS EXTENDS Value", -> new ClassNode '__temp__', $3, new Expressions
o "CLASS EXTENDS Value INDENT ClassBody OUTDENT", -> new ClassNode '__temp__', $3, $5
]
# Assignments that can happen directly inside a class declaration.

View file

@ -10,7 +10,7 @@ class FirstChild extends Base
func: (string) ->
super('one/') + string
class SecondChild extends FirstChild
SecondChild = class extends FirstChild
func: (string) ->
super('two/') + string
@ -256,3 +256,8 @@ class Static
ok Static.static.one is 1
ok Static.static.two is 2
# Nothing classes.
c = class
ok c instanceof Function