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

add error message if alias inference fails, fmt

This commit is contained in:
schaeff 2019-10-29 12:16:26 +01:00
parent 0e8730ab3a
commit 3993732a1f
2 changed files with 14 additions and 6 deletions

View file

@ -176,13 +176,21 @@ impl Importer {
Some(resolve) => match resolve(location.clone(), import.source.to_string()) {
Ok((source, location)) => {
let source = arena.alloc(source);
let alias = import.alias.unwrap_or_else(|| {
// generate an alias from the imported path if none was given explicitely
let alias = import.alias.unwrap_or(
std::path::Path::new(import.source)
.file_stem()
.unwrap()
.ok_or(CompileErrors::from(
CompileErrorInner::ImportError(Error::new(format!(
"Could not determine alias for import {}",
import.source
)))
.with_context(&location),
))?
.to_str()
.unwrap()
});
.unwrap(),
);
let compiled =
compile_module(source, location, resolve_option, modules, &arena)

View file

@ -394,7 +394,7 @@ library BN256G2 {
}
"#;
pub const SOLIDITY_PAIRING_LIB_V2 : &str = r#"// This file is MIT Licensed.
pub const SOLIDITY_PAIRING_LIB_V2: &str = r#"// This file is MIT Licensed.
//
// Copyright 2017 Christian Reitwiessner
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@ -543,7 +543,7 @@ library Pairing {
}
"#;
pub const SOLIDITY_PAIRING_LIB : &str = r#"// This file is MIT Licensed.
pub const SOLIDITY_PAIRING_LIB: &str = r#"// This file is MIT Licensed.
//
// Copyright 2017 Christian Reitwiessner
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: