Package anvil.script.expression

Source Code of anvil.script.expression.ForeachNode

/*
* $Id: ForeachNode.java,v 1.3 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.ErrorListener;
import anvil.Location;
import anvil.core.Any;
import anvil.codec.Code;
import anvil.codec.ConstantPool;
import anvil.script.compiler.ByteCompiler;
import anvil.script.statements.FunctionStatement;
import anvil.script.Context;
import anvil.script.Function;
import anvil.script.Type;
import java.io.IOException;

/**
* class ForeachNode
*
* @author: Jani Lehtim�ki
*/
public class ForeachNode extends BinaryParent
{


  public ForeachNode(Node self, Node inline)
  {
    super(self, inline);
  }


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


  public boolean isConstant()
  {
    return false;
  }
 

  public void compile(ByteCompiler context, int operation)
  {
    Code code = context.getCode();
    ConstantPool pool = code.getPool();
   
    code.aload_first();
    _left.compile(context, GET);
    _right.compile(context, GET);
    code.invokevirtual(pool.addMethodRef(context.TYPE_CONTEXT, "foreach",
      "(Lanvil/core/Any;Lanvil/core/Any;)Lanvil/core/Any;"));

    if (operation == GET_BOOLEAN) {
      context.any2boolean();
    }
  }

}
TOP

Related Classes of anvil.script.expression.ForeachNode

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.