Package anvil.script.statements

Source Code of anvil.script.statements.ParameterStatement

/*
* $Id: ParameterStatement.java,v 1.3 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.Code;
import anvil.script.ParameterType;
import anvil.script.compiler.ByteCompiler;
import java.io.IOException;

/**
* class ParameterType
*
* @author: Jani Lehtim�ki
*/
public class ParameterStatement extends LocalVariableStatement implements ParameterType
{
  public ParameterStatement(Location location, FunctionStatement parent, String name)
  {
    super(location, parent, name);
  }

  public int getType()
  {
    return FUNCTION_PARAMETER;
  }


  public void compile(ByteCompiler context)
  {
    if (_escaped) {
      FunctionStatement function = (FunctionStatement)_parent;
      Code code = context.getCode();
      code.aload(function.getFrameIndex());
      code.iconst(getSlot());
      code.aload(_index);
      code.invokevirtual(code.getPool().addMethodRef(context.TYPE_STACKFRAME,
        "setLocal", "(ILanvil/core/Any;)Lanvil/core/Any;"));
      code.pop();
    }
  }


  public void compileInit(ByteCompiler context)
  {
    Code code = context.getCode();
    _index = code.addLocal();
  }


}
TOP

Related Classes of anvil.script.statements.ParameterStatement

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.