address review comments
This commit is contained in:
parent
a3f9eafb73
commit
1412ef2ef1
5 changed files with 18 additions and 13 deletions
|
@ -71,11 +71,19 @@ import "utils/pack/unpack128"
|
|||
|
||||
Unpacks a field element to 128 field elements.
|
||||
|
||||
#### unpack256
|
||||
#### pack256
|
||||
|
||||
```zokrates
|
||||
import "utils/pack/unpack256"
|
||||
import "utils/pack/pack256"
|
||||
```
|
||||
|
||||
Unpacks a field element to 256 field elements.
|
||||
Packs 256 field elements as one. Overflows can occur.
|
||||
|
||||
#### nonStrictUnpack256
|
||||
|
||||
```zokrates
|
||||
import "utils/pack/nonStrictUnpack256"
|
||||
```
|
||||
|
||||
Unpacks a field element to 256 field elements. Uniqueness of the output is not guaranteed.
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ impl<'ast, T: Field> From<pest::Function<'ast>> for absy::FunctionDeclarationNod
|
|||
.collect(),
|
||||
signature,
|
||||
}
|
||||
.span(span.clone()); // TODO check
|
||||
.span(span.clone());
|
||||
|
||||
absy::FunctionDeclaration {
|
||||
id,
|
||||
|
@ -554,8 +554,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn return_forty_two() {
|
||||
let source = "def main() -> (field): return 42
|
||||
";
|
||||
let source = "def main() -> (field): return 42";
|
||||
let ast = pest::generate_ast(&source).unwrap();
|
||||
let expected: absy::Module<FieldPrime> = absy::Module {
|
||||
functions: vec![absy::FunctionDeclaration {
|
||||
|
@ -588,8 +587,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn return_true() {
|
||||
let source = "def main() -> (bool): return true
|
||||
";
|
||||
let source = "def main() -> (bool): return true";
|
||||
let ast = pest::generate_ast(&source).unwrap();
|
||||
let expected: absy::Module<FieldPrime> = absy::Module {
|
||||
functions: vec![absy::FunctionDeclaration {
|
||||
|
@ -619,8 +617,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn arguments() {
|
||||
let source = "def main(private field a, bool b) -> (field): return 42
|
||||
";
|
||||
let source = "def main(private field a, bool b) -> (field): return 42";
|
||||
let ast = pest::generate_ast(&source).unwrap();
|
||||
|
||||
let expected: absy::Module<FieldPrime> = absy::Module {
|
||||
|
|
|
@ -22,7 +22,7 @@ use zokrates_field::field::Field;
|
|||
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// An identifier in a function or a variable
|
||||
/// An identifier of a function or a variable
|
||||
pub type Identifier<'ast> = &'ast str;
|
||||
|
||||
/// The identifier of a `Module`, typically a path or uri
|
||||
|
|
|
@ -29,7 +29,7 @@ impl<'ast, T: Field> Flattener<'ast, T> {
|
|||
Flattener::new().flatten_program(p)
|
||||
}
|
||||
|
||||
/// Returns a `Flattener` with fresh a fresh [substitution] and [variables].
|
||||
/// Returns a `Flattener` with fresh [substitution] and [variables].
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
|
|
|
@ -37,7 +37,7 @@ impl Type {
|
|||
match *self {
|
||||
Type::FieldElement => String::from("f"),
|
||||
Type::Boolean => String::from("b"),
|
||||
Type::FieldElementArray(size) => format!("{}[{}]", Type::FieldElement.to_slug(), size), // TODO differentiate types?
|
||||
Type::FieldElementArray(size) => format!("{}[{}]", Type::FieldElement.to_slug(), size),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue