Reduce size of scope entry.
This commit is contained in:
parent
43fdf3f962
commit
c2bb1f48c2
@ -646,12 +646,12 @@ fn optimize<'a>(
|
|||||||
.filter(|ScopeEntry { typ, expr, .. }| {
|
.filter(|ScopeEntry { typ, expr, .. }| {
|
||||||
// Get all the constants with definite constant expressions
|
// Get all the constants with definite constant expressions
|
||||||
*typ == ScopeEntryType::Constant
|
*typ == ScopeEntryType::Constant
|
||||||
&& expr.as_ref().map(Expr::is_constant).unwrap_or(false)
|
&& expr.as_ref().map(|v| v.is_constant()).unwrap_or(false)
|
||||||
})
|
})
|
||||||
.for_each(|ScopeEntry { name, expr, .. }| {
|
.for_each(|ScopeEntry { name, expr, .. }| {
|
||||||
state.push_constant(
|
state.push_constant(
|
||||||
name.as_ref(),
|
name.as_ref(),
|
||||||
expr.as_ref().expect("should be Some(expr)").clone(),
|
(**expr.as_ref().expect("should be Some(expr)")).clone(),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ pub struct Entry<'a> {
|
|||||||
/// Current value of the entry.
|
/// Current value of the entry.
|
||||||
pub value: Dynamic,
|
pub value: Dynamic,
|
||||||
/// A constant expression if the initial value matches one of the recognized types.
|
/// A constant expression if the initial value matches one of the recognized types.
|
||||||
pub expr: Option<Expr>,
|
pub expr: Option<Box<Expr>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Information about a particular entry in the Scope.
|
/// Information about a particular entry in the Scope.
|
||||||
@ -227,7 +227,7 @@ impl<'a> Scope<'a> {
|
|||||||
map_expr: bool,
|
map_expr: bool,
|
||||||
) {
|
) {
|
||||||
let expr = if map_expr {
|
let expr = if map_expr {
|
||||||
map_dynamic_to_expr(value.clone(), Position::none())
|
map_dynamic_to_expr(value.clone(), Position::none()).map(Box::new)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user