Search in sources :

Example 6 with BLangNameReference

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

the class BLangPackageBuilder method setAnnotationAttachmentName.

public void setAnnotationAttachmentName(Set<Whitespace> ws, boolean hasExpr, DiagnosticPos currentPos, boolean popAnnAttachment) {
    BLangNameReference nameReference = nameReferenceStack.pop();
    BLangAnnotationAttachment bLangAnnotationAttachment = (BLangAnnotationAttachment) annotAttachmentStack.peek();
    bLangAnnotationAttachment.pos = currentPos;
    bLangAnnotationAttachment.addWS(nameReference.ws);
    bLangAnnotationAttachment.addWS(ws);
    bLangAnnotationAttachment.setAnnotationName(nameReference.name);
    bLangAnnotationAttachment.setPackageAlias(nameReference.pkgAlias);
    if (hasExpr) {
        bLangAnnotationAttachment.setExpression(exprNodeStack.pop());
    }
    if (popAnnAttachment) {
        annotAttachmentStack.pop();
    }
}
Also used : BLangNameReference(org.wso2.ballerinalang.compiler.tree.BLangNameReference) BLangAnnotationAttachment(org.wso2.ballerinalang.compiler.tree.BLangAnnotationAttachment)

Example 7 with BLangNameReference

use of org.wso2.ballerinalang.compiler.tree.BLangNameReference 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 8 with BLangNameReference

use of org.wso2.ballerinalang.compiler.tree.BLangNameReference 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 9 with BLangNameReference

use of org.wso2.ballerinalang.compiler.tree.BLangNameReference 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 10 with BLangNameReference

use of org.wso2.ballerinalang.compiler.tree.BLangNameReference 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

BLangNameReference (org.wso2.ballerinalang.compiler.tree.BLangNameReference)11 BLangInvocation (org.wso2.ballerinalang.compiler.tree.expressions.BLangInvocation)3 BLangSimpleVarRef (org.wso2.ballerinalang.compiler.tree.expressions.BLangSimpleVarRef)3 BLangUserDefinedType (org.wso2.ballerinalang.compiler.tree.types.BLangUserDefinedType)3 Whitespace (org.ballerinalang.model.Whitespace)2 IdentifierNode (org.ballerinalang.model.tree.IdentifierNode)2 SelectExpressionNode (org.ballerinalang.model.tree.clauses.SelectExpressionNode)2 ExpressionNode (org.ballerinalang.model.tree.expressions.ExpressionNode)2 ServiceNode (org.ballerinalang.model.tree.ServiceNode)1 BLangAnnotationAttachment (org.wso2.ballerinalang.compiler.tree.BLangAnnotationAttachment)1 BLangAnnotationAttachmentPoint (org.wso2.ballerinalang.compiler.tree.BLangAnnotationAttachmentPoint)1 BLangEndpoint (org.wso2.ballerinalang.compiler.tree.BLangEndpoint)1 BLangIdentifier (org.wso2.ballerinalang.compiler.tree.BLangIdentifier)1 BLangService (org.wso2.ballerinalang.compiler.tree.BLangService)1 BLangExpression (org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)1 BLangTypeInit (org.wso2.ballerinalang.compiler.tree.expressions.BLangTypeInit)1 BLangBuiltInRefTypeNode (org.wso2.ballerinalang.compiler.tree.types.BLangBuiltInRefTypeNode)1 BLangConstrainedType (org.wso2.ballerinalang.compiler.tree.types.BLangConstrainedType)1