# Path: krakatau-lib/src/main/resources/Lib/Krakatau/ssa/objtypes.py
# def TypeTT(baset, dim):
# def baset(tt): return tt[0]
# def dim(tt): return tt[1]
# def withDimInc(tt, inc): return TypeTT(baset(tt), dim(tt)+inc)
# def withNoDim(tt): return TypeTT(baset(tt), 0)
# def isBaseTClass(tt): return not baset(tt).startswith('.')
# def className(tt): return baset(tt) if not baset(tt).startswith('.') else None
# def primName(tt): return baset(tt)[1:] if baset(tt).startswith('.') else None
# def isSubtype(env, x, y):
# def commonSupertype(env, tts):
# def verifierToSynthetic_seq(vtypes):
# def verifierToSynthetic(vtype):
# def declTypeToActual(env, decltype):
# 
# Path: krakatau-lib/src/main/resources/Lib/Krakatau/verifier/descriptors.py
# def parseFieldDescriptor(desc_str, unsynthesize=True):
#     rval = parseFieldDescriptors(desc_str, unsynthesize)
# 
#     cat = 2 if (rval and rval[0] in cat2tops) else 1
#     if len(rval) != cat:
#         raise ValueError('Incorrect number of fields in descriptor, expected {} but found {}'.format(cat, len(rval)))
#     return rval
# 
# Path: krakatau-lib/src/main/resources/Lib/Krakatau/java/reserved.py



import struct
        import traceback
from ..ssa import objtypes
from ..verifier.descriptors import parseFieldDescriptor
from . import ast, ast2, javamethod, throws
from .reserved import reserved_identifiers



def loadConstValue(cpool, index):
    entry_type = cpool.pool[index][0]
    args = cpool.getArgs(index)

    #Note: field constant values cannot be class literals
    tt = {'Int':objtypes.IntTT, 'Long':objtypes.LongTT,
        'Float':objtypes.FloatTT, 'Double':objtypes.DoubleTT,
        'String':objtypes.StringTT}[entry_type]
    return ast.Literal(tt, args[0])

def _getField(field):
    flags = [x.lower() for x in sorted(field.flags) if x not in ('SYNTHETIC','ENUM')]
    desc = field.descriptor

# Path: krakatau-lib/src/main/resources/Lib/Krakatau/ssa/objtypes.py
# def TypeTT(baset, dim):
# def baset(tt): return tt[0]
# def dim(tt): return tt[1]
# def withDimInc(tt, inc): return TypeTT(baset(tt), dim(tt)+inc)
# def withNoDim(tt): return TypeTT(baset(tt), 0)
# def isBaseTClass(tt): return not baset(tt).startswith('.')
# def className(tt): return baset(tt) if not baset(tt).startswith('.') else None
# def primName(tt): return baset(tt)[1:] if baset(tt).startswith('.') else None
# def isSubtype(env, x, y):
# def commonSupertype(env, tts):
# def verifierToSynthetic_seq(vtypes):
# def verifierToSynthetic(vtype):
# def declTypeToActual(env, decltype):
# 
# Path: krakatau-lib/src/main/resources/Lib/Krakatau/verifier/descriptors.py
# def parseFieldDescriptor(desc_str, unsynthesize=True):
#     rval = parseFieldDescriptors(desc_str, unsynthesize)
# 
#     cat = 2 if (rval and rval[0] in cat2tops) else 1
#     if len(rval) != cat:
#         raise ValueError('Incorrect number of fields in descriptor, expected {} but found {}'.format(cat, len(rval)))
#     return rval
# 
# Path: krakatau-lib/src/main/resources/Lib/Krakatau/java/reserved.py



# Path: krakatau-lib/src/main/resources/Lib/Krakatau/java/javaclass.py
import struct
        import traceback
from ..ssa import objtypes
from ..verifier.descriptors import parseFieldDescriptor
from . import ast, ast2, javamethod, throws
from .reserved import reserved_identifiers




def loadConstValue(cpool, index):
    entry_type = cpool.pool[index][0]
    args = cpool.getArgs(index)

    #Note: field constant values cannot be class literals
    tt = {'Int':objtypes.IntTT, 'Long':objtypes.LongTT,
        'Float':objtypes.FloatTT, 'Double':objtypes.DoubleTT,
        'String':objtypes.StringTT}[entry_type]
    return ast.Literal(tt, args[0])

def _getField(field):
    flags = [x.lower() for x in sorted(field.flags) if x not in ('SYNTHETIC','ENUM')]
    desc = field.descriptor

    dtype = objtypes.verifierToSynthetic(parseFieldDescriptor(desc, unsynthesize=False)[0])