Skip to content

Commit 3de822e

Browse files
committed
Prevent name resolution failure logging on implementation-local routines
1 parent df79caf commit 3de822e

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
@@ -319,6 +319,13 @@ public void resolve(RoutineImplementationNode routine) {
319319
}
320320

321321
resolver.disambiguateIsClassInvocable(routine.isClassMethod());
322+
323+
if (resolver.nameResolutionFailed() && !routine.getNameReferenceNode().isQualified()) {
324+
// No interface declaration found, and not a qualified name so it can't be a method.
325+
// It must be an implementation-local routine.
326+
return;
327+
}
328+
322329
resolver.addToSymbolTable();
323330

324331
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)