@@ -20,7 +20,7 @@ use crate::utils::Stack;
20
20
21
21
pub struct Context < ' a > {
22
22
pub media_type : MediaType ,
23
- pub program : & ' a Program < ' a > ,
23
+ pub program : Program < ' a > ,
24
24
pub config : & ' a Configuration ,
25
25
pub comments : CommentTracker < ' a > ,
26
26
pub token_finder : TokenFinder < ' a > ,
@@ -41,7 +41,7 @@ pub struct Context<'a> {
41
41
}
42
42
43
43
impl < ' a > Context < ' a > {
44
- pub fn new ( media_type : MediaType , tokens : & ' a [ TokenAndSpan ] , current_node : Node < ' a > , program : & ' a Program < ' a > , config : & ' a Configuration ) -> Context < ' a > {
44
+ pub fn new ( media_type : MediaType , tokens : & ' a [ TokenAndSpan ] , current_node : Node < ' a > , program : Program < ' a > , config : & ' a Configuration ) -> Context < ' a > {
45
45
Context {
46
46
media_type,
47
47
program,
@@ -60,7 +60,7 @@ impl<'a> Context<'a> {
60
60
if_stmt_last_brace_condition_ref : None ,
61
61
expr_stmt_single_line_parent_brace_ref : None ,
62
62
#[ cfg( debug_assertions) ]
63
- last_generated_node_pos : deno_ast:: SourceTextInfoProvider :: text_info ( program) . range ( ) . start . into ( ) ,
63
+ last_generated_node_pos : deno_ast:: SourceTextInfoProvider :: text_info ( & program) . range ( ) . start . into ( ) ,
64
64
}
65
65
}
66
66
@@ -80,35 +80,35 @@ impl<'a> Context<'a> {
80
80
self . handled_comments . insert ( comment. start ( ) ) ;
81
81
}
82
82
83
- pub fn store_info_range_for_node ( & mut self , node : & dyn SourceRanged , lns : ( LineNumber , LineNumber ) ) {
83
+ pub fn store_info_range_for_node ( & mut self , node : & impl SourceRanged , lns : ( LineNumber , LineNumber ) ) {
84
84
self . stored_ln_ranges . insert ( ( node. start ( ) , node. end ( ) ) , lns) ;
85
85
}
86
86
87
- pub fn get_ln_range_for_node ( & self , node : & dyn SourceRanged ) -> Option < ( LineNumber , LineNumber ) > {
87
+ pub fn get_ln_range_for_node ( & self , node : & impl SourceRanged ) -> Option < ( LineNumber , LineNumber ) > {
88
88
self . stored_ln_ranges . get ( & ( node. start ( ) , node. end ( ) ) ) . map ( |x| x. to_owned ( ) )
89
89
}
90
90
91
- pub fn store_lsil_for_node ( & mut self , node : & dyn SourceRanged , lsil : LineStartIndentLevel ) {
91
+ pub fn store_lsil_for_node ( & mut self , node : & impl SourceRanged , lsil : LineStartIndentLevel ) {
92
92
self . stored_lsil . insert ( ( node. start ( ) , node. end ( ) ) , lsil) ;
93
93
}
94
94
95
- pub fn get_lsil_for_node ( & self , node : & dyn SourceRanged ) -> Option < LineStartIndentLevel > {
95
+ pub fn get_lsil_for_node ( & self , node : & impl SourceRanged ) -> Option < LineStartIndentLevel > {
96
96
self . stored_lsil . get ( & ( node. start ( ) , node. end ( ) ) ) . map ( |x| x. to_owned ( ) )
97
97
}
98
98
99
- pub fn store_ln_for_node ( & mut self , node : & dyn SourceRanged , ln : LineNumber ) {
99
+ pub fn store_ln_for_node ( & mut self , node : & impl SourceRanged , ln : LineNumber ) {
100
100
self . stored_ln . insert ( ( node. start ( ) , node. end ( ) ) , ln) ;
101
101
}
102
102
103
- pub fn get_ln_for_node ( & self , node : & dyn SourceRanged ) -> Option < LineNumber > {
103
+ pub fn get_ln_for_node ( & self , node : & impl SourceRanged ) -> Option < LineNumber > {
104
104
self . stored_ln . get ( & ( node. start ( ) , node. end ( ) ) ) . map ( |x| x. to_owned ( ) )
105
105
}
106
106
107
- pub fn store_il_for_node ( & mut self , node : & dyn SourceRanged , il : IndentLevel ) {
107
+ pub fn store_il_for_node ( & mut self , node : & impl SourceRanged , il : IndentLevel ) {
108
108
self . stored_il . insert ( ( node. start ( ) , node. end ( ) ) , il) ;
109
109
}
110
110
111
- pub fn get_il_for_node ( & self , node : & dyn SourceRanged ) -> Option < IndentLevel > {
111
+ pub fn get_il_for_node ( & self , node : & impl SourceRanged ) -> Option < IndentLevel > {
112
112
self . stored_il . get ( & ( node. start ( ) , node. end ( ) ) ) . map ( |x| x. to_owned ( ) )
113
113
}
114
114
0 commit comments