Search in sources :

Example 6 with BLangType

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

the class BLangPackageBuilder method createTypeAccessExpr.

public void createTypeAccessExpr(DiagnosticPos pos, Set<Whitespace> ws) {
    BLangTypeofExpr typeAccessExpr = (BLangTypeofExpr) TreeBuilder.createTypeAccessNode();
    typeAccessExpr.pos = pos;
    typeAccessExpr.addWS(ws);
    typeAccessExpr.typeNode = (BLangType) typeNodeStack.pop();
    addExpressionNode(typeAccessExpr);
}
Also used : BLangTypeofExpr(org.wso2.ballerinalang.compiler.tree.expressions.BLangTypeofExpr)

Example 7 with BLangType

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

the class BLangPackageBuilder method endAnnotationDef.

public void endAnnotationDef(Set<Whitespace> ws, String identifier, boolean publicAnnotation, boolean isTypeAttached) {
    BLangAnnotation annotationNode = (BLangAnnotation) this.annotationStack.pop();
    annotationNode.addWS(ws);
    annotationNode.setName(this.createIdentifier(identifier));
    if (publicAnnotation) {
        annotationNode.flagSet.add(Flag.PUBLIC);
    }
    while (!attachmentPointStack.empty()) {
        annotationNode.attachmentPoints.add(attachmentPointStack.pop());
    }
    if (isTypeAttached) {
        annotationNode.typeNode = (BLangType) this.typeNodeStack.pop();
    }
    this.compUnit.addTopLevelNode(annotationNode);
}
Also used : BLangAnnotation(org.wso2.ballerinalang.compiler.tree.BLangAnnotation)

Example 8 with BLangType

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

the class BLangPackageBuilder method markTypeNodeAsNullable.

public void markTypeNodeAsNullable(Set<Whitespace> ws) {
    BLangType typeNode = (BLangType) this.typeNodeStack.peek();
    typeNode.addWS(ws);
    typeNode.nullable = true;
}
Also used : BLangType(org.wso2.ballerinalang.compiler.tree.types.BLangType)

Example 9 with BLangType

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

the class BLangPackageBuilder method addUnionType.

public void addUnionType(DiagnosticPos pos, Set<Whitespace> ws) {
    BLangType rhsTypeNode = (BLangType) this.typeNodeStack.pop();
    BLangType lhsTypeNode = (BLangType) this.typeNodeStack.pop();
    BLangUnionTypeNode unionTypeNode;
    if (rhsTypeNode.getKind() == NodeKind.UNION_TYPE_NODE) {
        unionTypeNode = (BLangUnionTypeNode) rhsTypeNode;
        unionTypeNode.memberTypeNodes.add(0, lhsTypeNode);
        this.typeNodeStack.push(unionTypeNode);
        return;
    } else {
        unionTypeNode = (BLangUnionTypeNode) TreeBuilder.createUnionTypeNode();
        unionTypeNode.memberTypeNodes.add(lhsTypeNode);
        unionTypeNode.memberTypeNodes.add(rhsTypeNode);
    }
    unionTypeNode.pos = pos;
    unionTypeNode.addWS(ws);
    this.typeNodeStack.push(unionTypeNode);
}
Also used : BLangUnionTypeNode(org.wso2.ballerinalang.compiler.tree.types.BLangUnionTypeNode) BLangType(org.wso2.ballerinalang.compiler.tree.types.BLangType)

Example 10 with BLangType

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

the class BLangPackageBuilder method addArrayType.

public void addArrayType(DiagnosticPos pos, Set<Whitespace> ws, int dimensions) {
    BLangType eType = (BLangType) this.typeNodeStack.pop();
    BLangArrayType arrayTypeNode = (BLangArrayType) TreeBuilder.createArrayTypeNode();
    arrayTypeNode.addWS(ws);
    arrayTypeNode.pos = pos;
    arrayTypeNode.elemtype = eType;
    arrayTypeNode.dimensions = dimensions;
    addType(arrayTypeNode);
}
Also used : BLangType(org.wso2.ballerinalang.compiler.tree.types.BLangType) BLangArrayType(org.wso2.ballerinalang.compiler.tree.types.BLangArrayType)

Aggregations

BLangType (org.wso2.ballerinalang.compiler.tree.types.BLangType)5 BType (org.wso2.ballerinalang.compiler.semantics.model.types.BType)3 CompletionItem (org.eclipse.lsp4j.CompletionItem)2 BLangNode (org.wso2.ballerinalang.compiler.tree.BLangNode)2 BLangVariableDef (org.wso2.ballerinalang.compiler.tree.statements.BLangVariableDef)2 ArrayList (java.util.ArrayList)1 EnumSet (java.util.EnumSet)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 Parameter (org.ballerinalang.composer.service.ballerina.parser.service.model.lang.Parameter)1 Whitespace (org.ballerinalang.model.Whitespace)1 DiagnosticCode (org.ballerinalang.util.diagnostic.DiagnosticCode)1 SymbolEnv (org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv)1 BSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BSymbol)1 BConnectorType (org.wso2.ballerinalang.compiler.semantics.model.types.BConnectorType)1 BInvokableType (org.wso2.ballerinalang.compiler.semantics.model.types.BInvokableType)1 BUnionType (org.wso2.ballerinalang.compiler.semantics.model.types.BUnionType)1 BLangAction (org.wso2.ballerinalang.compiler.tree.BLangAction)1 BLangAnnotation (org.wso2.ballerinalang.compiler.tree.BLangAnnotation)1 BLangAnnotationAttachmentPoint (org.wso2.ballerinalang.compiler.tree.BLangAnnotationAttachmentPoint)1