diff options
author | FintanH | 2019-08-12 22:22:24 +0100 |
---|---|---|
committer | FintanH | 2019-08-12 22:22:24 +0100 |
commit | 405bc3d80c0e169ea74dd12422b9504b7383dab3 (patch) | |
tree | f1f71797b0470375b12717a4663c1ea2ca1f96fd /dhall/src/phase/resolve.rs | |
parent | 8ec422f2319360f986950fcb9aae4bcf65a9c1e2 (diff) |
Refactor of File to be the combination of Directory and the file name,
where Directory is the Vector of component paths.
The refactor meant changing some sections of the code where we were
parsing and manipulating Files/Directories.
This also includes a new trait Canonicalization which is needed for
import logic.
Diffstat (limited to 'dhall/src/phase/resolve.rs')
-rw-r--r-- | dhall/src/phase/resolve.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/dhall/src/phase/resolve.rs b/dhall/src/phase/resolve.rs index c4d7e5f..ba75be4 100644 --- a/dhall/src/phase/resolve.rs +++ b/dhall/src/phase/resolve.rs @@ -16,6 +16,7 @@ type ImportCache = HashMap<Import, Normalized>; pub type ImportStack = Vec<Import>; + fn resolve_import( import: &Import, root: &ImportRoot, @@ -30,14 +31,14 @@ fn resolve_import( }; match &import.location_hashed.location { Local(prefix, path) => { - let path: PathBuf = path.iter().cloned().collect(); - let path = match prefix { + let path_buf: PathBuf = path.clone().into_iter().collect(); + let path_buf = match prefix { // TODO: fail gracefully - Parent => cwd.parent().unwrap().join(path), - Here => cwd.join(path), + Parent => cwd.parent().unwrap().join(path_buf), + Here => cwd.join(path_buf), _ => unimplemented!("{:?}", import), }; - Ok(load_import(&path, import_cache, import_stack).map_err(|e| { + Ok(load_import(&path_buf, import_cache, import_stack).map_err(|e| { ImportError::Recursive(import.clone(), Box::new(e)) })?) } |