Package anvil.codec

Examples of anvil.codec.Code.invokevirtual()


  public void compile(ByteCompiler context, int operation)
  {
    _left.compile(context, CHECK);
    Code code = context.getCode();
    code.dup();
    code.invokevirtual(code.getPool().addMethodRef(context.TYPE_ANY,
      "toBoolean", "()Z"));
    Source iftrue = code.if_ne();
    code.pop();
    _right.compile(context, GET);
    iftrue.bind();
View Full Code Here


    ConstantPool pool = code.getPool();
    code.aload_first();
    FunctionStatement function = getFunctionStatement();
    if (function.isGenerator()) {
      code.aload(function.getFrameIndex());
      code.invokevirtual(pool.addMethodRef("anvil/script/Generator", "setClosedState", "()V"));
    }
    _expression.compile(context, Expression.GET);
    code.invokevirtual(pool.addMethodRef(context.TYPE_CONTEXT,
      "exception", "(Lanvil/core/Any;)Lanvil/script/ScriptException;"));
    code.athrow();
View Full Code Here

    if (function.isGenerator()) {
      code.aload(function.getFrameIndex());
      code.invokevirtual(pool.addMethodRef("anvil/script/Generator", "setClosedState", "()V"));
    }
    _expression.compile(context, Expression.GET);
    code.invokevirtual(pool.addMethodRef(context.TYPE_CONTEXT,
      "exception", "(Lanvil/core/Any;)Lanvil/script/ScriptException;"));
    code.athrow();
 
 
   
View Full Code Here

        }
        Node child = _types.getChild(i);
        if (child.typeOf() == Node.EXPR_TYPE) {
          code.aload(l_data);
          child.compile(context, Node.GET_TYPE);
          code.invokevirtual(pool.addMethodRef(context.TYPE_ANY, "isInstanceOf", "(Lanvil/script/Type;)Z"));
        } else {
          child.compile(context, Node.GET_BOOLEAN);
        }
        isfalse = code.if_eq();
        code.go_to(istrue);
View Full Code Here

    ConstantPool pool = code.getPool();
    if (_local.isEscaped()) {
      code.aload(_local.getFrameIndex());
      code.iconst(_local.getSlot());
      child.compile(context, GET);
      code.invokevirtual(code.getPool().addMethodRef("anvil/script/StackFrame",
        "setLocal", "(ILanvil/core/Any;)Lanvil/core/Any;"));
    } else {
      child.compile(context, GET);
      code.dup();
      code.astore(_local.getIndex());
View Full Code Here

      switch(operation) {
      case GET:
      case CHECK:
        code.aload(_local.getFrameIndex());
        code.iconst(_local.getSlot());
        code.invokevirtual(code.getPool().addMethodRef("anvil/script/StackFrame", "getLocal", "(I)Lanvil/core/Any;"));
        break;

      case GET_REF:
        int refclass = pool.addClass("anvil/core/AnyLocalRef");
        code.anew(refclass);
View Full Code Here

        break;

      case GET_BOOLEAN:
        code.aload(_local.getFrameIndex());
        code.iconst(_local.getSlot());
        code.invokevirtual(code.getPool().addMethodRef("anvil/script/StackFrame", "getLocal", "(I)Lanvil/core/Any;"));
        context.any2boolean();
        break;

      case DELETE:
        code.iconst(false);
View Full Code Here

              context.location(expr.getLocation());     
            }
            code.aload_first();
            if (_conversions == 0) {
              expr.compile(context, Expression.GET);
              code.invokevirtual(code.getPool().addMethodRef(context.TYPE_CONTEXT,
                newline ? "println" : "print" , "(Lanvil/core/Any;)V"));
            } else {
              _converters.compile(context, expr);
              code.invokevirtual(code.getPool().addMethodRef(context.TYPE_CONTEXT,
                newline ? "println" : "print" , "(Ljava/lang/String;)V"));
View Full Code Here

              expr.compile(context, Expression.GET);
              code.invokevirtual(code.getPool().addMethodRef(context.TYPE_CONTEXT,
                newline ? "println" : "print" , "(Lanvil/core/Any;)V"));
            } else {
              _converters.compile(context, expr);
              code.invokevirtual(code.getPool().addMethodRef(context.TYPE_CONTEXT,
                newline ? "println" : "print" , "(Ljava/lang/String;)V"));
            }
          }
        }
      } else if (_newline) {
View Full Code Here

            }
          }
        }
      } else if (_newline) {
        code.aload_first();
        code.invokevirtual(code.getPool().addMethodRef(context.TYPE_CONTEXT, "println", "()V"));
      }
    }
  }

View Full Code Here

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.