Package anvil.script.expression

Source Code of anvil.script.expression.ConstructorInvokeNode

/*
* $Id: ConstructorInvokeNode.java,v 1.15 2002/09/16 08:05:04 jkl Exp $
*
* Copyright (c) 2002 Njet Communications Ltd. All Rights Reserved.
*
* Use is subject to license terms, as defined in
* Anvil Sofware License, Version 1.1. See LICENSE
* file, or http://njet.org/license-1.1.txt
*/
package anvil.script.expression;

import anvil.core.Any;
import anvil.core.AnyClass;
import anvil.ErrorListener;
import anvil.script.ClassType;
import anvil.script.ClassRef;
import anvil.script.CompilableFunction;
import anvil.codec.Code;
import anvil.script.compiler.ByteCompiler;
import anvil.script.Context;
import anvil.script.Function;
import java.io.IOException;

/**
* class ConstructorInvokeNode
*
* @author: Jani Lehtim�ki
*/
public class ConstructorInvokeNode extends MultiParent
{
  private ClassType _classtype;


  public ConstructorInvokeNode(ClassType classtype, Parent parameters)
  {
    super(parameters);
    _classtype = classtype;
  }


  public int typeOf()
  {
    return Node.EXPR_INVOKE;
  }


  public boolean isConstant()
  {
    return false;
  }


  public void compile(ByteCompiler context, int operation)
  {
    ClassType base = _classtype.getBaseClass();
    if (base != null) {
      Code code = context.getCode();
      CompilableFunction ctor = base.getConstructor();
      code.self();
      context.compileArgumentList(ctor, getChilds(0));
      code.invokespecial(ctor.getTypeRef(code.getPool()));
    }
  }

}
TOP

Related Classes of anvil.script.expression.ConstructorInvokeNode

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.