mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-24 01:54:23 +03:00
fix box accesses
This commit is contained in:
parent
c9e044d3c3
commit
3870cf785d
@ -159,7 +159,8 @@ impl<'ast> FromPest<'ast> for Expression<'ast> {
|
||||
type Rule = Rule;
|
||||
|
||||
fn from_pest(pest: &mut Pairs<'ast, Rule>) -> Result<Self, ConversionError<Void>> {
|
||||
let pair = pest.peek().ok_or(::from_pest::ConversionError::NoMatch)?;
|
||||
let mut clone = pest.clone();
|
||||
let pair = clone.next().ok_or(::from_pest::ConversionError::NoMatch)?;
|
||||
match pair.as_rule() {
|
||||
Rule::expression => {
|
||||
// Transfer iterated state to pest.
|
||||
|
@ -42,7 +42,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
function_scope.clone(),
|
||||
expected_type,
|
||||
array,
|
||||
span.clone(),
|
||||
span,
|
||||
)? {
|
||||
ConstrainedValue::Array(array) => array,
|
||||
value => return Err(ExpressionError::undefined_array(value.to_string(), span.to_owned())),
|
||||
|
@ -75,7 +75,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
expected_type,
|
||||
left_right.0,
|
||||
left_right.1,
|
||||
span.clone(),
|
||||
&span,
|
||||
)?;
|
||||
|
||||
enforce_add(cs, resolved_left, resolved_right, &span)
|
||||
@ -88,7 +88,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
expected_type,
|
||||
left_right.0,
|
||||
left_right.1,
|
||||
span.clone(),
|
||||
&span,
|
||||
)?;
|
||||
|
||||
enforce_sub(cs, resolved_left, resolved_right, &span)
|
||||
@ -101,7 +101,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
expected_type,
|
||||
left_right.0,
|
||||
left_right.1,
|
||||
span.clone(),
|
||||
&span,
|
||||
)?;
|
||||
|
||||
enforce_mul(cs, resolved_left, resolved_right, &span)
|
||||
@ -114,7 +114,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
expected_type,
|
||||
left_right.0,
|
||||
left_right.1,
|
||||
span.clone(),
|
||||
&span,
|
||||
)?;
|
||||
|
||||
enforce_div(cs, resolved_left, resolved_right, &span)
|
||||
@ -127,7 +127,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
expected_type,
|
||||
left_right.0,
|
||||
left_right.1,
|
||||
span.clone(),
|
||||
&span,
|
||||
)?;
|
||||
|
||||
enforce_pow(cs, resolved_left, resolved_right, &span)
|
||||
@ -146,7 +146,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
expected_type,
|
||||
left_right.0,
|
||||
left_right.1,
|
||||
span.clone(),
|
||||
&span,
|
||||
)?;
|
||||
|
||||
Ok(enforce_or(cs, resolved_left, resolved_right, &span)?)
|
||||
@ -159,7 +159,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
expected_type,
|
||||
left_right.0,
|
||||
left_right.1,
|
||||
span.clone(),
|
||||
&span,
|
||||
)?;
|
||||
|
||||
Ok(enforce_and(cs, resolved_left, resolved_right, &span)?)
|
||||
@ -172,7 +172,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
None,
|
||||
left_right.0,
|
||||
left_right.1,
|
||||
span.clone(),
|
||||
&span,
|
||||
)?;
|
||||
|
||||
Ok(evaluate_eq(cs, resolved_left, resolved_right, &span)?)
|
||||
@ -185,7 +185,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
None,
|
||||
left_right.0,
|
||||
left_right.1,
|
||||
span.clone(),
|
||||
&span,
|
||||
)?;
|
||||
|
||||
Ok(evaluate_ge(cs, resolved_left, resolved_right, &span)?)
|
||||
@ -198,7 +198,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
None,
|
||||
left_right.0,
|
||||
left_right.1,
|
||||
span.clone(),
|
||||
&span,
|
||||
)?;
|
||||
|
||||
Ok(evaluate_gt(cs, resolved_left, resolved_right, &span)?)
|
||||
@ -211,7 +211,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
None,
|
||||
left_right.0,
|
||||
left_right.1,
|
||||
span.clone(),
|
||||
&span,
|
||||
)?;
|
||||
|
||||
Ok(evaluate_le(cs, resolved_left, resolved_right, &span)?)
|
||||
@ -224,7 +224,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
None,
|
||||
left_right.0,
|
||||
left_right.1,
|
||||
span.clone(),
|
||||
&span,
|
||||
)?;
|
||||
|
||||
Ok(evaluate_lt(cs, resolved_left, resolved_right, &span)?)
|
||||
@ -239,7 +239,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
triplet.0,
|
||||
triplet.1,
|
||||
triplet.2,
|
||||
span,
|
||||
&span,
|
||||
),
|
||||
|
||||
// Arrays
|
||||
@ -253,7 +253,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
expected_type,
|
||||
array_w_index.0,
|
||||
array_w_index.1,
|
||||
span,
|
||||
&span,
|
||||
),
|
||||
|
||||
// Tuples
|
||||
|
@ -77,7 +77,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
file_scope,
|
||||
function_scope,
|
||||
indicator,
|
||||
variable_name,
|
||||
&variable_name,
|
||||
assignee_w_range_or_expression.1,
|
||||
new_value,
|
||||
span,
|
||||
|
@ -23,7 +23,7 @@ use snarkos_models::curves::{Field, PrimeField};
|
||||
|
||||
pub fn resolve_assignee(scope: &str, assignee: Assignee) -> String {
|
||||
match assignee {
|
||||
Assignee::Identifier(name) => new_scope(scope, name.to_string()),
|
||||
Assignee::Identifier(name) => new_scope(scope, &name.to_string()),
|
||||
Assignee::Array(array_w_index) => resolve_assignee(scope, array_w_index.0),
|
||||
Assignee::Tuple(tuple, _index) => resolve_assignee(scope, *tuple),
|
||||
Assignee::CircuitField(circuit_name, _member) => resolve_assignee(scope, *circuit_name),
|
||||
|
Loading…
Reference in New Issue
Block a user