Search in sources :

Example 1 with MultiReturnExpr

use of org.wso2.ballerinalang.compiler.tree.expressions.MultiReturnExpr in project ballerina by ballerina-lang.

the class TypeChecker method setExprType.

private void setExprType(BLangExpression expr, List<BType> expTypes) {
    int expected = expTypes.size();
    if (expr instanceof MultiReturnExpr) {
        MultiReturnExpr multiReturnExpr = (MultiReturnExpr) expr;
        multiReturnExpr.setTypes(resultTypes);
    } else {
        if (expected > 1) {
            dlog.error(expr.pos, DiagnosticCode.ASSIGNMENT_COUNT_MISMATCH, expected, 1);
            resultTypes = getListWithErrorTypes(expected);
        }
    }
    if (resultTypes.size() > 0) {
        expr.type = resultTypes.get(0);
    }
}
Also used : MultiReturnExpr(org.wso2.ballerinalang.compiler.tree.expressions.MultiReturnExpr)

Aggregations

MultiReturnExpr (org.wso2.ballerinalang.compiler.tree.expressions.MultiReturnExpr)1