Search in sources :

Example 11 with BLangVariableReference

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

the class BLangPackageBuilder method createFieldBasedAccessNode.

public void createFieldBasedAccessNode(DiagnosticPos pos, Set<Whitespace> ws, String fieldName, FieldType fieldType) {
    BLangFieldBasedAccess fieldBasedAccess = (BLangFieldBasedAccess) TreeBuilder.createFieldBasedAccessNode();
    fieldBasedAccess.pos = pos;
    fieldBasedAccess.addWS(ws);
    fieldBasedAccess.field = (BLangIdentifier) createIdentifier(fieldName);
    fieldBasedAccess.expr = (BLangVariableReference) exprNodeStack.pop();
    fieldBasedAccess.fieldType = fieldType;
    addExpressionNode(fieldBasedAccess);
}
Also used : BLangFieldBasedAccess(org.wso2.ballerinalang.compiler.tree.expressions.BLangFieldBasedAccess)

Example 12 with BLangVariableReference

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

the class BLangPackageBuilder method createIndexBasedAccessNode.

public void createIndexBasedAccessNode(DiagnosticPos pos, Set<Whitespace> ws) {
    BLangIndexBasedAccess indexBasedAccess = (BLangIndexBasedAccess) TreeBuilder.createIndexBasedAccessNode();
    indexBasedAccess.pos = pos;
    indexBasedAccess.addWS(ws);
    indexBasedAccess.indexExpr = (BLangExpression) exprNodeStack.pop();
    indexBasedAccess.expr = (BLangVariableReference) exprNodeStack.pop();
    addExpressionNode(indexBasedAccess);
}
Also used : BLangIndexBasedAccess(org.wso2.ballerinalang.compiler.tree.expressions.BLangIndexBasedAccess)

Example 13 with BLangVariableReference

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

the class BLangPackageBuilder method addPostIncrementStatement.

public void addPostIncrementStatement(DiagnosticPos pos, Set<Whitespace> ws, String operator) {
    BLangPostIncrement postIncrement = (BLangPostIncrement) TreeBuilder.createPostIncrementNode();
    postIncrement.setVariable((BLangVariableReference) exprNodeStack.pop());
    postIncrement.pos = pos;
    postIncrement.addWS(ws);
    addLiteralValue(pos, ws, TypeTags.INT, Long.parseLong("1"));
    postIncrement.increment = (BLangExpression) exprNodeStack.pop();
    postIncrement.opKind = OperatorKind.valueFrom(operator);
    addStmtToCurrentBlock(postIncrement);
}
Also used : BLangPostIncrement(org.wso2.ballerinalang.compiler.tree.statements.BLangPostIncrement)

Example 14 with BLangVariableReference

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

the class TaintAnalyzer method updatedVarRefTaintedState.

private void updatedVarRefTaintedState(BLangVariableReference varRef, boolean taintedState) {
    if (varRef instanceof BLangSimpleVarRef) {
        setTaintedStatus(varRef, taintedState);
    } else if (varRef instanceof BLangIndexBasedAccess) {
        BLangIndexBasedAccess indexBasedAccessExpr = (BLangIndexBasedAccess) varRef;
        updatedVarRefTaintedState(indexBasedAccessExpr.expr, taintedState);
    } else if (varRef instanceof BLangFieldBasedAccess) {
        BLangFieldBasedAccess fieldBasedAccessExpr = (BLangFieldBasedAccess) varRef;
        updatedVarRefTaintedState(fieldBasedAccessExpr.expr, taintedState);
    }
}
Also used : BLangIndexBasedAccess(org.wso2.ballerinalang.compiler.tree.expressions.BLangIndexBasedAccess) BLangSimpleVarRef(org.wso2.ballerinalang.compiler.tree.expressions.BLangSimpleVarRef) BLangFieldBasedAccess(org.wso2.ballerinalang.compiler.tree.expressions.BLangFieldBasedAccess)

Example 15 with BLangVariableReference

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

the class SemanticAnalyzer method visit.

@Override
public void visit(BLangPatternStreamingEdgeInput patternStreamingEdgeInput) {
    BLangVariableReference streamRef = (BLangVariableReference) patternStreamingEdgeInput.getStreamReference();
    typeChecker.checkExpr(streamRef, env);
    BLangWhere where = (BLangWhere) patternStreamingEdgeInput.getWhereClause();
    if (where != null) {
        where.accept(this);
    }
}
Also used : BLangVariableReference(org.wso2.ballerinalang.compiler.tree.expressions.BLangVariableReference) BLangWhere(org.wso2.ballerinalang.compiler.tree.clauses.BLangWhere)

Aggregations

BLangVariableReference (org.wso2.ballerinalang.compiler.tree.expressions.BLangVariableReference)16 BType (org.wso2.ballerinalang.compiler.semantics.model.types.BType)8 BLangExpression (org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)8 BLangAssignment (org.wso2.ballerinalang.compiler.tree.statements.BLangAssignment)7 ArrayList (java.util.ArrayList)6 BLangFieldBasedAccess (org.wso2.ballerinalang.compiler.tree.expressions.BLangFieldBasedAccess)6 BLangSimpleVarRef (org.wso2.ballerinalang.compiler.tree.expressions.BLangSimpleVarRef)6 BSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BSymbol)5 SelectExpressionNode (org.ballerinalang.model.tree.clauses.SelectExpressionNode)4 ExpressionNode (org.ballerinalang.model.tree.expressions.ExpressionNode)4 SymbolEnv (org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv)4 BPackageSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BPackageSymbol)4 BLangBlockStmt (org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt)4 Arrays (java.util.Arrays)3 List (java.util.List)3 Map (java.util.Map)3 Stack (java.util.Stack)3 Collectors (java.util.stream.Collectors)3 CompilerPhase (org.ballerinalang.compiler.CompilerPhase)3 TreeBuilder (org.ballerinalang.model.TreeBuilder)3