Skip to content

Commit

Permalink
Rename NumValueExpression -> NumberWithUnitExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
ogoffart committed Aug 15, 2024
1 parent 9b71cf1 commit 8a0df2b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions internal/compiler/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ impl LookupObject for Expression {
NumberExpression(self).for_each_entry(ctx, f)
}
ty if ty.as_unit_product().is_some() => {
NumValueExpression(self).for_each_entry(ctx, f)
NumberWithUnitExpression(self).for_each_entry(ctx, f)
}
_ => None,
},
Expand All @@ -990,7 +990,9 @@ impl LookupObject for Expression {
Type::Float32 | Type::Int32 | Type::Percent => {
NumberExpression(self).lookup(ctx, name)
}
ty if ty.as_unit_product().is_some() => NumValueExpression(self).lookup(ctx, name),
ty if ty.as_unit_product().is_some() => {
NumberWithUnitExpression(self).lookup(ctx, name)
}
_ => None,
},
}
Expand Down Expand Up @@ -1145,13 +1147,13 @@ impl<'a> LookupObject for NumberExpression<'a> {
.or_else(|| f("atan", member_function(BuiltinFunction::ATan)))
.or_else(|| f("log", member_function(BuiltinFunction::Log)))
.or_else(|| f("pow", member_function(BuiltinFunction::Pow)))
.or_else(|| NumValueExpression(self.0).for_each_entry(ctx, f))
.or_else(|| NumberWithUnitExpression(self.0).for_each_entry(ctx, f))
}
}

/// An expression of any numerical value with an unit
struct NumValueExpression<'a>(&'a Expression);
impl<'a> LookupObject for NumValueExpression<'a> {
struct NumberWithUnitExpression<'a>(&'a Expression);
impl<'a> LookupObject for NumberWithUnitExpression<'a> {
fn for_each_entry<R>(
&self,
ctx: &LookupCtx,
Expand Down

0 comments on commit 8a0df2b

Please sign in to comment.