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);
}
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);
}
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;
}
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);
}
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);
}
Aggregations