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

merge dev

This commit is contained in:
schaeff 2020-05-19 13:35:31 +02:00
parent 23ffe25429
commit 1bd5c06b64
3 changed files with 11 additions and 10 deletions

8
Cargo.lock generated
View file

@ -484,12 +484,12 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50c052fa6d4c2f12305ec364bfb8ef884836f3f61ea015b202372ff996d1ac4b"
dependencies = [
"num-bigint 0.2.6",
"num-bigint",
"num-integer",
"num-traits 0.2.11",
"proc-macro2 1.0.10",
"quote 1.0.3",
"syn 1.0.17",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.19",
]
[[package]]

View file

@ -141,7 +141,7 @@ mod integration {
let abi: Abi = from_reader(&mut reader)
.map_err(|why| why.to_string())
.unwrap();
.unwrap();
let signature = abi.signature().clone();

View file

@ -19,6 +19,7 @@ use std::path::PathBuf;
use typed_absy::abi::Abi;
use typed_absy::TypedProgram;
use typed_arena::Arena;
use zir::ZirProgram;
use zokrates_common::Resolver;
use zokrates_field::Field;
use zokrates_pest_ast as pest;
@ -150,9 +151,7 @@ pub fn compile<T: Field, E: Into<imports::Error>>(
) -> Result<CompilationArtifacts<T>, CompileErrors> {
let arena = Arena::new();
let typed_ast = check_with_arena(source, location, resolver, &arena)?;
let abi = typed_ast.abi();
let (typed_ast, abi) = check_with_arena(source, location, resolver, &arena)?;
// flatten input program
let program_flattened = Flattener::flatten(typed_ast);
@ -190,7 +189,7 @@ fn check_with_arena<'ast, T: Field, E: Into<imports::Error>>(
location: FilePath,
resolver: Option<&dyn Resolver<E>>,
arena: &'ast Arena<String>,
) -> Result<TypedProgram<'ast, T>, CompileErrors> {
) -> Result<(ZirProgram<'ast, T>, Abi), CompileErrors> {
let source = arena.alloc(source);
let compiled = compile_program(source, location.clone(), resolver, &arena)?;
@ -199,10 +198,12 @@ fn check_with_arena<'ast, T: Field, E: Into<imports::Error>>(
CompileErrors(errors.into_iter().map(|e| CompileError::from(e)).collect())
})?;
let abi = typed_ast.abi();
// analyse (unroll and constant propagation)
let typed_ast = typed_ast.analyse();
Ok(typed_ast)
Ok((typed_ast, abi))
}
pub fn compile_program<'ast, T: Field, E: Into<imports::Error>>(