Пример #1
0
def parseAccess(acDb, accesDict, invEntityDict, attrDict, typedefDict, transInhDict, scope, referenceLinesRecognizedAsAccesses, output_file):
    # TODO this really, really needs to be refactored
    common.famix.cdifReader.buildAttributeCache(output_file)
    common.famix.cdifReader.buildGlobalVarCache(output_file)

    # build local var cache
    localVarCache = EntityCacheFactory.buildAndReturnLocalVarCacheFromDb(acDb)

    accessResolver = AlternativeAccessResolver(scope, transInhDict, typedefDict, invEntityDict, attrDict)

    lineNr = 0
    for line in open(acDb, "r"):
        if not isPotentialAccess(line):
            lineNr += 1
            continue

        access = AccessEntity(line)
        access.decomposeData()

        if accessResolver.resolve(access):
            accesDict.add(access.sourceFile, access.start, access.dst_class)
            aCommandList = RuleChecker.checkAccessEntity(access)

            if not(not aCommandList):
                RuleChecker.generateAccessInfo(aCommandList, access)
                referenceLinesRecognizedAsAccesses.append(lineNr)
        else:
            access.getReport().logIfFlawed()

        lineNr += 1

    return lineNr