1
0
Fork 0
mirror of synced 2025-09-24 04:40:05 +00:00

address review comments

This commit is contained in:
schaeff 2019-08-20 12:38:32 +02:00
parent a3f9eafb73
commit 1412ef2ef1
5 changed files with 18 additions and 13 deletions

View file

@ -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.

View file

@ -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 {

View file

@ -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

View file

@ -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
///

View file

@ -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),
}
}