use of org.wso2.ballerinalang.compiler.tree.expressions.BLangInvocation.BLangActionInvocation in project ballerina by ballerina-lang.
the class CodeGenerator method visit.
public void visit(BLangActionInvocation aIExpr) {
BInvokableSymbol actionSymbol = (BInvokableSymbol) aIExpr.symbol;
int pkgRefCPIndex = addPackageRefCPEntry(currentPkgInfo, actionSymbol.pkgID);
int actionNameCPIndex = addUTF8CPEntry(currentPkgInfo, actionSymbol.name.value);
ActionRefCPEntry actionRefCPEntry = new ActionRefCPEntry(pkgRefCPIndex, actionNameCPIndex);
int actionRefCPIndex = currentPkgInfo.addCPEntry(actionRefCPEntry);
Operand[] operands = getFuncOperands(aIExpr, actionRefCPIndex);
emit(InstructionCodes.ACALL, operands);
}
use of org.wso2.ballerinalang.compiler.tree.expressions.BLangInvocation.BLangActionInvocation in project ballerina by ballerina-lang.
the class Desugar method visit.
@Override
public void visit(BLangInvocation iExpr) {
BLangInvocation genIExpr = iExpr;
// Reorder the arguments to match the original function signature.
reorderArguments(iExpr);
iExpr.requiredArgs = rewriteExprs(iExpr.requiredArgs);
iExpr.namedArgs = rewriteExprs(iExpr.namedArgs);
iExpr.restArgs = rewriteExprs(iExpr.restArgs);
if (iExpr.functionPointerInvocation) {
visitFunctionPointerInvocation(iExpr);
return;
} else if (iExpr.iterableOperationInvocation) {
visitIterableOperationInvocation(iExpr);
return;
}
if (iExpr.actionInvocation) {
visitActionInvocationEndpoint(iExpr);
}
iExpr.expr = rewriteExpr(iExpr.expr);
result = genIExpr;
if (iExpr.expr == null) {
return;
}
switch(iExpr.expr.type.tag) {
case TypeTags.BOOLEAN:
case TypeTags.STRING:
case TypeTags.INT:
case TypeTags.FLOAT:
case TypeTags.BLOB:
case TypeTags.JSON:
case TypeTags.XML:
case TypeTags.MAP:
case TypeTags.TABLE:
case TypeTags.STREAM:
case TypeTags.FUTURE:
case TypeTags.STRUCT:
List<BLangExpression> argExprs = new ArrayList<>(iExpr.requiredArgs);
argExprs.add(0, iExpr.expr);
final BLangAttachedFunctionInvocation attachedFunctionInvocation = new BLangAttachedFunctionInvocation(iExpr.pos, argExprs, iExpr.namedArgs, iExpr.restArgs, iExpr.symbol, iExpr.types, iExpr.expr, iExpr.async);
attachedFunctionInvocation.actionInvocation = iExpr.actionInvocation;
result = attachedFunctionInvocation;
break;
case TypeTags.CONNECTOR:
List<BLangExpression> actionArgExprs = new ArrayList<>(iExpr.requiredArgs);
actionArgExprs.add(0, iExpr.expr);
result = new BLangActionInvocation(iExpr.pos, actionArgExprs, iExpr.namedArgs, iExpr.restArgs, iExpr.symbol, iExpr.types, iExpr.async);
break;
}
}
Aggregations