making inner comments work within class definitions
This commit is contained in:
parent
1c7e4c4203
commit
4ec7514d10
|
@ -675,13 +675,15 @@
|
|||
_a = this.properties;
|
||||
for (_b = 0, _c = _a.length; _b < _c; _b++) {
|
||||
prop = _a[_b];
|
||||
if (prop.variable.base.value === 'constructor') {
|
||||
if (prop.variable && prop.variable.base.value === 'constructor') {
|
||||
func = prop.value;
|
||||
func.body.push(new ReturnNode(new LiteralNode('this')));
|
||||
constructor = new AssignNode(this.variable, func);
|
||||
} else {
|
||||
val = new ValueNode(this.variable, [new AccessorNode(prop.variable, 'prototype')]);
|
||||
prop = new AssignNode(val, prop.value);
|
||||
if (prop.variable) {
|
||||
val = new ValueNode(this.variable, [new AccessorNode(prop.variable, 'prototype')]);
|
||||
prop = new AssignNode(val, prop.value);
|
||||
}
|
||||
props.push(prop);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -538,13 +538,14 @@ ClassNode: exports.ClassNode: inherit BaseNode, {
|
|||
ret: del o, 'returns'
|
||||
|
||||
for prop in @properties
|
||||
if prop.variable.base.value is 'constructor'
|
||||
if prop.variable and prop.variable.base.value is 'constructor'
|
||||
func: prop.value
|
||||
func.body.push(new ReturnNode(new LiteralNode('this')))
|
||||
constructor: new AssignNode(@variable, func)
|
||||
else
|
||||
val: new ValueNode(@variable, [new AccessorNode(prop.variable, 'prototype')])
|
||||
prop: new AssignNode(val, prop.value)
|
||||
if prop.variable
|
||||
val: new ValueNode(@variable, [new AccessorNode(prop.variable, 'prototype')])
|
||||
prop: new AssignNode(val, prop.value)
|
||||
props.push prop
|
||||
|
||||
constructor: new AssignNode(@variable, new CodeNode()) unless constructor
|
||||
|
|
|
@ -13,6 +13,8 @@ class SecondChild extends FirstChild
|
|||
class ThirdChild extends SecondChild
|
||||
constructor: ->
|
||||
@array: [1, 2, 3]
|
||||
|
||||
# Gratuitous comment for testing.
|
||||
func: (string) ->
|
||||
super('three/') + string
|
||||
|
||||
|
|
Loading…
Reference in New Issue