rename circuit_field -> circuit_variable in compiler

This commit is contained in:
collin 2020-09-02 14:13:27 -07:00
parent d33ca81869
commit 2d52dd2444
4 changed files with 15 additions and 15 deletions

View File

@ -56,22 +56,22 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
for member in circuit.members.clone().into_iter() {
match member {
CircuitMember::CircuitVariable(identifier, _type) => {
let matched_field = members
let matched_variable = members
.clone()
.into_iter()
.find(|field| field.identifier.eq(&identifier));
match matched_field {
Some(field) => {
.find(|variable| variable.identifier.eq(&identifier));
match matched_variable {
Some(variable) => {
// Resolve and enforce circuit object
let field_value = self.enforce_expression(
let variable_value = self.enforce_expression(
cs,
file_scope.clone(),
function_scope.clone(),
Some(_type.clone()),
field.expression,
variable.expression,
)?;
resolved_members.push(ConstrainedCircuitMember(identifier, field_value))
resolved_members.push(ConstrainedCircuitMember(identifier, variable_value))
}
None => return Err(ExpressionError::expected_circuit_member(identifier.to_string(), span)),
}

View File

@ -80,7 +80,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
),
Assignee::Tuple(_tuple, index) => self.assign_tuple(cs, indicator, variable_name, index, new_value, span),
Assignee::CircuitField(_assignee, object_name) => {
self.mutute_circuit_field(cs, indicator, variable_name, object_name, new_value, span)
self.mutute_circuit_variable(cs, indicator, variable_name, object_name, new_value, span)
}
}
}

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
//! Enforces a circuit field assignment statement in a compiled Leo program.
//! Enforces a circuit variable assignment statement in a compiled Leo program.
use crate::{errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use leo_typed::{Identifier, Span};
@ -28,7 +28,7 @@ use snarkos_models::{
};
impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
pub fn mutute_circuit_field<CS: ConstraintSystem<F>>(
pub fn mutute_circuit_variable<CS: ConstraintSystem<F>>(
&mut self,
cs: &mut CS,
indicator: Option<Boolean>,
@ -41,10 +41,10 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
match self.get_mutable_assignee(circuit_name, span.clone())? {
ConstrainedValue::CircuitExpression(_variable, members) => {
// Modify the circuit field in place
let matched_field = members.into_iter().find(|object| object.0 == object_name);
// Modify the circuit variable in place
let matched_variable = members.into_iter().find(|object| object.0 == object_name);
match matched_field {
match matched_variable {
Some(object) => match &object.1 {
ConstrainedValue::Function(_circuit_identifier, function) => {
return Err(StatementError::immutable_circuit_function(

View File

@ -25,8 +25,8 @@ pub use self::assign::*;
pub mod assignee;
pub use self::assignee::*;
pub mod circuit_field;
pub use self::circuit_field::*;
pub mod circuit_variable;
pub use self::circuit_variable::*;
pub mod tuple;
pub use self::tuple::*;