use of de.fraunhofer.aisec.cpg.helpers.SubgraphWalker.ScopedWalker in project cpg by Fraunhofer-AISEC.
the class VariableUsageResolver method accept.
@Override
public void accept(TranslationResult result) {
walker = new ScopedWalker(lang);
for (TranslationUnitDeclaration tu : result.getTranslationUnits()) {
currTu = tu;
walker.clearCallbacks();
walker.registerHandler((currClass, parent, currNode) -> walker.collectDeclarations(currNode));
walker.registerHandler(this::findRecordsAndEnums);
walker.iterate(currTu);
}
Map<Type, List<Type>> currSuperTypes = recordMap.values().stream().collect(Collectors.toMap(r -> TypeParser.createFrom(r.getName(), true), RecordDeclaration::getSuperTypes));
superTypesMap.putAll(currSuperTypes);
for (TranslationUnitDeclaration tu : result.getTranslationUnits()) {
walker.clearCallbacks();
walker.registerHandler(this::resolveFieldUsages);
walker.iterate(tu);
}
for (TranslationUnitDeclaration tu : result.getTranslationUnits()) {
walker.clearCallbacks();
walker.registerHandler(this::resolveLocalVarUsage);
walker.iterate(tu);
}
}
use of de.fraunhofer.aisec.cpg.helpers.SubgraphWalker.ScopedWalker in project cpg by Fraunhofer-AISEC.
the class CallResolver method accept.
@Override
public void accept(@NonNull TranslationResult translationResult) {
walker = new ScopedWalker(lang);
walker.registerHandler((currClass, parent, currNode) -> walker.collectDeclarations(currNode));
walker.registerHandler(this::findRecords);
walker.registerHandler(this::findTemplates);
walker.registerHandler(this::registerMethods);
for (TranslationUnitDeclaration tu : translationResult.getTranslationUnits()) {
walker.iterate(tu);
}
walker.clearCallbacks();
walker.registerHandler(this::fixInitializers);
for (TranslationUnitDeclaration tu : translationResult.getTranslationUnits()) {
walker.iterate(tu);
}
walker.clearCallbacks();
walker.registerHandler(this::resolve);
for (TranslationUnitDeclaration tu : translationResult.getTranslationUnits()) {
walker.iterate(tu);
}
}
Aggregations