Search in sources :

Example 1 with MethodMetaData

use of com.googlecode.aviator.code.asm.ASMCodeGenerator.MethodMetaData in project aviatorscript by killme2008.

the class InterpretCodeGenerator method onMethodInvoke.

@Override
public void onMethodInvoke(final Token<?> lookhead) {
    final MethodMetaData methodMetaData = this.methodMetaDataStack.pop();
    @SuppressWarnings("unchecked") final List<FunctionArgument> params = lookhead != null ? (List<FunctionArgument>) lookhead.getMeta(Constants.PARAMS_META, Collections.EMPTY_LIST) : Collections.<FunctionArgument>emptyList();
    if (this.instance.getOptionValue(Options.CAPTURE_FUNCTION_ARGS).bool) {
        int funcId = getNextFuncInvocationId();
        getFuncsArgs().put(funcId, Collections.unmodifiableList(params));
        methodMetaData.funcId = funcId;
    }
    emit(new SendIR(methodMetaData.methodName, methodMetaData.parameterCount, methodMetaData.token.getMeta(Constants.UNPACK_ARGS, false), methodMetaData.funcId, new SourceInfo(this.sourceFile, methodMetaData.token.getLineNo())));
}
Also used : SendIR(com.googlecode.aviator.code.interpreter.ir.SendIR) SourceInfo(com.googlecode.aviator.code.interpreter.ir.SourceInfo) MethodMetaData(com.googlecode.aviator.code.asm.ASMCodeGenerator.MethodMetaData) FunctionArgument(com.googlecode.aviator.runtime.FunctionArgument)

Example 2 with MethodMetaData

use of com.googlecode.aviator.code.asm.ASMCodeGenerator.MethodMetaData in project aviatorscript by killme2008.

the class InterpretCodeGenerator method onMethodParameter.

@Override
public void onMethodParameter(final Token<?> lookhead) {
    MethodMetaData currentMethodMetaData = this.methodMetaDataStack.peek();
    currentMethodMetaData.parameterCount++;
}
Also used : MethodMetaData(com.googlecode.aviator.code.asm.ASMCodeGenerator.MethodMetaData)

Example 3 with MethodMetaData

use of com.googlecode.aviator.code.asm.ASMCodeGenerator.MethodMetaData in project aviatorscript by killme2008.

the class InterpretCodeGenerator method onMethodName.

@Override
public void onMethodName(final Token<?> lookhead) {
    final MethodMetaData metadata = new MethodMetaData(lookhead, lookhead.getType() == TokenType.Delegate ? null : lookhead.getLexeme());
    this.methodMetaDataStack.push(metadata);
}
Also used : MethodMetaData(com.googlecode.aviator.code.asm.ASMCodeGenerator.MethodMetaData)

Aggregations

MethodMetaData (com.googlecode.aviator.code.asm.ASMCodeGenerator.MethodMetaData)3 SendIR (com.googlecode.aviator.code.interpreter.ir.SendIR)1 SourceInfo (com.googlecode.aviator.code.interpreter.ir.SourceInfo)1 FunctionArgument (com.googlecode.aviator.runtime.FunctionArgument)1