@@ -10,7 +10,7 @@ use crate::{
10
10
Scoping ,
11
11
conditional:: ConditionalDataMap ,
12
12
exhaustive:: { ExhaustiveCallback , ExhaustiveDepId } ,
13
- r#loop:: LoopDataMap ,
13
+ // r#loop::LoopDataMap,
14
14
} ,
15
15
utils:: ExtraData ,
16
16
vfs:: Vfs ,
@@ -23,7 +23,7 @@ use rustc_hash::{FxHashMap, FxHashSet};
23
23
use std:: { collections:: BTreeSet , mem} ;
24
24
25
25
pub struct Analyzer < ' a > {
26
- pub vfs : & ' a dyn Vfs ,
26
+ pub vfs : Box < dyn Vfs > ,
27
27
pub config : & ' a TreeShakeConfig ,
28
28
pub allocator : & ' a Allocator ,
29
29
pub factory : & ' a EntityFactory < ' a > ,
@@ -39,21 +39,17 @@ pub struct Analyzer<'a> {
39
39
pub exhaustive_callbacks : FxHashMap < ExhaustiveDepId , FxHashSet < ExhaustiveCallback < ' a > > > ,
40
40
pub referred_deps : ReferredDeps ,
41
41
pub conditional_data : ConditionalDataMap < ' a > ,
42
- pub loop_data : LoopDataMap < ' a > ,
42
+ // pub loop_data: LoopDataMap<'a>,
43
43
pub folder : ConstantFolder < ' a > ,
44
44
pub mangler : Mangler < ' a > ,
45
45
pub pending_deps : FxHashSet < ExhaustiveCallback < ' a > > ,
46
46
pub diagnostics : BTreeSet < String > ,
47
47
}
48
48
49
49
impl < ' a > Analyzer < ' a > {
50
- pub fn new_in (
51
- vfs : & ' a dyn Vfs ,
52
- config : & ' a TreeShakeConfig ,
53
- allocator : & ' a Allocator ,
54
- ) -> & ' a mut Self {
50
+ pub fn new_in ( vfs : Box < dyn Vfs > , config : & ' a TreeShakeConfig , allocator : & ' a Allocator ) -> Self {
55
51
let factory = & * allocator. alloc ( EntityFactory :: new ( allocator, config) ) ;
56
- allocator . alloc ( Analyzer {
52
+ Analyzer {
57
53
vfs,
58
54
config,
59
55
allocator,
@@ -70,12 +66,12 @@ impl<'a> Analyzer<'a> {
70
66
exhaustive_callbacks : Default :: default ( ) ,
71
67
referred_deps : Default :: default ( ) ,
72
68
conditional_data : Default :: default ( ) ,
73
- loop_data : Default :: default ( ) ,
69
+ // loop_data: Default::default(),
74
70
folder : Default :: default ( ) ,
75
71
mangler : Mangler :: new ( config. mangling . is_some ( ) , allocator) ,
76
72
pending_deps : Default :: default ( ) ,
77
73
diagnostics : Default :: default ( ) ,
78
- } )
74
+ }
79
75
}
80
76
81
77
pub fn finalize ( & mut self ) {
@@ -94,7 +90,7 @@ impl<'a> Analyzer<'a> {
94
90
dirty |= self . consume_top_level_uncaught ( ) ;
95
91
dirty |= self . call_exhaustive_callbacks ( ) ;
96
92
dirty |= self . post_analyze_handle_conditional ( ) ;
97
- dirty |= self . post_analyze_handle_loops ( ) ;
93
+ // dirty |= self.post_analyze_handle_loops();
98
94
dirty |= self . post_analyze_handle_folding ( ) ;
99
95
if !dirty {
100
96
break ;
@@ -108,11 +104,12 @@ impl<'a> Analyzer<'a> {
108
104
}
109
105
110
106
fn consume_top_level_uncaught ( & mut self ) -> bool {
107
+ let factory = self . factory ;
111
108
let thrown_values = & mut self . call_scope_mut ( ) . try_scopes . last_mut ( ) . unwrap ( ) . thrown_values ;
112
109
if thrown_values. is_empty ( ) {
113
110
false
114
111
} else {
115
- let values = mem:: take ( thrown_values) ;
112
+ let values = mem:: replace ( thrown_values, factory . vec ( ) ) ;
116
113
self . consume ( values) ;
117
114
true
118
115
}
0 commit comments