Search in sources :

Example 11 with BLangExpression

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

the class TypeChecker method getXMLTextLiteral.

private BLangExpression getXMLTextLiteral(BLangExpression contentExpr) {
    BLangXMLTextLiteral xmlTextLiteral = (BLangXMLTextLiteral) TreeBuilder.createXMLTextLiteralNode();
    xmlTextLiteral.concatExpr = contentExpr;
    xmlTextLiteral.pos = contentExpr.pos;
    return xmlTextLiteral;
}
Also used : BLangXMLTextLiteral(org.wso2.ballerinalang.compiler.tree.expressions.BLangXMLTextLiteral)

Example 12 with BLangExpression

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

the class TypeChecker method visit.

@Override
public void visit(BLangSelectExpression selectExpression) {
    BLangExpression expr = (BLangExpression) selectExpression.getExpression();
    expr.accept(this);
}
Also used : BLangExpression(org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)

Example 13 with BLangExpression

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

the class TypeChecker method checkRestArgs.

private void checkRestArgs(List<BLangExpression> restArgExprs, BLangExpression vararg, BVarSymbol restParam) {
    if (vararg != null && !restArgExprs.isEmpty()) {
        dlog.error(vararg.pos, DiagnosticCode.INVALID_REST_ARGS);
        return;
    }
    if (vararg != null) {
        checkExpr(vararg, this.env, Lists.of(restParam.type));
        restArgExprs.add(vararg);
        return;
    }
    for (BLangExpression arg : restArgExprs) {
        checkExpr(arg, this.env, Lists.of(((BArrayType) restParam.type).eType));
    }
}
Also used : BArrayType(org.wso2.ballerinalang.compiler.semantics.model.types.BArrayType) BLangExpression(org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)

Example 14 with BLangExpression

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

the class SemanticAnalyzer method getBinaryExpr.

private BLangExpression getBinaryExpr(BLangExpression lExpr, BLangExpression rExpr, OperatorKind opKind, BSymbol opSymbol) {
    BLangBinaryExpr binaryExpressionNode = (BLangBinaryExpr) TreeBuilder.createBinaryExpressionNode();
    binaryExpressionNode.lhsExpr = lExpr;
    binaryExpressionNode.rhsExpr = rExpr;
    binaryExpressionNode.pos = rExpr.pos;
    binaryExpressionNode.opKind = opKind;
    if (opSymbol != symTable.notFoundSymbol) {
        binaryExpressionNode.type = opSymbol.type.getReturnTypes().get(0);
        binaryExpressionNode.opSymbol = (BOperatorSymbol) opSymbol;
    } else {
        binaryExpressionNode.type = symTable.errType;
    }
    return binaryExpressionNode;
}
Also used : BLangBinaryExpr(org.wso2.ballerinalang.compiler.tree.expressions.BLangBinaryExpr)

Example 15 with BLangExpression

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

the class SemanticAnalyzer method visit.

public void visit(BLangWhere whereClause) {
    ExpressionNode expressionNode = whereClause.getExpression();
    ((BLangExpression) expressionNode).accept(this);
}
Also used : SelectExpressionNode(org.ballerinalang.model.tree.clauses.SelectExpressionNode) ExpressionNode(org.ballerinalang.model.tree.expressions.ExpressionNode) BLangExpression(org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)

Aggregations

BLangExpression (org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)101 BType (org.wso2.ballerinalang.compiler.semantics.model.types.BType)27 BLangEndpoint (org.wso2.ballerinalang.compiler.tree.BLangEndpoint)26 ArrayList (java.util.ArrayList)22 BLangSimpleVarRef (org.wso2.ballerinalang.compiler.tree.expressions.BLangSimpleVarRef)19 BLangVariable (org.wso2.ballerinalang.compiler.tree.BLangVariable)15 BLangLiteral (org.wso2.ballerinalang.compiler.tree.expressions.BLangLiteral)15 SelectExpressionNode (org.ballerinalang.model.tree.clauses.SelectExpressionNode)14 ExpressionNode (org.ballerinalang.model.tree.expressions.ExpressionNode)14 RegIndex (org.wso2.ballerinalang.programfile.Instruction.RegIndex)14 BSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BSymbol)13 BVarSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BVarSymbol)11 BLangArrayLiteral (org.wso2.ballerinalang.compiler.tree.expressions.BLangArrayLiteral)11 BLangRecordLiteral (org.wso2.ballerinalang.compiler.tree.expressions.BLangRecordLiteral)11 BLangTypeConversionExpr (org.wso2.ballerinalang.compiler.tree.expressions.BLangTypeConversionExpr)11 SymbolEnv (org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv)10 BLangInvocation (org.wso2.ballerinalang.compiler.tree.expressions.BLangInvocation)10 BLangXMLQName (org.wso2.ballerinalang.compiler.tree.expressions.BLangXMLQName)10 BLangXMLQuotedString (org.wso2.ballerinalang.compiler.tree.expressions.BLangXMLQuotedString)10 BLangAssignment (org.wso2.ballerinalang.compiler.tree.statements.BLangAssignment)10