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

make resolve string based only, remove automatic alias for now

This commit is contained in:
schaeff 2019-07-25 18:36:57 +02:00
parent 3d5971b1dc
commit 4db956d7ea
4 changed files with 6 additions and 6 deletions

View file

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

View file

@ -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 }
git2 = { version = "0.8.0", optional = true }

View file

@ -120,7 +120,7 @@ impl fmt::Display for CompileErrorInner {
}
}
pub type Resolve<E> = fn(String, &str) -> Result<(String, String, &str), E>;
pub type Resolve<E> = fn(String, String) -> Result<(String, String), E>;
pub fn compile<T: Field, E: Into<imports::Error>>(
source: String,

View file

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