diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-09-17 17:36:37 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-09-17 17:36:37 +0200 |
commit | fd4ef6ae8fea617af1ae5accdfff173b1990f263 (patch) | |
tree | fa566db89f1b75aaf61d146ae74fefd93fb90a6d /compiler/lookups.nim | |
parent | ae7fe5087f3e4f6ddc572254ae3ddcc8324099f1 (diff) | |
download | Nim-fd4ef6ae8fea617af1ae5accdfff173b1990f263.tar.gz |
.pure enums are much more convenient to use now
Diffstat (limited to 'compiler/lookups.nim')
-rw-r--r-- | compiler/lookups.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/lookups.nim b/compiler/lookups.nim index 5c326d10a..5a5dfc46a 100644 --- a/compiler/lookups.nim +++ b/compiler/lookups.nim @@ -286,7 +286,7 @@ proc lookUp*(c: PContext, n: PNode): PSym = type TLookupFlag* = enum - checkAmbiguity, checkUndeclared, checkModule + checkAmbiguity, checkUndeclared, checkModule, checkPureEnumFields proc qualifiedLookUp*(c: PContext, n: PNode, flags: set[TLookupFlag]): PSym = const allExceptModule = {low(TSymKind)..high(TSymKind)}-{skModule,skPackage} @@ -297,6 +297,8 @@ proc qualifiedLookUp*(c: PContext, n: PNode, flags: set[TLookupFlag]): PSym = result = searchInScopes(c, ident).skipAlias(n) else: result = searchInScopes(c, ident, allExceptModule).skipAlias(n) + if result == nil and checkPureEnumFields in flags: + result = strTableGet(c.pureEnumFields, ident) if result == nil and checkUndeclared in flags: fixSpelling(n, ident, searchInScopes) errorUndeclaredIdentifier(c, n.info, ident.s) |