use of org.wso2.ballerinalang.compiler.PackageLoader in project ballerina by ballerina-lang.
the class BallerinaDocGenerator method getBuiltInPackage.
private static BLangPackage getBuiltInPackage(CompilerContext context) {
PackageLoader pkgLoader = PackageLoader.getInstance(context);
SemanticAnalyzer semAnalyzer = SemanticAnalyzer.getInstance(context);
CodeAnalyzer codeAnalyzer = CodeAnalyzer.getInstance(context);
return codeAnalyzer.analyze(semAnalyzer.analyze(pkgLoader.loadAndDefinePackage(Names.BUILTIN_ORG.getValue(), Names.BUILTIN_PACKAGE.getValue())));
}
use of org.wso2.ballerinalang.compiler.PackageLoader in project ballerina by ballerina-lang.
the class LSPackageLoader method getBuiltinPackages.
/**
* Get the Builtin Package.
* @return {@link BLangPackage} Builtin BLang package
*/
public static List<BLangPackage> getBuiltinPackages() {
List<BLangPackage> builtins = new ArrayList<>();
CompilerContext context = CommonUtil.prepareTempCompilerContext();
PackageLoader pkgLoader = PackageLoader.getInstance(context);
SemanticAnalyzer semAnalyzer = SemanticAnalyzer.getInstance(context);
CodeAnalyzer codeAnalyzer = CodeAnalyzer.getInstance(context);
BLangPackage builtInPkg = codeAnalyzer.analyze(semAnalyzer.analyze(pkgLoader.loadAndDefinePackage(Names.BUILTIN_ORG.value, Names.BUILTIN_PACKAGE.getValue())));
builtins.add(builtInPkg);
return builtins;
}
use of org.wso2.ballerinalang.compiler.PackageLoader in project ballerina by ballerina-lang.
the class ParserUtils method loadBuiltInPackage.
/**
* Loading builtin packages.
*
* @param context compiler context
* @return {BLangPackage} builtIn package
*/
private static BLangPackage loadBuiltInPackage(CompilerContext context) {
PackageLoader pkgLoader = PackageLoader.getInstance(context);
SymbolTable symbolTable = SymbolTable.getInstance(context);
SemanticAnalyzer semAnalyzer = SemanticAnalyzer.getInstance(context);
CodeAnalyzer codeAnalyzer = CodeAnalyzer.getInstance(context);
Desugar desugar = Desugar.getInstance(context);
BLangPackage builtInPkg = desugar.perform(codeAnalyzer.analyze(semAnalyzer.analyze(pkgLoader.loadAndDefinePackage(Names.BUILTIN_ORG.getValue(), Names.BUILTIN_PACKAGE.getValue()))));
symbolTable.builtInPackageSymbol = builtInPkg.symbol;
return builtInPkg;
}
Aggregations