mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-04-11 03:00:13 -04:00
making inner comments work within class definitions
This commit is contained in:
@@ -675,13 +675,15 @@
|
|||||||
_a = this.properties;
|
_a = this.properties;
|
||||||
for (_b = 0, _c = _a.length; _b < _c; _b++) {
|
for (_b = 0, _c = _a.length; _b < _c; _b++) {
|
||||||
prop = _a[_b];
|
prop = _a[_b];
|
||||||
if (prop.variable.base.value === 'constructor') {
|
if (prop.variable && prop.variable.base.value === 'constructor') {
|
||||||
func = prop.value;
|
func = prop.value;
|
||||||
func.body.push(new ReturnNode(new LiteralNode('this')));
|
func.body.push(new ReturnNode(new LiteralNode('this')));
|
||||||
constructor = new AssignNode(this.variable, func);
|
constructor = new AssignNode(this.variable, func);
|
||||||
} else {
|
} else {
|
||||||
val = new ValueNode(this.variable, [new AccessorNode(prop.variable, 'prototype')]);
|
if (prop.variable) {
|
||||||
prop = new AssignNode(val, prop.value);
|
val = new ValueNode(this.variable, [new AccessorNode(prop.variable, 'prototype')]);
|
||||||
|
prop = new AssignNode(val, prop.value);
|
||||||
|
}
|
||||||
props.push(prop);
|
props.push(prop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -538,13 +538,14 @@ ClassNode: exports.ClassNode: inherit BaseNode, {
|
|||||||
ret: del o, 'returns'
|
ret: del o, 'returns'
|
||||||
|
|
||||||
for prop in @properties
|
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: prop.value
|
||||||
func.body.push(new ReturnNode(new LiteralNode('this')))
|
func.body.push(new ReturnNode(new LiteralNode('this')))
|
||||||
constructor: new AssignNode(@variable, func)
|
constructor: new AssignNode(@variable, func)
|
||||||
else
|
else
|
||||||
val: new ValueNode(@variable, [new AccessorNode(prop.variable, 'prototype')])
|
if prop.variable
|
||||||
prop: new AssignNode(val, prop.value)
|
val: new ValueNode(@variable, [new AccessorNode(prop.variable, 'prototype')])
|
||||||
|
prop: new AssignNode(val, prop.value)
|
||||||
props.push prop
|
props.push prop
|
||||||
|
|
||||||
constructor: new AssignNode(@variable, new CodeNode()) unless constructor
|
constructor: new AssignNode(@variable, new CodeNode()) unless constructor
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ class SecondChild extends FirstChild
|
|||||||
class ThirdChild extends SecondChild
|
class ThirdChild extends SecondChild
|
||||||
constructor: ->
|
constructor: ->
|
||||||
@array: [1, 2, 3]
|
@array: [1, 2, 3]
|
||||||
|
|
||||||
|
# Gratuitous comment for testing.
|
||||||
func: (string) ->
|
func: (string) ->
|
||||||
super('three/') + string
|
super('three/') + string
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user