1+ use std:: collections:: { HashMap , HashSet } ;
2+ use std:: path:: { Path , PathBuf } ;
3+ use std:: error:: Error ;
4+
5+ use log:: { info, warn, error} ;
6+ use runtime_tracing:: { CallKey , Line , StepId , TypeKind , TypeRecord , TypeSpecificInfo } ;
7+
18use crate :: {
29 db:: { Db , DbRecordEvent } ,
310 expr_loader:: ExprLoader ,
411 task:: {
512 Action , BranchesTaken , CoreTrace , FlowEvent , FlowStep , FlowUpdate , FlowUpdateState , FlowUpdateStateKind ,
613 FlowMode , FlowViewUpdate , Iteration , Location , Loop , LoopId , LoopIterationSteps , Position , RRTicks , StepCount , TraceKind ,
714 } ,
15+ lang:: { lang_from_context, Lang } ,
816 replay:: Replay ,
917 value:: { to_ct_value, Value , ValueRecordWithType } ,
1018} ;
11- use log:: { info, warn, error} ;
12- use runtime_tracing:: { CallKey , Line , StepId , TypeKind , TypeRecord , TypeSpecificInfo } ;
13- use std:: collections:: { HashMap , HashSet } ;
14- use std:: path:: PathBuf ;
15- use std:: error:: Error ;
1619
1720#[ derive( Debug ) ]
1821pub struct FlowPreloader {
@@ -109,6 +112,7 @@ pub struct CallFlowPreloader<'a> {
109112 diff_call_keys : HashSet < i64 > , // TODO: if we add Eq, Hash it seems we can do CallKey
110113 mode : FlowMode ,
111114 trace_kind : TraceKind ,
115+ lang : Lang ,
112116}
113117
114118impl < ' a > CallFlowPreloader < ' a > {
@@ -121,14 +125,15 @@ impl<'a> CallFlowPreloader<'a> {
121125 trace_kind : TraceKind ) -> Self {
122126 CallFlowPreloader {
123127 flow_preloader,
124- location,
128+ location : location . clone ( ) ,
125129 active_loops : vec ! [ ] ,
126130 last_step_id : StepId ( -1 ) ,
127131 last_expr_order : vec ! [ ] ,
128132 diff_lines,
129133 diff_call_keys,
130134 mode,
131135 trace_kind,
136+ lang : lang_from_context ( & Path :: new ( & location. path ) , trace_kind) ,
132137 }
133138 }
134139
@@ -190,7 +195,7 @@ impl<'a> CallFlowPreloader<'a> {
190195 // are never None, so it is safe to unwrap them.
191196 if !flow_view_update. steps . is_empty ( ) {
192197
193- let return_value_record = replay. load_return_value ( ) . unwrap_or ( ValueRecordWithType :: Error {
198+ let return_value_record = replay. load_return_value ( self . lang ) . unwrap_or ( ValueRecordWithType :: Error {
194199 msg : "<return value error>" . to_string ( ) ,
195200 typ : TypeRecord { kind : TypeKind :: Error , lang_type : "<error>" . to_string ( ) , specific_info : TypeSpecificInfo :: None } ,
196201 } ) ;
@@ -521,7 +526,7 @@ impl<'a> CallFlowPreloader<'a> {
521526 if let Some ( var_list) = self . flow_preloader . get_var_list ( line, & self . location ) {
522527 info ! ( "var_list {:?}" , var_list. clone( ) ) ;
523528 for value_name in & var_list {
524- if let Ok ( value) = replay. load_value ( value_name) {
529+ if let Ok ( value) = replay. load_value ( value_name, self . lang ) {
525530 // if variable_map.contains_key(value_name) {
526531 let ct_value = to_ct_value ( & value) ;
527532 flow_view_update
0 commit comments