mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-24 18:12:28 +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;
|
type Rule = Rule;
|
||||||
|
|
||||||
fn from_pest(pest: &mut Pairs<'ast, Rule>) -> Result<Self, ConversionError<Void>> {
|
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() {
|
match pair.as_rule() {
|
||||||
Rule::expression => {
|
Rule::expression => {
|
||||||
// Transfer iterated state to pest.
|
// Transfer iterated state to pest.
|
||||||
|
@ -42,7 +42,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
|||||||
function_scope.clone(),
|
function_scope.clone(),
|
||||||
expected_type,
|
expected_type,
|
||||||
array,
|
array,
|
||||||
span.clone(),
|
span,
|
||||||
)? {
|
)? {
|
||||||
ConstrainedValue::Array(array) => array,
|
ConstrainedValue::Array(array) => array,
|
||||||
value => return Err(ExpressionError::undefined_array(value.to_string(), span.to_owned())),
|
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,
|
expected_type,
|
||||||
left_right.0,
|
left_right.0,
|
||||||
left_right.1,
|
left_right.1,
|
||||||
span.clone(),
|
&span,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
enforce_add(cs, resolved_left, resolved_right, &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,
|
expected_type,
|
||||||
left_right.0,
|
left_right.0,
|
||||||
left_right.1,
|
left_right.1,
|
||||||
span.clone(),
|
&span,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
enforce_sub(cs, resolved_left, resolved_right, &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,
|
expected_type,
|
||||||
left_right.0,
|
left_right.0,
|
||||||
left_right.1,
|
left_right.1,
|
||||||
span.clone(),
|
&span,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
enforce_mul(cs, resolved_left, resolved_right, &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,
|
expected_type,
|
||||||
left_right.0,
|
left_right.0,
|
||||||
left_right.1,
|
left_right.1,
|
||||||
span.clone(),
|
&span,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
enforce_div(cs, resolved_left, resolved_right, &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,
|
expected_type,
|
||||||
left_right.0,
|
left_right.0,
|
||||||
left_right.1,
|
left_right.1,
|
||||||
span.clone(),
|
&span,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
enforce_pow(cs, resolved_left, resolved_right, &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,
|
expected_type,
|
||||||
left_right.0,
|
left_right.0,
|
||||||
left_right.1,
|
left_right.1,
|
||||||
span.clone(),
|
&span,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(enforce_or(cs, resolved_left, resolved_right, &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,
|
expected_type,
|
||||||
left_right.0,
|
left_right.0,
|
||||||
left_right.1,
|
left_right.1,
|
||||||
span.clone(),
|
&span,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(enforce_and(cs, resolved_left, resolved_right, &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,
|
None,
|
||||||
left_right.0,
|
left_right.0,
|
||||||
left_right.1,
|
left_right.1,
|
||||||
span.clone(),
|
&span,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(evaluate_eq(cs, resolved_left, resolved_right, &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,
|
None,
|
||||||
left_right.0,
|
left_right.0,
|
||||||
left_right.1,
|
left_right.1,
|
||||||
span.clone(),
|
&span,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(evaluate_ge(cs, resolved_left, resolved_right, &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,
|
None,
|
||||||
left_right.0,
|
left_right.0,
|
||||||
left_right.1,
|
left_right.1,
|
||||||
span.clone(),
|
&span,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(evaluate_gt(cs, resolved_left, resolved_right, &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,
|
None,
|
||||||
left_right.0,
|
left_right.0,
|
||||||
left_right.1,
|
left_right.1,
|
||||||
span.clone(),
|
&span,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(evaluate_le(cs, resolved_left, resolved_right, &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,
|
None,
|
||||||
left_right.0,
|
left_right.0,
|
||||||
left_right.1,
|
left_right.1,
|
||||||
span.clone(),
|
&span,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(evaluate_lt(cs, resolved_left, resolved_right, &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.0,
|
||||||
triplet.1,
|
triplet.1,
|
||||||
triplet.2,
|
triplet.2,
|
||||||
span,
|
&span,
|
||||||
),
|
),
|
||||||
|
|
||||||
// Arrays
|
// Arrays
|
||||||
@ -253,7 +253,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
|||||||
expected_type,
|
expected_type,
|
||||||
array_w_index.0,
|
array_w_index.0,
|
||||||
array_w_index.1,
|
array_w_index.1,
|
||||||
span,
|
&span,
|
||||||
),
|
),
|
||||||
|
|
||||||
// Tuples
|
// Tuples
|
||||||
|
@ -77,7 +77,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
|||||||
file_scope,
|
file_scope,
|
||||||
function_scope,
|
function_scope,
|
||||||
indicator,
|
indicator,
|
||||||
variable_name,
|
&variable_name,
|
||||||
assignee_w_range_or_expression.1,
|
assignee_w_range_or_expression.1,
|
||||||
new_value,
|
new_value,
|
||||||
span,
|
span,
|
||||||
|
@ -23,7 +23,7 @@ use snarkos_models::curves::{Field, PrimeField};
|
|||||||
|
|
||||||
pub fn resolve_assignee(scope: &str, assignee: Assignee) -> String {
|
pub fn resolve_assignee(scope: &str, assignee: Assignee) -> String {
|
||||||
match assignee {
|
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::Array(array_w_index) => resolve_assignee(scope, array_w_index.0),
|
||||||
Assignee::Tuple(tuple, _index) => resolve_assignee(scope, *tuple),
|
Assignee::Tuple(tuple, _index) => resolve_assignee(scope, *tuple),
|
||||||
Assignee::CircuitField(circuit_name, _member) => resolve_assignee(scope, *circuit_name),
|
Assignee::CircuitField(circuit_name, _member) => resolve_assignee(scope, *circuit_name),
|
||||||
|
Loading…
Reference in New Issue
Block a user