node.needs_init = false;
doing_method = true;
node.init.evaluate(cx,this);
doing_method = false;
}
Slot class_slot = null;
if( node.ref != null )
{
class_slot = node.ref.getSlot(cx, NEW_TOKEN);
}
if( node.version > -1 )
{
cx.pushVersion(node.version);
}
if (node.attrs != null)
{
node.attrs.evaluate(cx, this);
}
if (node.name != null)
{
node.name.evaluate(cx, this);
}
if (node.baseclass != null)
{
node.baseclass.evaluate(cx, this);
}
if (doing_class)
{
return node.cframe;
}
cx.pushStaticClassScopes(node);
this_contexts.add(error_this);
// Generate code for the static property definitions
doing_class = true;
{
for (FunctionCommonNode staticfexpr : node.staticfexprs)
{
staticfexpr.evaluate(cx, this);
}
}
{
doing_class = false;
for (Node clsdef : node.clsdefs)
{
clsdef.evaluate(cx, this);
}
doing_class = true;
}
if (node.statements != null)
{
node.statements.evaluate(cx, this);
}
doing_method = false; // This flag determines if the function is compiled
// now or later. The outer code block is finished
// so we can do a another one.
cx.pushScope(node.iframe);
this_contexts.removeLast();
this_contexts.add(instance_this);
// Determine which interfaces are implemented by the class
if (node.interfaces != null)
{
node.interfaces.evaluate(cx, this);
}
// Generate code for the instance initializers
{
for (Node init : node.instanceinits)
{
doing_method = true;
// not clear on whether this is required for instance inits
if (init instanceof FunctionDefinitionNode) // FunctionCommonNode initial evaluation requires this flag, normally set within StatementListNode evaluation
{ // static functions (incl getter/setters) are evaluated here, however, rather than from within a StatementListNode.
FunctionDefinitionNode func_def = (FunctionDefinitionNode)init;
func_def.evaluate(cx, this);
if( func_def.fexpr.ref.name.equals("$construct") )
{
// Copy the type info from the constructor slot into the global slot that is the reference
// to the class - this is so that type checking on constructor calls can happen correctly
Slot ctor_slot = func_def.fexpr.ref.getSlot(cx, func_def.fexpr.kind);
if( class_slot != null && ctor_slot != null )
{
class_slot.setTypes(ctor_slot.getTypes());
class_slot.setDeclStyles(ctor_slot.getDeclStyles());
}
}
}
else
{