Search in sources :

Example 31 with BLangIdentifier

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

the class BLangPackageBuilder method addUserDefineType.

public void addUserDefineType(Set<Whitespace> ws) {
    BLangNameReference nameReference = nameReferenceStack.pop();
    BLangUserDefinedType userDefinedType = createUserDefinedType(nameReference.pos, ws, (BLangIdentifier) nameReference.pkgAlias, (BLangIdentifier) nameReference.name);
    userDefinedType.addWS(nameReference.ws);
    addType(userDefinedType);
}
Also used : BLangNameReference(org.wso2.ballerinalang.compiler.tree.BLangNameReference) BLangUserDefinedType(org.wso2.ballerinalang.compiler.tree.types.BLangUserDefinedType)

Example 32 with BLangIdentifier

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

the class BLangPackageBuilder method addServiceEndpointAttachments.

public void addServiceEndpointAttachments(int size, Set<Whitespace> ws) {
    ServiceNode serviceNode = serviceNodeStack.peek();
    serviceNode.addWS(ws);
    for (int i = 0; i < size; i++) {
        BLangNameReference nameReference = nameReferenceStack.pop();
        BLangSimpleVarRef varRef = (BLangSimpleVarRef) TreeBuilder.createSimpleVariableReferenceNode();
        varRef.pos = nameReference.pos;
        varRef.addWS(nameReference.ws);
        varRef.pkgAlias = (BLangIdentifier) nameReference.pkgAlias;
        varRef.variableName = (BLangIdentifier) nameReference.name;
        serviceNode.bindToEndpoint(varRef);
    }
}
Also used : ServiceNode(org.ballerinalang.model.tree.ServiceNode) BLangSimpleVarRef(org.wso2.ballerinalang.compiler.tree.expressions.BLangSimpleVarRef) BLangNameReference(org.wso2.ballerinalang.compiler.tree.BLangNameReference) BLangAnnotationAttachmentPoint(org.wso2.ballerinalang.compiler.tree.BLangAnnotationAttachmentPoint) BLangEndpoint(org.wso2.ballerinalang.compiler.tree.BLangEndpoint)

Example 33 with BLangIdentifier

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

the class BLangPackageBuilder method addAnonObjectType.

public void addAnonObjectType(DiagnosticPos pos, Set<Whitespace> ws) {
    // Generate a name for the anonymous struct
    String genName = anonymousModelHelper.getNextAnonymousStructKey(pos.src.pkgID);
    IdentifierNode anonStructGenName = createIdentifier(genName);
    // Create an anonymous struct and add it to the list of structs in the current package.
    BLangStruct structNode = populateStructNode(pos, ws, anonStructGenName, true);
    this.compUnit.addTopLevelNode(structNode);
    addType(createUserDefinedType(pos, ws, (BLangIdentifier) TreeBuilder.createIdentifierNode(), structNode.name));
}
Also used : IdentifierNode(org.ballerinalang.model.tree.IdentifierNode) BLangStruct(org.wso2.ballerinalang.compiler.tree.BLangStruct) BLangXMLQuotedString(org.wso2.ballerinalang.compiler.tree.expressions.BLangXMLQuotedString) BLangIdentifier(org.wso2.ballerinalang.compiler.tree.BLangIdentifier)

Example 34 with BLangIdentifier

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

the class BLangPackageBuilder method createActionInvocationNode.

public void createActionInvocationNode(DiagnosticPos pos, Set<Whitespace> ws, boolean async) {
    BLangInvocation invocationExpr = (BLangInvocation) exprNodeStack.pop();
    invocationExpr.actionInvocation = true;
    invocationExpr.pos = pos;
    invocationExpr.addWS(ws);
    invocationExpr.async = async;
    BLangNameReference nameReference = nameReferenceStack.pop();
    BLangSimpleVarRef varRef = (BLangSimpleVarRef) TreeBuilder.createSimpleVariableReferenceNode();
    varRef.pos = nameReference.pos;
    varRef.addWS(nameReference.ws);
    varRef.pkgAlias = (BLangIdentifier) nameReference.pkgAlias;
    varRef.variableName = (BLangIdentifier) nameReference.name;
    invocationExpr.expr = varRef;
    exprNodeStack.push(invocationExpr);
}
Also used : BLangSimpleVarRef(org.wso2.ballerinalang.compiler.tree.expressions.BLangSimpleVarRef) BLangNameReference(org.wso2.ballerinalang.compiler.tree.BLangNameReference) BLangInvocation(org.wso2.ballerinalang.compiler.tree.expressions.BLangInvocation)

Example 35 with BLangIdentifier

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

the class BLangPackageBuilder method createSimpleVariableReference.

public void createSimpleVariableReference(DiagnosticPos pos, Set<Whitespace> ws) {
    BLangNameReference nameReference = nameReferenceStack.pop();
    BLangSimpleVarRef varRef = (BLangSimpleVarRef) TreeBuilder.createSimpleVariableReferenceNode();
    varRef.pos = pos;
    varRef.addWS(ws);
    varRef.addWS(nameReference.ws);
    varRef.pkgAlias = (BLangIdentifier) nameReference.pkgAlias;
    varRef.variableName = (BLangIdentifier) nameReference.name;
    this.exprNodeStack.push(varRef);
}
Also used : BLangSimpleVarRef(org.wso2.ballerinalang.compiler.tree.expressions.BLangSimpleVarRef) BLangNameReference(org.wso2.ballerinalang.compiler.tree.BLangNameReference)

Aggregations

BLangIdentifier (org.wso2.ballerinalang.compiler.tree.BLangIdentifier)20 BLangNameReference (org.wso2.ballerinalang.compiler.tree.BLangNameReference)9 IdentifierNode (org.ballerinalang.model.tree.IdentifierNode)8 BLangInvocation (org.wso2.ballerinalang.compiler.tree.expressions.BLangInvocation)7 BLangSimpleVarRef (org.wso2.ballerinalang.compiler.tree.expressions.BLangSimpleVarRef)7 BLangUserDefinedType (org.wso2.ballerinalang.compiler.tree.types.BLangUserDefinedType)6 ArrayList (java.util.ArrayList)5 BLangEndpoint (org.wso2.ballerinalang.compiler.tree.BLangEndpoint)5 BLangImportPackage (org.wso2.ballerinalang.compiler.tree.BLangImportPackage)5 BVarSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BVarSymbol)4 BLangStruct (org.wso2.ballerinalang.compiler.tree.BLangStruct)4 BLangVariable (org.wso2.ballerinalang.compiler.tree.BLangVariable)4 BLangExpression (org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)4 BLangAssignment (org.wso2.ballerinalang.compiler.tree.statements.BLangAssignment)4 Name (org.wso2.ballerinalang.compiler.util.Name)4 SelectExpressionNode (org.ballerinalang.model.tree.clauses.SelectExpressionNode)3 ExpressionNode (org.ballerinalang.model.tree.expressions.ExpressionNode)3 BLangXMLQName (org.wso2.ballerinalang.compiler.tree.expressions.BLangXMLQName)3 List (java.util.List)2 Set (java.util.Set)2