From 4db956d7ea5a7f2befe6b79c7c5d10bc8b52e211 Mon Sep 17 00:00:00 2001 From: schaeff Date: Thu, 25 Jul 2019 18:36:57 +0200 Subject: [PATCH] make resolve string based only, remove automatic alias for now --- zokrates_cli/src/bin.rs | 2 +- zokrates_core/Cargo.toml | 2 +- zokrates_core/src/compile.rs | 2 +- zokrates_core/src/imports.rs | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/zokrates_cli/src/bin.rs b/zokrates_cli/src/bin.rs index 42166900..3b75877b 100644 --- a/zokrates_cli/src/bin.rs +++ b/zokrates_cli/src/bin.rs @@ -27,7 +27,7 @@ fn main() { }) } -fn resolve<'a>(location: String, source: &'a str) -> Result<(String, String, &'a str), io::Error> { +fn resolve<'a>(location: String, source: &'a str) -> Result<(String, String), io::Error> { #[cfg(feature = "github")] { if is_github_import(source) { diff --git a/zokrates_core/Cargo.toml b/zokrates_core/Cargo.toml index 3c885c86..8801f8fe 100644 --- a/zokrates_core/Cargo.toml +++ b/zokrates_core/Cargo.toml @@ -44,4 +44,4 @@ assert_cli = "0.5" [build-dependencies] cc = { version = "1.0", features = ["parallel"], optional = true } cmake = { version = "0.1.31", optional = true } -git2 = { version = "0.8.0", optional = true } \ No newline at end of file +git2 = { version = "0.8.0", optional = true } diff --git a/zokrates_core/src/compile.rs b/zokrates_core/src/compile.rs index 8387751f..6d6a2639 100644 --- a/zokrates_core/src/compile.rs +++ b/zokrates_core/src/compile.rs @@ -120,7 +120,7 @@ impl fmt::Display for CompileErrorInner { } } -pub type Resolve = fn(String, &str) -> Result<(String, String, &str), E>; +pub type Resolve = fn(String, String) -> Result<(String, String), E>; pub fn compile>( source: String, diff --git a/zokrates_core/src/imports.rs b/zokrates_core/src/imports.rs index 4dadf0e7..451fff4e 100644 --- a/zokrates_core/src/imports.rs +++ b/zokrates_core/src/imports.rs @@ -166,14 +166,14 @@ impl Importer { } else { // to resolve imports, we need a resolver match resolve_option { - Some(resolve) => match resolve(location.clone(), &import.source) { - Ok((source, location, alias)) => { + Some(resolve) => match resolve(location.clone(), import.source.to_string()) { + Ok((source, location)) => { let source = arena.alloc(source); let compiled = compile_module(source, location, resolve_option, modules, &arena) .map_err(|e| e.with_context(import.source.to_string()))?; - let alias = import.alias.clone().unwrap_or(alias); + let alias = import.alias.clone().unwrap(); modules.insert(import.source.to_string(), compiled);