Search in sources :

Example 1 with BLangBind

use of org.wso2.ballerinalang.compiler.tree.statements.BLangBind in project ballerina by ballerina-lang.

the class SemanticAnalyzer method visit.

public void visit(BLangBind bindNode) {
    List<BType> expTypes = new ArrayList<>();
    // Check each LHS expression.
    BLangExpression varRef = bindNode.varRef;
    ((BLangVariableReference) varRef).lhsVar = true;
    expTypes.add(typeChecker.checkExpr(varRef, env).get(0));
    checkConstantAssignment(varRef);
    typeChecker.checkExpr(bindNode.expr, this.env, expTypes);
}
Also used : BType(org.wso2.ballerinalang.compiler.semantics.model.types.BType) ArrayList(java.util.ArrayList) BLangExpression(org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)

Example 2 with BLangBind

use of org.wso2.ballerinalang.compiler.tree.statements.BLangBind in project ballerina by ballerina-lang.

the class Desugar method visit.

@Override
public void visit(BLangBind bindNode) {
    bindNode.varRef = rewriteExpr(bindNode.varRef);
    bindNode.expr = rewriteExpr(bindNode.expr);
    result = new BLangAssignment(bindNode.pos, Arrays.asList(bindNode.varRef), bindNode.expr, false);
}
Also used : BLangAssignment(org.wso2.ballerinalang.compiler.tree.statements.BLangAssignment)

Aggregations

ArrayList (java.util.ArrayList)1 BType (org.wso2.ballerinalang.compiler.semantics.model.types.BType)1 BLangExpression (org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)1 BLangAssignment (org.wso2.ballerinalang.compiler.tree.statements.BLangAssignment)1