Unified: Add static name binding pass - #22299
Draft
asgerf wants to merge 24 commits into
Draft
Conversation
getValue() returns an empty string for various literals
This supports only a minimal set of features but sets up the structure we'll be using for supporting more features.
The restriction to classes was more permanent that anticipated, since top-level scopes instead target a TModuleScope
Scoped imports like 'import class B.C' are mapped to an AST of form
ImportDeclartion
pattern: NamePattern "C"
importedExpr: MemberAccessExpr
base: "B"
member: "C"
The NamePattern introduces a local alias for 'C', but unlike type aliases we also resolve to the ultimate target, when it's coming through an import.
Program was not valid unless these were public
Module names can only be referenced by an import declaration, they cannot appear directly on front of a type name unless the module is also imported.
An `import X` declaration now does two things: - X becomes a local name binding - X is bulk-imported into the local scope The AST mapping now maps it to X with a bulk-importing pattern as a sub-pattern. Module names can no longer be referenced anywhere except as the leading qualifier of an import statement.
| private import codeql.util.Unit | ||
| private import codeql.unified.internal.NameBindingPluginSwift // ensure overrides are seen | ||
|
|
||
| /** Extension point for language-specific inputs to name binding. */ |
Comment on lines
+39
to
+44
| /** | ||
| * Representative for a module scope. | ||
| * | ||
| * Module scopes can encompass a set of files, and is the canonical representative | ||
| * for the top-level members collectively exported from those files. | ||
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.