diff --git a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/SymbolResolver.kt b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/SymbolResolver.kt index 6ac9b0977d..86f8703d45 100644 --- a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/SymbolResolver.kt +++ b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/SymbolResolver.kt @@ -92,25 +92,6 @@ open class SymbolResolver(ctx: TranslationContext) : ComponentPass(ctx) { walker.iterate(tu) } - /*walker.registerHandler(::resolveFieldUsages) - for (tu in component.translationUnits) { - currentTU = tu - walker.iterate(tu) - } - - walker.clearCallbacks() - walker.registerHandler(::resolveReference) - for (tu in component.translationUnits) { - currentTU = tu - walker.iterate(tu) - } - - walker.clearCallbacks() - walker.registerHandler(::resolveCalls) - for (tu in component.translationUnits) { - walker.iterate(tu) - }*/ - walker.strategy = Strategy::EOG_FORWARD walker.clearCallbacks() walker.registerHandler(this::handle) @@ -831,23 +812,6 @@ open class SymbolResolver(ctx: TranslationContext) : ComponentPass(ctx) { .toSet() } - /** - * @param signature of the ConstructExpression - * @param recordDeclaration matching the class the ConstructExpression wants to construct - * @return ConstructorDeclaration that matches the provided signature - */ - protected fun getConstructorDeclarationDirectMatch( - signature: List, - recordDeclaration: RecordDeclaration - ): ConstructorDeclaration? { - for (constructor in recordDeclaration.constructors) { - if (constructor.hasSignature(signature)) { - return constructor - } - } - return null - } - /** * @param constructExpression we want to find an invocation target for * @param recordDeclaration associated with the Object the ConstructExpression constructs @@ -861,7 +825,8 @@ open class SymbolResolver(ctx: TranslationContext) : ComponentPass(ctx) { ): ConstructorDeclaration { val signature = constructExpression.signature var constructorCandidate = - getConstructorDeclarationDirectMatch(signature, recordDeclaration) + recordDeclaration.constructors.firstOrNull { it.hasSignature(signature) } + if (constructorCandidate == null && constructExpression.language is HasDefaultArguments) { // Check for usage of default args constructorCandidate =