@@ -10,8 +10,7 @@ mod management;
1010
1111use core:: panic;
1212use evaluation_context:: {
13- Arg , BlockNode , BranchControlFlow , EvalControlFlow , EvaluationContext , MutableKind , MutableVar ,
14- Scope ,
13+ Arg , BlockNode , BranchControlFlow , EvalControlFlow , EvaluationContext , MutableKind , Scope ,
1514} ;
1615use management:: { QuantumIntrinsicsChecker , ResourceManager } ;
1716use miette:: Diagnostic ;
@@ -223,11 +222,11 @@ impl<'a> PartialEvaluator<'a> {
223222 }
224223
225224 // Always bind the value to the hybrid map but do it differently depending of the value type.
226- if let Some ( ( var_id, mutable_var ) ) = self . try_create_mutable_variable ( ident. id , & value) {
225+ if let Some ( ( var_id, mutable_kind ) ) = self . try_create_mutable_variable ( ident. id , & value) {
227226 // Keep track of whether the mutable variable is static or dynamic.
228227 self . eval_context
229228 . get_current_scope_mut ( )
230- . insert_mutable_var ( var_id, mutable_var ) ;
229+ . insert_mutable_var ( var_id, mutable_kind ) ;
231230 } else {
232231 self . bind_value_in_hybrid_map ( ident, value) ;
233232 }
@@ -1743,10 +1742,8 @@ impl<'a> PartialEvaluator<'a> {
17431742 // the variable if it is static at this moment.
17441743 if let Value :: Var ( var) = bound_value {
17451744 let current_scope = self . eval_context . get_current_scope ( ) ;
1746- if let Some ( MutableVar {
1747- kind : MutableKind :: Static ( literal) ,
1748- ..
1749- } ) = current_scope. find_mutable_var ( var. id . into ( ) )
1745+ if let Some ( MutableKind :: Static ( literal) ) =
1746+ current_scope. find_mutable_kind ( var. id . into ( ) )
17501747 {
17511748 map_rir_literal_to_eval_value ( * literal)
17521749 } else {
@@ -2164,7 +2161,7 @@ impl<'a> PartialEvaluator<'a> {
21642161 & mut self ,
21652162 local_var_id : LocalVarId ,
21662163 value : & Value ,
2167- ) -> Option < ( rir:: VariableId , MutableVar ) > {
2164+ ) -> Option < ( rir:: VariableId , MutableKind ) > {
21682165 // Check if we can create a mutable variable for this value.
21692166 let var_ty = try_get_eval_var_type ( value) ?;
21702167
@@ -2189,11 +2186,8 @@ impl<'a> PartialEvaluator<'a> {
21892186 Operand :: Literal ( literal) => MutableKind :: Static ( literal) ,
21902187 Operand :: Variable ( _) => MutableKind :: Dynamic ,
21912188 } ;
2192- let mutable_var = MutableVar {
2193- id : local_var_id,
2194- kind : mutable_kind,
2195- } ;
2196- Some ( ( var_id, mutable_var) )
2189+
2190+ Some ( ( var_id, mutable_kind) )
21972191 }
21982192
21992193 fn get_or_insert_callable ( & mut self , callable : Callable ) -> CallableId {
@@ -2485,8 +2479,9 @@ impl<'a> PartialEvaluator<'a> {
24852479 if matches ! ( rhs_operand, Operand :: Variable ( _) )
24862480 || current_scope. is_currently_evaluating_branch ( )
24872481 {
2488- if let Some ( mutable_var) = current_scope. find_mutable_var_mut ( rir_var. variable_id ) {
2489- mutable_var. kind = MutableKind :: Dynamic ;
2482+ if let Some ( mutable_kind) = current_scope. find_mutable_var_mut ( rir_var. variable_id )
2483+ {
2484+ * mutable_kind = MutableKind :: Dynamic ;
24902485 }
24912486 }
24922487 } else {
0 commit comments