mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32:10 +00:00
fix(semantic): set program scope_id for TS definition files (#3496)
Semantic does not visit the AST for TS definition files, but it does create a root scope. Record this scope ID in `Program`'s `scope_id` field.
This commit is contained in:
parent
9ff4feaa4c
commit
6f71541db0
1 changed files with 2 additions and 1 deletions
|
|
@ -140,7 +140,8 @@ impl<'a> SemanticBuilder<'a> {
|
||||||
|
|
||||||
pub fn build(mut self, program: &Program<'a>) -> SemanticBuilderReturn<'a> {
|
pub fn build(mut self, program: &Program<'a>) -> SemanticBuilderReturn<'a> {
|
||||||
if self.source_type.is_typescript_definition() {
|
if self.source_type.is_typescript_definition() {
|
||||||
self.scope.add_scope(None, ScopeFlags::Top);
|
let scope_id = self.scope.add_scope(None, ScopeFlags::Top);
|
||||||
|
program.scope_id.set(Some(scope_id));
|
||||||
} else {
|
} else {
|
||||||
self.visit_program(program);
|
self.visit_program(program);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue