use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addEndpointType.
public void addEndpointType(DiagnosticPos pos, Set<Whitespace> ws) {
BLangNameReference nameReference = nameReferenceStack.pop();
BLangUserDefinedType constraintType = (BLangUserDefinedType) TreeBuilder.createUserDefinedTypeNode();
constraintType.pos = pos;
constraintType.pkgAlias = (BLangIdentifier) nameReference.pkgAlias;
constraintType.typeName = (BLangIdentifier) nameReference.name;
constraintType.addWS(nameReference.ws);
addType(constraintType);
}
use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.
the class BLangPackageBuilder method startDocumentationAttachment.
public void startDocumentationAttachment(DiagnosticPos currentPos) {
BLangDocumentation docAttachmentNode = (BLangDocumentation) TreeBuilder.createDocumentationNode();
docAttachmentNode.pos = currentPos;
docAttachmentStack.push(docAttachmentNode);
}
use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.
the class BLangPackageBuilder method generateObjectVarNode.
private VariableNode generateObjectVarNode(DiagnosticPos pos, Set<Whitespace> ws, boolean isField, String identifier, boolean exprAvailable) {
BLangVariable var = (BLangVariable) TreeBuilder.createVariableNode();
var.pos = pos;
IdentifierNode name = this.createIdentifier(identifier);
var.setName(name);
var.addWS(ws);
var.isField = isField;
if (!isField) {
var.setTypeNode(this.typeNodeStack.pop());
}
if (exprAvailable) {
var.setInitialExpression(this.exprNodeStack.pop());
}
return var;
}
use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.
the class BLangPackageBuilder method startEnumDef.
public void startEnumDef(DiagnosticPos pos) {
BLangEnum bLangEnum = (BLangEnum) TreeBuilder.createEnumNode();
bLangEnum.pos = pos;
attachAnnotations(bLangEnum);
attachDocumentations(bLangEnum);
attachDeprecatedNode(bLangEnum);
this.enumStack.add(bLangEnum);
}
use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addImportPackageDeclaration.
public void addImportPackageDeclaration(DiagnosticPos pos, Set<Whitespace> ws, String orgName, List<String> nameComps, String version, String alias) {
List<BLangIdentifier> pkgNameComps = new ArrayList<>();
nameComps.forEach(e -> pkgNameComps.add((BLangIdentifier) this.createIdentifier(e)));
BLangIdentifier versionNode = (BLangIdentifier) this.createIdentifier(version);
BLangIdentifier aliasNode = (alias != null && !alias.isEmpty()) ? (BLangIdentifier) this.createIdentifier(alias) : pkgNameComps.get(pkgNameComps.size() - 1);
BLangImportPackage importDcl = (BLangImportPackage) TreeBuilder.createImportPackageNode();
importDcl.pos = pos;
importDcl.addWS(ws);
importDcl.pkgNameComps = pkgNameComps;
importDcl.version = versionNode;
importDcl.orgName = (BLangIdentifier) this.createIdentifier(orgName);
importDcl.alias = aliasNode;
this.compUnit.addTopLevelNode(importDcl);
if (this.imports.contains(importDcl)) {
this.dlog.warning(pos, DiagnosticCode.REDECLARED_IMPORT_PACKAGE, importDcl.getQualifiedPackageName());
} else {
this.imports.add(importDcl);
}
}
Aggregations