Package anvil.script.expression

Examples of anvil.script.expression.AssignmentNode


      code.invokeinterface(pool.addInterfaceMethodRef(clazz1, "hasMoreElements", "()Z"));
      code.if_eq(_endscope);

      if (_index != null) {
       
        new AssignmentNode(new ExpressionList(_index,
          new Node() {
            public void compile(ByteCompiler context, int operation)
            {
              _indexvar.compile(context, GET);
            }
          })).compile(context, Node.GET);
         
        code.pop();
       
        _indexvar.compile(context, new Node() {
          public void compile(ByteCompiler context, int operation)
          {
            Code code_ = context.getCode();
            _indexvar.compile(context, GET);
            code_.invokevirtual(code_.getPool().addMethodRef(context.TYPE_ANY,
              "increase", "()Lanvil/core/Any;"));
          }
        });
        code.pop();
      }

      if (_key != null) {
        new AssignmentNode(new ExpressionList(_key,
          new Node() {
            public void compile(ByteCompiler context, int operation)
            {
              Code code_ = context.getCode();
              ConstantPool pool_ = code_.getPool();
              _enumvar.compile(context, Node.GET);
              code_.invokeinterface(pool_.addInterfaceMethodRef("anvil/java/util/BindingEnumeration", "nextKey", "()Ljava/lang/Object;"));
              code_.invokestatic(pool_.addMethodRef(context.TYPE_ANY, "create", "(Ljava/lang/Object;)Lanvil/core/Any;"));
            }
          })).compile(context, Node.GET);
        code.pop();
      }


      if (_value != null) {
        new AssignmentNode(new ExpressionList(_value,
          new Node() {
            public void compile(ByteCompiler context, int operation)
            {
              Code code_ = context.getCode();
              ConstantPool pool_ = code_.getPool();
              _enumvar.compile(context, Node.GET);
              code_.invokeinterface(pool_.addInterfaceMethodRef("java/util/Enumeration", "nextElement", "()Ljava/lang/Object;"));
              code_.invokestatic(pool_.addMethodRef(context.TYPE_ANY, "create", "(Ljava/lang/Object;)Lanvil/core/Any;"));
            }
          })).compile(context, Node.GET);
        code.pop();

      } else
        _enumvar.compile(context, Node.GET);
        code.invokeinterface(pool.addInterfaceMethodRef(clazz1, "nextElement", "()Ljava/lang/Object;"));
        code.pop();

      }

      _statement.compile(context);
      code.go_to(_startscope);
      _endscope.bind();
      _startscope.bind(start);

    } else {

      final int l_enum = code.addLocal();
      final int l_index = (_index != null) ? code.addLocal() : 0;
      if (l_index != 0) {
        code.iconst(0);
        code.istore(l_index);
      }

      // create enumeration, and wrap it
      int clazz1 = pool.addClass("java/util/Enumeration");
      int clazz2 = pool.addClass("anvil/java/util/BindingEnumeration");
      _expression.compile(context, Expression.GET);
      code.invokevirtual(pool.addMethodRef(context.TYPE_ANY, "enumeration", "()Lanvil/java/util/BindingEnumeration;"));
      code.astore(l_enum);
      int sun_hack_1 = 10 + l_enum;

      Target start = code.getTarget();
      _startscope = code.getSource();
      _endscope = code.getSource();

      code.aload(l_enum);
      int sun_hack_2 = 10 + l_enum;
     
      code.invokeinterface(pool.addInterfaceMethodRef(clazz1, "hasMoreElements", "()Z"));
      code.if_eq(_endscope);

      if (_index != null) {
        new AssignmentNode(new ExpressionList(_index,
          new Node() {
            public void compile(ByteCompiler context, int operation)
            {
              Code code_ = context.getCode();
              code_.iload(l_index);
              code_.iinc(l_index, 1);
              code_.invokestatic(code_.getPool().addMethodRef(
                context.TYPE_ANY, "create", "(I)Lanvil/core/Any;"));
            }
          })).compile(context, Node.GET);
        code.pop();
      }

      if (_key != null) {
        new AssignmentNode(new ExpressionList(_key,
          new Node() {
            public void compile(ByteCompiler context, int operation)
            {
              Code code_ = context.getCode();
              ConstantPool pool_ = code_.getPool();
              code_.aload(l_enum);
              code_.invokeinterface(pool_.addInterfaceMethodRef("anvil/java/util/BindingEnumeration", "nextKey", "()Ljava/lang/Object;"));
              code_.invokestatic(pool_.addMethodRef(context.TYPE_ANY, "create", "(Ljava/lang/Object;)Lanvil/core/Any;"));
            }
          })).compile(context, Node.GET);
        code.pop();
      }

      if (_value != null) {
        new AssignmentNode(new ExpressionList(_value,
          new Node() {
            public void compile(ByteCompiler context, int operation)
            {
              Code code_ = context.getCode();
              ConstantPool pool_ = code_.getPool();
View Full Code Here


 
 
  public Expression createStaticInitializer()
  {
    Location location = _expression.getLocation();
    AssignmentNode assignment = new AssignmentNode(location, 2);
    assignment.setChild(0, new StaticVariableNode(this));
    assignment.setChild(1, new ConstantNode(getValue()));
    return new Expression(assignment, location);
  }
View Full Code Here

 
 
  public Expression createInitializer()
  {
    Location location = _expression.getLocation();
    AssignmentNode assignment = new AssignmentNode(location, 2);
    assignment.setChild(0, new StaticVariableNode(this));
    assignment.setChild(1, _expression.getChild());
    return new Expression(assignment, location);
  }
View Full Code Here

    List(false, false);
    Location location = toLocation(op);
    Parent assignment = null;
    switch(op.kind) {
    case ASSIGN:
      assignment = new AssignmentNode(location, count + 1);
      break;
    case ASSIGN_ADD:
      assignment = new AdditionAssignmentNode(location, count + 1);
      break;
    case ASSIGN_SUBSTRACT:
View Full Code Here

    case PATTERN:
      ArrayArgument();
      FunctionStatement function = flowPeek().getFunctionStatement();
      VariableNode var = new VariableNode(function.declare("array$"+root.hashCode()));
      Location location = parent.getLocation();
      AssignmentNode assign = new AssignmentNode(location, 2);
      assign.setChild(0, new EmptyReferenceNode(var));
      assign.setChild(1, pop());
      parent.setChildStatement(new EvalStatement(parent, location,
        new Expression(assign, location)));
      compr.init(root, var);
      break;
    default:
View Full Code Here

 

  public Expression createInitializer()
  {
    Location location = _expression.getLocation();
    AssignmentNode assignment = new AssignmentNode(location, 2);
    assignment.setChild(0, new MemberVariableNode(_classtype, _classtype, this));
    assignment.setChild(1, _expression.getChild());
    return new Expression(assignment, location);
  }
View Full Code Here

 

  public Expression createStaticInitializer()
  {
    Location location = _expression.getLocation();
    AssignmentNode assignment = new AssignmentNode(location, 2);
    assignment.setChild(0,new ConstantVariableNode(this));
    assignment.setChild(1, new ConstantNode(getValue()));
    return new Expression(assignment, location);
  }
View Full Code Here


  public Expression createInitializer()
  {
    Location location = _expression.getLocation();
    AssignmentNode assignment = new AssignmentNode(location, 2);
    assignment.setChild(0, new ConstantVariableNode(this));
    assignment.setChild(1, _expression.getChild());
    return new Expression(assignment, location);
  }
View Full Code Here

TOP

Related Classes of anvil.script.expression.AssignmentNode

Copyright © 2018 www.massapicom. 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.