ConstructorStatement.java :  » Web-Framework » anvil » anvil » script » statements » Java Open Source

Java Open Source » Web Framework » anvil 
anvil » anvil » script » statements » ConstructorStatement.java
/*
 * $Id: ConstructorStatement.java,v 1.5 2002/09/16 08:05:06 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.statements;

import anvil.Location;
import anvil.codec.ClassRoom;
import anvil.codec.Method;
import anvil.codec.Field;
import anvil.core.Any;
import anvil.core.AnyClass;
import anvil.script.compiler.ByteCompiler;
import anvil.script.Context;
import anvil.script.Type;
import anvil.script.ParameterListDeclaration;
import anvil.script.expression.Expression;
import anvil.java.util.Hashlist;
import java.io.IOException;
import java.util.Enumeration;

/**
 * class ConstructorStatement
 *
 * @author: Jani Lehtimki
 */
public class ConstructorStatement extends MethodStatement
{

  public ConstructorStatement(ClassStatement clazz, Location location) 
  {
    super(clazz, location);
  }


  public ConstructorStatement(
      Location location, 
      ClassStatement clazz, 
      boolean sync, 
      String name, 
      String document, 
      ParameterListDeclaration parameters) 
  {
    super(location, clazz, null, sync, name, document, parameters);
  }


  public int getType()
  {
    return CONSTRUCTOR;
  }


  public void compile(ByteCompiler context)
  {
    ClassRoom clazz = context.getClassRoom();
    String name = getDescriptor();
    Field typefield = clazz.createField(name, "Lanvil/script/Function;", ACC_PUBLIC|ACC_STATIC);
    clazz.createField("M_"+_name, "Lanvil/core/Any;", ACC_PUBLIC|ACC_STATIC);
    Method method = clazz.createMethod(name, getSignature(), ACC_PUBLIC);
    compileBody(context, method, typefield);
  }


}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.