Search in sources :

Example 1 with AttachedFunctionInfo

use of org.ballerinalang.util.codegen.AttachedFunctionInfo in project ballerina by ballerina-lang.

the class CPU method invokeVirtualFunction.

private static WorkerExecutionContext invokeVirtualFunction(WorkerExecutionContext ctx, int receiver, FunctionInfo virtualFuncInfo, int[] argRegs, int[] retRegs, int flags) {
    BStruct structVal = (BStruct) ctx.workerLocal.refRegs[receiver];
    if (structVal == null) {
        ctx.setError(BLangVMErrors.createNullRefException(ctx));
        handleError(ctx);
        return null;
    }
    StructInfo structInfo = structVal.getType().structInfo;
    AttachedFunctionInfo attachedFuncInfo = structInfo.funcInfoEntries.get(virtualFuncInfo.getName());
    FunctionInfo concreteFuncInfo = attachedFuncInfo.functionInfo;
    return BLangFunctions.invokeCallable(concreteFuncInfo, ctx, argRegs, retRegs, false, flags);
}
Also used : BStruct(org.ballerinalang.model.values.BStruct) AttachedFunctionInfo(org.ballerinalang.util.codegen.AttachedFunctionInfo) StructInfo(org.ballerinalang.util.codegen.StructInfo) FunctionInfo(org.ballerinalang.util.codegen.FunctionInfo) AttachedFunctionInfo(org.ballerinalang.util.codegen.AttachedFunctionInfo)

Aggregations

BStruct (org.ballerinalang.model.values.BStruct)1 AttachedFunctionInfo (org.ballerinalang.util.codegen.AttachedFunctionInfo)1 FunctionInfo (org.ballerinalang.util.codegen.FunctionInfo)1 StructInfo (org.ballerinalang.util.codegen.StructInfo)1