use of org.wso2.ballerinalang.compiler.tree.expressions.BLangAwaitExpr in project ballerina by ballerina-lang.
the class TypeChecker method visit.
public void visit(BLangAwaitExpr awaitExpr) {
BType expType = checkExpr(awaitExpr.expr, env, Lists.of(this.symTable.futureType)).get(0);
if (expType == symTable.errType) {
resultTypes = Lists.of(symTable.errType);
} else {
BType constraint = ((BFutureType) expType).constraint;
resultTypes = Lists.of(constraint);
if (constraint == symTable.noType) {
resultTypes.clear();
}
}
this.checkAsyncReturnTypes(awaitExpr, resultTypes);
}
use of org.wso2.ballerinalang.compiler.tree.expressions.BLangAwaitExpr in project ballerina by ballerina-lang.
the class CodeGenerator method visit.
public void visit(BLangAwaitExpr awaitExpr) {
Operand valueRegIndex;
if (awaitExpr.type != null) {
valueRegIndex = calcAndGetExprRegIndex(awaitExpr);
} else {
valueRegIndex = this.getOperand(-1);
}
genNode(awaitExpr.expr, this.env);
Operand futureRegIndex = awaitExpr.expr.regIndex;
this.emit(InstructionCodes.AWAIT, futureRegIndex, valueRegIndex);
}
use of org.wso2.ballerinalang.compiler.tree.expressions.BLangAwaitExpr in project ballerina by ballerina-lang.
the class BLangPackageBuilder method createAwaitExpr.
public void createAwaitExpr(DiagnosticPos pos, Set<Whitespace> ws) {
BLangAwaitExpr awaitExpr = (BLangAwaitExpr) TreeBuilder.createAwaitExpressionNode();
awaitExpr.pos = pos;
awaitExpr.addWS(ws);
awaitExpr.expr = (BLangExpression) exprNodeStack.pop();
addExpressionNode(awaitExpr);
}
Aggregations