-
-
Notifications
You must be signed in to change notification settings - Fork 565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): add light version of the semantic model to scanner #5599
Conversation
CodSpeed Performance ReportMerging #5599 will not alter performanceComparing Summary
|
/// A `let` or `const` declaration. | ||
/// | ||
/// The type (either declared or inferred) of the value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: We should add var
and using
too :) or make the docs a bit more generic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var
is covered under HoistedValue
instead. using
isn't covered yet, but also makes no sense in the context of exports, I think.
|
||
impl JsDeclarationKind { | ||
/// Returns `true` for any declaration that _may_ be a type. | ||
fn might_be_type(&self) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fail to understand the semantic difference between "might be a type" (might_be_type
) and "is a type" (is_a_type
), because a "might" could be translated into a enum
where "maybe" is a valid variant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's mainly due to the presence of the Import
variant, where we don't know whether it's a type or a value being imported.
I'll clarify it with a comment.
9029e92
to
968b6cf
Compare
Summary
Fixes #5312.
This adds a light, and as of yet incomplete, version of the semantic model to the scanner. The goal isn't yet to do deep semantic analysis inside the scanned modules, but simply to resolve exported symbols when their declaration is in a different position than the export statement itself.
This makes sure that we can resolve both types and JSDoc comments more accurately through the module graph, and also resolves one of the limitations of
noPrivateImports
that we had in the beta.JSDoc comments also have a dedicated type. The type definitions for type aliases has been refined as well.
Test Plan
Tests added and snapshots updated.