forked from rolldown/rolldown
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(rolldown): build oxc semantic data only once (rolldown#1506)
It was accidental that oxc semantic data is built twice during the whole process. This PR passes the built semantic into the transformer so it is not built twice.
- Loading branch information
Showing
4 changed files
with
42 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
use oxc::semantic::{ScopeTree, SymbolTable}; | ||
use rolldown_common::AstScopes; | ||
use rolldown_oxc_utils::OxcAst; | ||
|
||
use crate::types::ast_symbols::AstSymbols; | ||
|
||
pub fn make_ast_scopes_and_symbols(ast: &OxcAst) -> (AstScopes, AstSymbols) { | ||
let (mut symbol_table, scope) = ast.make_symbol_table_and_scope_tree(); | ||
pub fn make_ast_scopes_and_symbols( | ||
symbols: SymbolTable, | ||
scopes: ScopeTree, | ||
) -> (AstSymbols, AstScopes) { | ||
let mut symbols = symbols; | ||
let ast_scope = AstScopes::new( | ||
scope, | ||
std::mem::take(&mut symbol_table.references), | ||
std::mem::take(&mut symbol_table.resolved_references), | ||
scopes, | ||
std::mem::take(&mut symbols.references), | ||
std::mem::take(&mut symbols.resolved_references), | ||
); | ||
let ast_symbols = AstSymbols::from_symbol_table(symbol_table); | ||
(ast_scope, ast_symbols) | ||
let ast_symbols = AstSymbols::from_symbol_table(symbols); | ||
(ast_symbols, ast_scope) | ||
} |
This file contains 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
This file contains 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