Skip to content

Commit ce6afcb

Browse files
cirrasfourls
authored andcommitted
Prevent name resolution failure logging on implementation-local routines
1 parent 7b7f062 commit ce6afcb

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

delphi-frontend/src/main/java/au/com/integradev/delphi/symbol/resolve/NameResolutionHelper.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,13 @@ public void resolve(RoutineImplementationNode routine) {
339339
}
340340

341341
resolver.disambiguateIsClassInvocable(routine.isClassMethod());
342+
343+
if (resolver.nameResolutionFailed() && !routine.getNameReferenceNode().isQualified()) {
344+
// No interface declaration found, and not a qualified name so it can't be a method.
345+
// It must be an implementation-local routine.
346+
return;
347+
}
348+
342349
resolver.addToSymbolTable();
343350

344351
completeTypeParameterReferences(routine);

delphi-frontend/src/main/java/au/com/integradev/delphi/symbol/resolve/NameResolver.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ public boolean isAmbiguous() {
203203
return declarations.size() > 1;
204204
}
205205

206+
public boolean nameResolutionFailed() {
207+
return names.size() != resolvedDeclarations.size() + Math.min(1, declarations.size());
208+
}
209+
206210
private void checkAmbiguity() {
207211
if (isAmbiguous()) {
208212
if (LOG.isWarnEnabled()) {
@@ -664,10 +668,6 @@ private NameOccurrence createNameOccurrence(NameReferenceNode reference, boolean
664668
return occurrence;
665669
}
666670

667-
private boolean nameResolutionFailed() {
668-
return names.size() != resolvedDeclarations.size() + Math.min(1, declarations.size());
669-
}
670-
671671
private void specializeDeclarations(NameOccurrence occurrence) {
672672
declarations =
673673
declarations.stream()

0 commit comments

Comments
 (0)