Package railo.transformer.bytecode.visitor

Examples of railo.transformer.bytecode.visitor.ArrayVisitor


    boolean allLiteral=true;
    for(int i=0;i<arr.length;i++){
      if(!(arr[i].getName() instanceof Literal)) allLiteral=false;
    }
   
    ArrayVisitor av=new ArrayVisitor();
    if(!allLiteral) {
      // String Array
          av.visitBegin(adapter,Types.STRING,arr.length);
          for(int i=0;i<arr.length;i++){
        av.visitBeginItem(adapter, i);
          arr[i].getName().writeOut(bc, MODE_REF);
        av.visitEndItem(adapter);
          }
    }
    else {
      // Collection.Key Array
          av.visitBegin(adapter,Types.COLLECTION_KEY,arr.length);
          for(int i=0;i<arr.length;i++){
        av.visitBeginItem(adapter, i);
          Variable.registerKey(bc, arr[i].getName());
        av.visitEndItem(adapter);
          }
    }
        av.visitEnd();
   
       
        // allowNull
        //adapter.push(false);
   
View Full Code Here


       //ComponentController.invoke(name, args);
            // name
            adapter.push(udf.getFunctionName());
           
            // args
            ArrayVisitor av=new ArrayVisitor();
            av.visitBegin(adapter,Types.OBJECT,types.length);
            for(int y=0;y<types.length;y++){
          av.visitBeginItem(adapter, y);
            adapter.loadArg(y);
          av.visitEndItem(bc.getAdapter());
            }
            av.visitEnd();
            adapter.invokeStatic(COMPONENT_CONTROLLER, INVOKE);
            adapter.checkCast(rtnType);
           
            //ASMConstants.NULL(adapter);
            adapter.returnValue();
View Full Code Here

        RefInteger startIndex=new RefIntegerImpl();
      _writeOutFirst(bc, (members.get(0)),mode,count==1,true,defaultValue,startIndex);
   
      // keys
      Iterator<Member> it = members.iterator();
      ArrayVisitor av=new ArrayVisitor();
      av.visitBegin(adapter,Types.COLLECTION_KEY,countDM-startIndex.toInt());
      int index=0, i=0;
        while(it.hasNext()) {
          DataMember member=(DataMember) it.next();
          if(i++<startIndex.toInt()) continue;
      av.visitBeginItem(adapter, index++);
        registerKey(bc,member.getName());
      av.visitEndItem(bc.getAdapter());

      }
        av.visitEnd();
       
        // defaultValue
        defaultValue.writeOut(bc, MODE_REF);
       
        bc.getAdapter().invokeStatic(CALLER_UTIL, CALLER_UTIL_GET);
View Full Code Here

    if(name instanceof Variable && !((Variable)name).fromHash()) {
      GeneratorAdapter adapter = bc.getAdapter();
      String[] arr = VariableString.variableToStringArray((Variable) name,true);
      if(arr.length>1){
        form=ARRAY;
        ArrayVisitor av=new ArrayVisitor();
              av.visitBegin(adapter,Types.STRING,arr.length);
              for(int y=0;y<arr.length;y++){
            av.visitBeginItem(adapter, y);
              adapter.push(varKeyUpperCase?arr[y].toUpperCase():arr[y]);
            av.visitEndItem(bc.getAdapter());
              }
              av.visitEnd();
      }
      else {
        //VariableString.toExprString(name).writeOut(bc, MODE_REF);
        String str = VariableString.variableToString((Variable) name,true);
        name=LitString.toExprString(varKeyUpperCase?str.toUpperCase():str);
View Full Code Here

        
         // name
         adapter.push(src.getName());
        
         // arguments
         ArrayVisitor av=new ArrayVisitor();
         av.visitBegin(adapter,Types.OBJECT,typeArgs.length);
         for(int y=0;y<typeArgs.length;y++){
       av.visitBeginItem(adapter, y);
         adapter.loadArg(y);
         if(classArgs[y]==boolean.class) adapter.invokeStatic(JAVA_PROXY, _BOOLEAN);
         else if(classArgs[y]==byte.class) adapter.invokeStatic(JAVA_PROXY, _BYTE);
         else if(classArgs[y]==char.class) adapter.invokeStatic(JAVA_PROXY, _CHAR);
         else if(classArgs[y]==double.class) adapter.invokeStatic(JAVA_PROXY, _DOUBLE);
         else if(classArgs[y]==float.class) adapter.invokeStatic(JAVA_PROXY, _FLOAT);
         else if(classArgs[y]==int.class) adapter.invokeStatic(JAVA_PROXY, _INT);
         else if(classArgs[y]==long.class) adapter.invokeStatic(JAVA_PROXY, _LONG);
         else if(classArgs[y]==short.class) adapter.invokeStatic(JAVA_PROXY, _SHORT);
         else {
           adapter.invokeStatic(JAVA_PROXY, _OBJECT);
         }
        
        
       av.visitEndItem(adapter);
         }
         av.visitEnd();
         adapter.invokeStatic(JAVA_PROXY, CALL);
        
       //JavaProxy.to...(...);
         int rtn=Opcodes.IRETURN;
         if(classRtn==boolean.class)   adapter.invokeStatic(JAVA_PROXY, TO_BOOLEAN);
View Full Code Here

      FieldVisitor fv = cw.visitField(Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL,
          "imports", "[Lrailo/runtime/component/ImportDefintion;", null, null);
      fv.visitEnd();
   
      constrAdapter.visitVarInsn(Opcodes.ALOAD, 0);
      ArrayVisitor av=new ArrayVisitor();
      av.visitBegin(constrAdapter,Types.IMPORT_DEFINITIONS,imports.size());
      int index=0;
      Iterator<String> it = imports.iterator();
      while(it.hasNext()){
        av.visitBeginItem(constrAdapter,index++);
        constrAdapter.push(it.next());
        ASMConstants.NULL(constrAdapter);
        constrAdapter.invokeStatic(Types.IMPORT_DEFINITIONS_IMPL, ID_GET_INSTANCE);
        av.visitEndItem(constrAdapter);
      }
      av.visitEnd();
      constrAdapter.visitFieldInsn(Opcodes.PUTFIELD, name, "imports", "[Lrailo/runtime/component/ImportDefintion;");
       
    }
       
       
View Full Code Here

        adapter.cast(currType, TAG);
       
        ///
        Map missings = tag.getMissingAttributes();
        if(missings.size()>0) {
          ArrayVisitor av=new ArrayVisitor();
                av.visitBegin(adapter,MISSING_ATTRIBUTE,missings.size());
                Map.Entry entry;
                int count=0;
                Iterator it = missings.entrySet().iterator();
                while(it.hasNext()){
                  entry=(Entry) it.next();
              av.visitBeginItem(adapter, count++);
                Variable.registerKey(bc, LitString.toExprString((String)entry.getKey()));
                adapter.push((String)entry.getValue());
                adapter.invokeStatic(MISSING_ATTRIBUTE, NEW_INSTANCE_MAX);
              av.visitEndItem(bc.getAdapter());
                }
                av.visitEnd();
        }
        else {
          ASMConstants.NULL(adapter);
        }
        ///
View Full Code Here

    this.arr=arr;
  }
 
  public Type _writeOut(BytecodeContext bc, int mode) throws BytecodeException {
    GeneratorAdapter adapter = bc.getAdapter();
    ArrayVisitor av=new ArrayVisitor();
        av.visitBegin(adapter,Types.STRING,arr.length);
        for(int y=0;y<arr.length;y++){
      av.visitBeginItem(adapter, y);
        adapter.push(arr[y]);
      av.visitEndItem(bc.getAdapter());
        }
        av.visitEnd();
        return Types.STRING_ARRAY;
  }
View Full Code Here

    this.arr=arr;
  }
 
  public Type _writeOut(BytecodeContext bc, int mode) throws BytecodeException {
    GeneratorAdapter adapter = bc.getAdapter();
    ArrayVisitor av=new ArrayVisitor();
        av.visitBegin(adapter,Types.COLLECTION_KEY,arr.length);
        for(int y=0;y<arr.length;y++){
      av.visitBeginItem(adapter, y);
        new CollectionKey(arr[y])._writeOut(bc, mode);
        //adapter.push(arr[y]);
      av.visitEndItem(bc.getAdapter());
        }
        av.visitEnd();
        return Types.COLLECTION_KEY_ARRAY;
  }
View Full Code Here

TOP

Related Classes of railo.transformer.bytecode.visitor.ArrayVisitor

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.