Package railo.transformer.bytecode.statement

Examples of railo.transformer.bytecode.statement.Argument


      adapter.returnValue();
      return;
    }
     
    Iterator<Argument> it = args.iterator();
    Argument arg;
    ConditionVisitor cv=new ConditionVisitor();
    DecisionIntVisitor div;
    cv.visitBefore();
    int count=0;
    while(it.hasNext()) {
      arg=it.next();
      cv.visitWhenBeforeExpr();
        div=new DecisionIntVisitor();
        div.visitBegin();
          adapter.loadArg(2);
        div.visitEQ();
          adapter.push(count++);
        div.visitEnd(bc);
      cv.visitWhenAfterExprBeforeBody(bc);
        Expression defaultValue = arg.getDefaultValue();
        if(defaultValue!=null) {
          /*if(defaultValue instanceof Null) {
            adapter.invokeStatic(NULL, GET_INSTANCE);
          }
          else*/
View Full Code Here


 
  private final void createArguments(BytecodeContext bc) throws BytecodeException {
    GeneratorAdapter ga = bc.getAdapter();
    ga.push(arguments.size());
    ga.newArray(FUNCTION_ARGUMENT);
    Argument arg;
        for (int i = 0; i < arguments.size(); i++) {
          arg= arguments.get(i);
           
          boolean canHaveKey = Variable.canRegisterKey(arg.getName());
       
      // CHECK if default values
        // type
        ExprString _strType = arg.getType();
        short _type=CFTypes.TYPE_UNKNOW;
        if(_strType instanceof LitString){
          _type=CFTypes.toShortStrict(((LitString)_strType).getString(),CFTypes.TYPE_UNKNOW);
        }
        boolean useType=!canHaveKey || _type!=CFTypes.TYPE_ANY;
        //boolean useStrType=useType && (_type==CFTypes.TYPE_UNDEFINED || _type==CFTypes.TYPE_UNKNOW || CFTypes.toString(_type, null)==null);
       
        // required
        ExprBoolean _req = arg.getRequired();
        boolean useReq=!canHaveKey || toBoolean(_req,null)!=Boolean.FALSE;
       
        // default-type
        Expression _def = arg.getDefaultValueType();
        boolean useDef=!canHaveKey || toInt(_def,-1)!=FunctionArgument.DEFAULT_TYPE_NULL;
       
        // pass by reference
        ExprBoolean _pass = arg.isPassByReference();
        boolean usePass=!canHaveKey || toBoolean(_pass,null)!=Boolean.TRUE;
       
        // display-hint
        ExprString _dsp = arg.getDisplayName();
        boolean useDsp=!canHaveKey || !isLiteralEmptyString(_dsp);
       
        // hint
        ExprString _hint = arg.getHint();
        boolean useHint=!canHaveKey || !isLiteralEmptyString(_hint);
       
        // meta
        Map _meta = arg.getMetaData();
        boolean useMeta=!canHaveKey || (_meta!=null && !_meta.isEmpty());
        int functionIndex=7;
        if(!useMeta) {
          functionIndex--;
          if(!useHint) {
            functionIndex--;
            if(!useDsp){
                functionIndex--;
                if(!usePass) {
                  functionIndex--;
                  if(!useDef) {
                    functionIndex--;
                    if(!useReq) {
                      functionIndex--;
                      if(!useType){
                        functionIndex--;
                      }
                    }
                  }
                }
            }
          }
        }
      // write out arguments 
        ga.dup();
            ga.push(i);
             
            // new FunctionArgument(...)
            ga.newInstance(canHaveKey && functionIndex<INIT_FAI_KEY_LIGHT.length?FUNCTION_ARGUMENT_LIGHT:FUNCTION_ARGUMENT_IMPL);
        ga.dup();
        Variable.registerKey(bc,arg.getName(),false);
       
        // type
        if(functionIndex>=INIT_FAI_KEY.length-7) {
          _strType.writeOut(bc, Expression.MODE_REF);
          bc.getAdapter().push(_type);
View Full Code Here

        LitString.EMPTY,null);
  }

  public final void addArgument(Expression name, Expression type, Expression required, Expression defaultValue,ExprBoolean passByReference,
      Expression displayName, Expression hint,Map meta) {
    arguments.add(new Argument(name,type,required,defaultValue,passByReference,displayName,hint,meta));
  }
View Full Code Here

TOP

Related Classes of railo.transformer.bytecode.statement.Argument

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.