diff options
author | flywind <xzsflywind@gmail.com> | 2021-08-27 17:50:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-27 11:50:06 +0200 |
commit | 5eba3725707df0f62dcf9c380eaa518635b0f0c0 (patch) | |
tree | 7cc3323be5709744ceac3c44880e229ce62d29eb | |
parent | 041edaa1df96fc7963f01bf5048f2bee86b6b363 (diff) | |
download | Nim-5eba3725707df0f62dcf9c380eaa518635b0f0c0.tar.gz |
[minor] break loops if it is ambiguous (#18745)
* [minor] break loops if it is ambiguous * Update compiler/lookups.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
-rw-r--r-- | compiler/lookups.nim | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/lookups.nim b/compiler/lookups.nim index 331eef525..4c072eed8 100644 --- a/compiler/lookups.nim +++ b/compiler/lookups.nim @@ -181,13 +181,14 @@ proc someSymFromImportTable*(c: PContext; name: PIdent; ambiguous: var bool): PS if overloadableEnums notin c.features: symSet.excl skEnumField result = nil - for im in c.imports.mitems: - for s in symbols(im, marked, name, c.graph): - if result == nil: - result = s - else: - if s.kind notin symSet or result.kind notin symSet: + block outer: + for im in c.imports.mitems: + for s in symbols(im, marked, name, c.graph): + if result == nil: + result = s + elif s.kind notin symSet or result.kind notin symSet: ambiguous = true + break outer proc searchInScopes*(c: PContext, s: PIdent; ambiguous: var bool): PSym = for scope in allScopes(c.currentScope): |