making inner comments work within class definitions

This commit is contained in:
Jeremy Ashkenas
2010-02-27 19:03:23 -05:00
parent 1c7e4c4203
commit 4ec7514d10
3 changed files with 11 additions and 6 deletions

View File

@@ -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