use of org.ballerinalang.util.codegen.ActionInfo in project ballerina by ballerina-lang.
the class BLangVMErrors method getStackFrame.
public static BStruct getStackFrame(CallableUnitInfo callableUnitInfo, int ip) {
if (callableUnitInfo == null) {
return null;
}
ProgramFile progFile = callableUnitInfo.getPackageInfo().getProgramFile();
PackageInfo runtimePackage = progFile.getPackageInfo(PACKAGE_RUNTIME);
StructInfo callStackElement = runtimePackage.getStructInfo(STRUCT_CALL_STACK_ELEMENT);
int currentIP = ip - 1;
Object[] values;
values = new Object[4];
String parentScope = "";
if (callableUnitInfo instanceof ResourceInfo) {
parentScope = ((ResourceInfo) callableUnitInfo).getServiceInfo().getName() + ".";
} else if (callableUnitInfo instanceof ActionInfo) {
parentScope = ((ActionInfo) callableUnitInfo).getConnectorInfo().getName() + ".";
}
values[0] = parentScope + callableUnitInfo.getName();
values[1] = callableUnitInfo.getPkgPath();
if (callableUnitInfo.isNative()) {
values[2] = "<native>";
values[3] = 0;
} else {
LineNumberInfo lineNumberInfo = callableUnitInfo.getPackageInfo().getLineNumberInfo(currentIP);
if (lineNumberInfo != null) {
values[2] = lineNumberInfo.getFileName();
values[3] = lineNumberInfo.getLineNumber();
}
}
return BLangVMStructs.createBStruct(callStackElement, values);
}
use of org.ballerinalang.util.codegen.ActionInfo in project ballerina by ballerina-lang.
the class CPU method invokeAction.
private static WorkerExecutionContext invokeAction(WorkerExecutionContext ctx, String actionName, int[] argRegs, int[] retRegs, int flags) {
BConnector connector = (BConnector) ctx.workerLocal.refRegs[argRegs[0]];
if (connector == null) {
ctx.setError(BLangVMErrors.createNullRefException(ctx));
handleError(ctx);
return null;
}
BConnectorType actualCon = (BConnectorType) connector.getConnectorType();
ActionInfo actionInfo = ctx.programFile.getPackageInfo(actualCon.getPackagePath()).getConnectorInfo(actualCon.getName()).getActionInfo(actionName);
return BLangFunctions.invokeCallable(actionInfo, ctx, argRegs, retRegs, false, flags);
}
Aggregations