@@ -426,7 +426,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
426
426
} => Ok ( self . infer_echo ( location, keyword_end, expression, message) ) ,
427
427
428
428
UntypedExpr :: Var { location, name, .. } => {
429
- self . infer_var ( name, location, ReferenceRegistration :: RegisterReferences )
429
+ self . infer_var ( name, location, ReferenceRegistration :: Register )
430
430
}
431
431
432
432
UntypedExpr :: Int {
@@ -1329,11 +1329,9 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
1329
1329
// If the left-hand-side of the record access is a variable, this might actually be
1330
1330
// module access. In that case, we only want to register a reference to the variable
1331
1331
// if we actually referencing it in the record access.
1332
- UntypedExpr :: Var { location, name } => self . infer_var (
1333
- name,
1334
- location,
1335
- ReferenceRegistration :: DoNotRegisterReferences ,
1336
- ) ,
1332
+ UntypedExpr :: Var { location, name } => {
1333
+ self . infer_var ( name, location, ReferenceRegistration :: DoNotRegister )
1334
+ }
1337
1335
_ => self . infer_or_error ( container) ,
1338
1336
} ;
1339
1337
// TODO: is this clone avoidable? we need to box the record for inference in both
@@ -3523,12 +3521,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
3523
3521
name : & EcoString ,
3524
3522
location : & SrcSpan ,
3525
3523
) -> Result < ValueConstructor , Error > {
3526
- self . do_infer_value_constructor (
3527
- module,
3528
- name,
3529
- location,
3530
- ReferenceRegistration :: RegisterReferences ,
3531
- )
3524
+ self . do_infer_value_constructor ( module, name, location, ReferenceRegistration :: Register )
3532
3525
}
3533
3526
3534
3527
fn do_infer_value_constructor (
@@ -3600,10 +3593,9 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
3600
3593
self . narrow_implementations ( * location, & variant) ?;
3601
3594
3602
3595
match register_reference {
3603
- ReferenceRegistration :: DoNotRegisterReferences => ( ) ,
3596
+ ReferenceRegistration :: DoNotRegister => ( ) ,
3604
3597
3605
- ReferenceRegistration :: RegisterReferences
3606
- | ReferenceRegistration :: VariableArgumentReferences { .. } => {
3598
+ ReferenceRegistration :: Register | ReferenceRegistration :: VariableArgument { .. } => {
3607
3599
self . register_value_constructor_reference (
3608
3600
name,
3609
3601
& variant,
@@ -3634,7 +3626,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
3634
3626
register_reference : & ReferenceRegistration ,
3635
3627
) {
3636
3628
// If we are registering references for a call argument
3637
- let ReferenceRegistration :: VariableArgumentReferences {
3629
+ let ReferenceRegistration :: VariableArgument {
3638
3630
called_function,
3639
3631
argument_index,
3640
3632
} = register_reference
@@ -3657,7 +3649,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
3657
3649
3658
3650
// If the called function is the same where the argument is defined,
3659
3651
// and the argument is passed unchanged.
3660
- if declaration_function. as_ref ( ) == dbg ! ( Some ( called_function) )
3652
+ if declaration_function. as_ref ( ) == Some ( called_function)
3661
3653
&& declaration_index == argument_index
3662
3654
{
3663
3655
self . environment . increment_recursive_usage ( name) ;
@@ -4539,12 +4531,12 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
4539
4531
} = called_function
4540
4532
&& * module == self . environment . current_module
4541
4533
{
4542
- ReferenceRegistration :: VariableArgumentReferences {
4534
+ ReferenceRegistration :: VariableArgument {
4543
4535
called_function : name. clone ( ) ,
4544
4536
argument_index,
4545
4537
}
4546
4538
} else {
4547
- ReferenceRegistration :: RegisterReferences
4539
+ ReferenceRegistration :: Register
4548
4540
} ;
4549
4541
4550
4542
match self . infer_var ( argument_name, argument_location, references) {
@@ -4823,14 +4815,17 @@ fn is_trusted_pure_module(environment: &Environment<'_>) -> bool {
4823
4815
4824
4816
#[ derive( Debug , Clone ) ]
4825
4817
enum ReferenceRegistration {
4826
- RegisterReferences ,
4827
- DoNotRegisterReferences ,
4828
-
4829
- /// If the variable is being passed to a function that is defined in the
4830
- /// current module, then this will have the name of the function and the
4831
- /// argument of the variable being passed as an argument
4832
- VariableArgumentReferences {
4818
+ Register ,
4819
+ DoNotRegister ,
4820
+
4821
+ /// A special case that happens if we're registering references for
4822
+ /// a variable call argument being passed to a function defined in the
4823
+ /// current module.
4824
+ VariableArgument {
4825
+ /// The name of the function being called, the function is defined in
4826
+ /// the current module.
4833
4827
called_function : EcoString ,
4828
+ /// The position where the variable is being passed as an argument.
4834
4829
argument_index : usize ,
4835
4830
} ,
4836
4831
}
0 commit comments