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);
}
// required
if(functionIndex>=INIT_FAI_KEY.length-6)_req.writeOut(bc, Expression.MODE_VALUE);
// default value
if(functionIndex>=INIT_FAI_KEY.length-5)_def.writeOut(bc, Expression.MODE_VALUE);
// pass by reference
if(functionIndex>=INIT_FAI_KEY.length-4)_pass.writeOut(bc, Expression.MODE_VALUE);
// display-name
if(functionIndex>=INIT_FAI_KEY.length-3)_dsp.writeOut(bc, Expression.MODE_REF);
// hint
if(functionIndex>=INIT_FAI_KEY.length-2)_hint.writeOut(bc, Expression.MODE_REF);
//meta
if(functionIndex==INIT_FAI_KEY.length-1)Page.createMetaDataStruct(bc,_meta,null);
if(functionIndex<INIT_FAI_KEY_LIGHT.length)
ga.invokeConstructor(FUNCTION_ARGUMENT_LIGHT, INIT_FAI_KEY[functionIndex]);