Search in sources :

Example 1 with SymbolInformation

use of org.ballerinalang.composer.service.ballerina.parser.service.model.SymbolInformation in project ballerina by ballerina-lang.

the class ParserUtils method getBuiltinTypes.

/**
 * Get the builtin types.
 *
 * @return {@link List} list of builtin types
 */
public static List<SymbolInformation> getBuiltinTypes() {
    CompilerContext context = prepareCompilerContext("", "");
    SymbolTable symbolTable = SymbolTable.getInstance(context);
    List<SymbolInformation> symbolInformationList = new ArrayList<>();
    // TODO: Need to fill the default values
    symbolTable.rootScope.entries.forEach((key, value) -> {
        if (value.symbol instanceof BTypeSymbol) {
            SymbolInformation symbolInfo = new SymbolInformation();
            String symbolName = value.symbol.getName().getValue();
            if (!symbolName.equals(BuiltInType.INVALID_TYPE)) {
                symbolInfo.setName(symbolName);
                setDefaultValuesForType(symbolName, symbolInfo);
                symbolInformationList.add(symbolInfo);
            }
        }
    });
    return symbolInformationList;
}
Also used : CompilerContext(org.wso2.ballerinalang.compiler.util.CompilerContext) ArrayList(java.util.ArrayList) SymbolTable(org.wso2.ballerinalang.compiler.semantics.model.SymbolTable) BTypeSymbol(org.wso2.ballerinalang.compiler.semantics.model.symbols.BTypeSymbol) SymbolInformation(org.ballerinalang.composer.service.ballerina.parser.service.model.SymbolInformation)

Aggregations

ArrayList (java.util.ArrayList)1 SymbolInformation (org.ballerinalang.composer.service.ballerina.parser.service.model.SymbolInformation)1 SymbolTable (org.wso2.ballerinalang.compiler.semantics.model.SymbolTable)1 BTypeSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BTypeSymbol)1 CompilerContext (org.wso2.ballerinalang.compiler.util.CompilerContext)1