public final class WyalFileResolver extends Object implements NameResolver
import wyal.lang.*
assert:
Test.g(0) >= 0
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 wyal.lang.*.NameResolver.AmbiguousNameError, NameResolver.NameNotFoundError, NameResolver.ResolutionError| Constructor and Description |
|---|
WyalFileResolver(wybs.lang.Build.Project project) |
| 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.
|
public wybs.lang.NameID resolve(WyalFile.Name name) throws NameResolver.ResolutionError
NameResolverresolve in interface NameResolverNameResolver.ResolutionErrorpublic <T extends WyalFile.Declaration.Named> T resolveExactly(WyalFile.Name name, Class<T> kind) throws NameResolver.ResolutionError
NameResolverResolve 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.
resolveExactly in interface NameResolvername - 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.ResolutionErrorpublic <T extends WyalFile.Declaration.Named> List<T> resolveAll(WyalFile.Name name, Class<T> kind) throws NameResolver.ResolutionError
NameResolverResolve 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.
resolveAll in interface NameResolvername - 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.