Package anvil.codec

Examples of anvil.codec.ConstantPool.addFieldRef()


    if (_context != null) {
      code.aload(_context.getFrameIndex());
    } else {
      code.aconst_null();
    }
    code.getstatic(pool.addFieldRef(_thunk.getParent().getTypeRef(pool), name, "Lanvil/script/Function;"));
    if (inclass) {
      code.self();
    }
    code.invokespecial(pool.addMethodRef(clazz, "<init>", signature));
View Full Code Here


    if (needloop) {
      if (_init != null) {
        _init.compile(context, Node.GET);
      } else {
        code.getstatic(pool.addFieldRef(context.TYPE_ANY, "UNDEFINED",
          "Lanvil/core/Any;"));
      }
      code.dup();

      int contextframe = pool.addMethodRef(context.TYPE_CONTEXT, "frame",
View Full Code Here

      code.self();
    }
   
    int parent = _function.getParent().getTypeRef(pool);
    String name = (inClass ? "m_" : "f_")+_function.getName();
    int field = pool.addFieldRef(parent, name, "Lanvil/script/Function;");
    code.getstatic(field);
   
    int depth = Grammar.countEscapeDepth(_context, _function);
    code.aload(_context.getFrameIndex());
    if (depth >= 0) {
View Full Code Here

    Field bases = clazz.createField("_bases", "[Ljava/lang/String;", Code.ACC_PUBLIC|Code.ACC_STATIC);
    Code code = clazz.getStatic().getCode();
    context.pushCode(code);

    //code.println("INTERFACE-START:"+getDescriptor());
    code.getstatic(pool.addFieldRef(_parent.getDescriptor(),
      "_members", "[Ljava/lang/Object;"));
    code.pop();

    int n = _bases.length;
    code.iconst(n);
View Full Code Here

    ConstantPool pool = code.getPool();
    int anyfunction = pool.addClass("anvil/core/runtime/AnyFunction");
    code.anew(anyfunction);
    code.dup();
    int parent = _function.getParent().getTypeRef(pool);
    int field = pool.addFieldRef(parent, name, "Lanvil/script/Function;");
    if (in_class) {
      code.self();
    }
    code.getstatic(field);
    code.aload(_context.getFrameIndex());
View Full Code Here

    ConstantPool pool = code.getPool();
    if (_type instanceof NativeJava) {
      switch(_type.getType()) {
      case Type.FUNCTION:
        {
          code.getstatic(pool.addFieldRef(_type.getParent().getTypeRef(pool),
            "__module__", "Lanvil/script/compiler/NativeNamespace;"));
          code.aload_first();
          code.astring(_type.getName())
          int method;
          if (get_type) {
View Full Code Here

        }
        break;

      case Type.CLASS:
        {
          code.getstatic(pool.addFieldRef(_type.getTypeRef(pool),
            "__class__", "Lanvil/script/compiler/NativeClass;"));
          if (!get_type) {
            code.invokevirtual(pool.addMethodRef("anvil/script/compiler/NativeClass",
              "getWrapper", "()Lanvil/core/Any;"));
          }
View Full Code Here

        }
        break;
       
      case Type.NAMESPACE:
        {
          code.getstatic(pool.addFieldRef(_type.getTypeRef(pool),
            "__module__", "Lanvil/script/compiler/NativeNamespace;"));
          if (!get_type) {
            code.invokevirtual(pool.addMethodRef("anvil/script/compiler/NativeNamespace",
              "getWrapper", "()Lanvil/core/Any;"));         
          }
View Full Code Here

        }
        break;
       
      case Type.METHOD:
        {
          code.getstatic(pool.addFieldRef(_type.getParent().getTypeRef(pool),
            "__class__", "Lanvil/script/compiler/NativeClass;"));
          int method;
          code.aload_first();
          code.astring(_type.getName())
          if (get_type) {
View Full Code Here

     
    } else {
      switch(_type.getType()) {
      case Type.FUNCTION:
        {
          int field = pool.addFieldRef(_type.getParent().getTypeRef(pool),
            (get_type ? "f_" : "F_") + _type.getName(),
             get_type ? "Lanvil/script/Function;" : "Lanvil/core/Any;");
          code.getstatic(field);
        }
        break;
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.