Search in sources :

Example 1 with PackageVarInfo

use of org.wso2.ballerinalang.programfile.PackageVarInfo in project ballerina by ballerina-lang.

the class CodeGenerator method createPackageVarInfo.

// Create info entries
private void createPackageVarInfo(BLangVariable varNode) {
    BVarSymbol varSymbol = varNode.symbol;
    varSymbol.varIndex = getPVIndex(varSymbol.type.tag);
    int varNameCPIndex = addUTF8CPEntry(currentPkgInfo, varSymbol.name.value);
    int typeSigCPIndex = addUTF8CPEntry(currentPkgInfo, varSymbol.type.getDesc());
    PackageVarInfo pkgVarInfo = new PackageVarInfo(varNameCPIndex, typeSigCPIndex, varSymbol.flags, varSymbol.varIndex.value);
    currentPkgInfo.pkgVarInfoMap.put(varSymbol.name.value, pkgVarInfo);
    LocalVariableInfo localVarInfo = getLocalVarAttributeInfo(varSymbol);
    LocalVariableAttributeInfo pkgVarAttrInfo = (LocalVariableAttributeInfo) currentPkgInfo.getAttributeInfo(AttributeInfo.Kind.LOCAL_VARIABLES_ATTRIBUTE);
    pkgVarAttrInfo.localVars.add(localVarInfo);
// TODO Populate annotation attribute
}
Also used : LocalVariableInfo(org.wso2.ballerinalang.programfile.LocalVariableInfo) LocalVariableAttributeInfo(org.wso2.ballerinalang.programfile.attributes.LocalVariableAttributeInfo) PackageVarInfo(org.wso2.ballerinalang.programfile.PackageVarInfo) BVarSymbol(org.wso2.ballerinalang.compiler.semantics.model.symbols.BVarSymbol) BLangEndpoint(org.wso2.ballerinalang.compiler.tree.BLangEndpoint)

Aggregations

BVarSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BVarSymbol)1 BLangEndpoint (org.wso2.ballerinalang.compiler.tree.BLangEndpoint)1 LocalVariableInfo (org.wso2.ballerinalang.programfile.LocalVariableInfo)1 PackageVarInfo (org.wso2.ballerinalang.programfile.PackageVarInfo)1 LocalVariableAttributeInfo (org.wso2.ballerinalang.programfile.attributes.LocalVariableAttributeInfo)1