use of org.wso2.ballerinalang.programfile.EnumeratorInfo in project ballerina by ballerina-lang.
the class CodeGenerator method createEnumInfoEntry.
private void createEnumInfoEntry(BLangEnum enumNode) {
BTypeSymbol enumSymbol = (BTypeSymbol) enumNode.symbol;
// Add Enum name as an UTFCPEntry to the constant pool
int enumNameCPIndex = addUTF8CPEntry(currentPkgInfo, enumSymbol.name.value);
EnumInfo enumInfo = new EnumInfo(currentPackageRefCPIndex, enumNameCPIndex, enumSymbol.flags);
currentPkgInfo.addEnumInfo(enumSymbol.name.value, enumInfo);
enumInfo.enumType = (BEnumType) enumSymbol.type;
for (int i = 0; i < enumNode.enumerators.size(); i++) {
BLangEnumerator enumeratorNode = enumNode.enumerators.get(i);
enumeratorNode.symbol.varIndex = new RegIndex(i, enumSymbol.type.tag);
enumeratorNode.symbol.varIndex.isVarIndex = true;
int enumeratorNameCPIndex = addUTF8CPEntry(currentPkgInfo, enumeratorNode.symbol.name.toString());
EnumeratorInfo enumeratorInfo = new EnumeratorInfo(enumeratorNameCPIndex, i, enumInfo.enumType);
enumInfo.enumeratorInfoList.add(enumeratorInfo);
}
}
Aggregations