Appearance
| 1 | namespace Semantic.DotNet is | |
| 2 | // Some of what the runtime declares exists for the compiler rather | |
| 3 | // than for programs: the attributes that carry language facts across | |
| 4 | // an assembly boundary. Source that names one can state something | |
| 5 | // about a type the compiler never established, and a consumer's | |
| 6 | // narrowing and exhaustiveness then rest on it. | |
| 7 | // | |
| 8 | // They are declined where an imported name is resolved, so a program | |
| 9 | // naming one is told the symbol is not found. The assembly that | |
| 10 | // declares them reaches its own declarations as source symbols and is | |
| 11 | // unaffected, as is the compiler, which reaches them through the type | |
| 12 | // source and through reflected custom-attribute data rather than by | |
| 13 | // resolving a name. | |
| 14 | class HIDDEN_SYMBOLS is | |
| 15 | INTERNAL_NAMESPACE: string static => "Ghul.Internal" | |
| 16 | ||
| 17 | is_hidden_namespace(namespace_name: string?) -> bool static => | |
| 18 | namespace_name =~ INTERNAL_NAMESPACE | |
| 19 | ||
| 20 | // Completion collects the members of a namespace from the | |
| 21 | // symbols declared in it, from the namespace registry and from | |
| 22 | // the imported assemblies, each keyed by its bare name. Pruning | |
| 23 | // the collected map is what covers all three at once. | |
| 24 | prune_hidden( | |
| 25 | namespace_name: string, | |
| 26 | matches: Collections.MutableMap[string, Symbols.Symbol] | |
| 27 | ) static is | |
| 28 | let hidden = Collections.LIST[string]() | |
| 29 | ||
| 30 | for match in matches do | |
| 31 | if is_hidden_namespace("{namespace_name}.{match.key}") then | |
| 32 | hidden.add(match.key) | |
| 33 | fi | |
| 34 | od | |
| 35 | ||
| 36 | for name in hidden do | |
| 37 | matches.remove(name) | |
| 38 | od | |
| 39 | si | |
| 40 | si | |
| 41 | si |