public interface NameResolver
import whiley.lang.*
function f(T1 x, T2 y) -> (int r):
return g(x,y)
Here the name "g" is not fully qualified. Depending on which
file the matching declaration of g occurs will depend on what
its fully qualified name is. For example, if g is declared in
the current compilation unit then it's fully quaified name would be
test.g. However, it could well be declared in a compilation unit
matching the import whiley.lang.*.| Modifier and Type | Interface and Description |
|---|---|
static class |
NameResolver.AmbiguousNameError
This error is reported in the case that exactly one match was sought, but
more than one match was found.
|
static class |
NameResolver.NameNotFoundError
This error is reported in the case that no matching name can be
identified.
|
static class |
NameResolver.ResolutionError
A resolution error occurs when a given name cannot be successfully
resolved.
|
| Modifier and Type | Method and Description |
|---|---|
wybs.lang.NameID |
resolve(WyalFile.Name name)
Fully resolve a given name which occurs at some position in a compilation
unit.
|
<T extends WyalFile.Declaration.Named> |
resolveAll(WyalFile.Name name,
Class<T> kind)
Resolve a given name which occurs at some position in a compilation unit
into one or more named declarations.
|
<T extends WyalFile.Declaration.Named> |
resolveExactly(WyalFile.Name name,
Class<T> kind)
Resolve a given name which occurs at some position in a compilation unit
into exactly one named declaration.
|
wybs.lang.NameID resolve(WyalFile.Name name) throws NameResolver.ResolutionError
name - NameResolver.ResolutionError<T extends WyalFile.Declaration.Named> T resolveExactly(WyalFile.Name name, Class<T> kind) throws NameResolver.ResolutionError
Resolve a given name which occurs at some position in a compilation unit into exactly one named declaration. Depending on the context, we may be looking for a specific kind of declaration. For example, for a variable declaration, we may be looking for the corresponding type declaration.
Observe that this method is expecting to find exactly one corresponding declaration. If it find no such matches or if it finds more than one match, then a corresponding error will be reported.
name - The name to be resolved in the given context.kind - The kind of declaration we are looking for, which can simply
be Declaration.Named in the case we are looking
for any kind of declaration.NameResolver.ResolutionError<T extends WyalFile.Declaration.Named> List<T> resolveAll(WyalFile.Name name, Class<T> kind) throws NameResolver.ResolutionError
Resolve a given name which occurs at some position in a compilation unit into one or more named declarations. Depending on the context, we may be looking for a specific kind of declaration. For example, for a function invocation expression, we are looking for the corresponding function declaration.
name - The name to be resolved in the given context.kind - The kind of declaration we are looking for, which can simply
be Declaration.Named in the case we are looking
for any kind of declaration.NameResolver.ResolutionErrorCopyright © 2017. All rights reserved.