fix circuit function struct in core module

This commit is contained in:
collin 2020-11-23 16:01:30 -05:00
parent efe734afaf
commit 1b1cfd015d

View File

@ -61,72 +61,69 @@ impl CoreCircuit for Blake2sCircuit {
fn ast(circuit_name: Identifier, span: Span) -> Circuit {
Circuit {
circuit_name,
members: vec![CircuitMember::CircuitFunction(
true, // static function
Function {
identifier: Identifier {
name: "hash".to_owned(),
members: vec![CircuitMember::CircuitFunction(Function {
identifier: Identifier {
name: "hash".to_owned(),
span: span.clone(),
},
input: vec![
FunctionInput::Variable(FunctionInputVariable {
identifier: Identifier {
name: "seed".to_owned(),
span: span.clone(),
},
mutable: false,
type_: Type::Array(
Box::new(Type::IntegerType(IntegerType::U8)),
ArrayDimensions(vec![PositiveNumber {
value: 32usize.to_string(),
span: span.clone(),
}]),
),
span: span.clone(),
},
input: vec![
FunctionInput::Variable(FunctionInputVariable {
identifier: Identifier {
}),
FunctionInput::Variable(FunctionInputVariable {
identifier: Identifier {
name: "message".to_owned(),
span: span.clone(),
},
mutable: false,
type_: Type::Array(
Box::new(Type::IntegerType(IntegerType::U8)),
ArrayDimensions(vec![PositiveNumber {
value: 32usize.to_string(),
span: span.clone(),
}]),
),
span: span.clone(),
}),
],
output: Some(Type::Array(
Box::new(Type::IntegerType(IntegerType::U8)),
ArrayDimensions(vec![PositiveNumber {
value: 32usize.to_string(),
span: span.clone(),
}]),
)),
statements: vec![Statement::Return(
Expression::CoreFunctionCall(
Self::name(),
vec![
Expression::Identifier(Identifier {
name: "seed".to_owned(),
span: span.clone(),
},
mutable: false,
type_: Type::Array(
Box::new(Type::IntegerType(IntegerType::U8)),
ArrayDimensions(vec![PositiveNumber {
value: 32usize.to_string(),
span: span.clone(),
}]),
),
span: span.clone(),
}),
FunctionInput::Variable(FunctionInputVariable {
identifier: Identifier {
}),
Expression::Identifier(Identifier {
name: "message".to_owned(),
span: span.clone(),
},
mutable: false,
type_: Type::Array(
Box::new(Type::IntegerType(IntegerType::U8)),
ArrayDimensions(vec![PositiveNumber {
value: 32usize.to_string(),
span: span.clone(),
}]),
),
span: span.clone(),
}),
],
output: Some(Type::Array(
Box::new(Type::IntegerType(IntegerType::U8)),
ArrayDimensions(vec![PositiveNumber {
value: 32usize.to_string(),
span: span.clone(),
}]),
)),
statements: vec![Statement::Return(
Expression::CoreFunctionCall(
Self::name(),
vec![
Expression::Identifier(Identifier {
name: "seed".to_owned(),
span: span.clone(),
}),
Expression::Identifier(Identifier {
name: "message".to_owned(),
span: span.clone(),
}),
],
span.clone(),
),
}),
],
span.clone(),
)],
span,
},
)],
),
span.clone(),
)],
span,
})],
}
}