Search in sources :

Example 1 with BLangPackageDeclaration

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

the class BLangPackageBuilder method setPackageDeclaration.

public void setPackageDeclaration(DiagnosticPos pos, Set<Whitespace> ws, List<String> nameComps, String version) {
    List<BLangIdentifier> pkgNameComps = new ArrayList<>();
    nameComps.forEach(e -> pkgNameComps.add((BLangIdentifier) this.createIdentifier(e)));
    BLangIdentifier versionNode = (BLangIdentifier) this.createIdentifier(version);
    BLangPackageDeclaration pkgDcl = (BLangPackageDeclaration) TreeBuilder.createPackageDeclarationNode();
    pkgDcl.pos = pos;
    // TODO: orgname is null, fix it.
    pkgDcl.addWS(ws);
    pkgDcl.pkgNameComps = pkgNameComps;
    pkgDcl.version = versionNode;
    this.compUnit.addTopLevelNode(pkgDcl);
}
Also used : BLangPackageDeclaration(org.wso2.ballerinalang.compiler.tree.BLangPackageDeclaration) ArrayList(java.util.ArrayList) BLangIdentifier(org.wso2.ballerinalang.compiler.tree.BLangIdentifier)

Aggregations

ArrayList (java.util.ArrayList)1 BLangIdentifier (org.wso2.ballerinalang.compiler.tree.BLangIdentifier)1 BLangPackageDeclaration (org.wso2.ballerinalang.compiler.tree.BLangPackageDeclaration)1