Skip to content

Commit

Permalink
Trying old-style file finding
Browse files Browse the repository at this point in the history
  • Loading branch information
awelc committed Feb 29, 2024
1 parent 92fe940 commit 968636e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ use crate::{
expansion, hlir, interface_generator, naming, parser,
parser::{comments::*, *},
shared::{
canonicalize, find_filenames, CompilationEnv, Flags, IndexedPackagePath,
IndexedVfsPackagePath, NamedAddressMap, NamedAddressMaps, NumericalAddress, PackageConfig,
PackagePaths,
canonicalize, CompilationEnv, Flags, IndexedPackagePath, IndexedVfsPackagePath,
NamedAddressMap, NamedAddressMaps, NumericalAddress, PackageConfig, PackagePaths,
},
to_bytecode,
typing::{self, visitor::TypingVisitorObj},
unit_test,
};
use move_command_line_common::files::{
MOVE_COMPILED_EXTENSION, MOVE_EXTENSION, SOURCE_MAP_EXTENSION,
extension_equals, find_filenames, MOVE_COMPILED_EXTENSION, MOVE_EXTENSION, SOURCE_MAP_EXTENSION,
};
use move_core_types::language_storage::ModuleId as CompiledModuleId;
use move_symbol_pool::Symbol;
Expand Down Expand Up @@ -759,17 +758,18 @@ pub fn generate_interface_files(
} in other_file_locations
{
v.extend(
find_filenames(&[path], |path| {
path.extension()
.map(|e| e.as_str() == MOVE_COMPILED_EXTENSION)
.unwrap_or(false)
find_filenames(&[path.as_str()], |path| {
extension_equals(path, MOVE_COMPILED_EXTENSION)
})?
.into_iter()
.map(|path| IndexedVfsPackagePath {
package,
path,
named_address_map,
}),
.map(|p| {
Ok(IndexedVfsPackagePath {
package,
path: path.root().join(p)?,
named_address_map,
})
})
.collect::<Result<Vec<_>, anyhow::Error>>()?,
);
}
v
Expand Down
23 changes: 14 additions & 9 deletions external-crates/move/crates/move-compiler/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ pub(crate) mod verification_attribute_filter;
use crate::{
diagnostics::FilesSourceText,
parser::{self, ast::PackageDefinition, syntax::parse_file_string},
shared::{find_move_filenames, CompilationEnv, IndexedVfsPackagePath, NamedAddressMaps},
shared::{CompilationEnv, IndexedVfsPackagePath, NamedAddressMaps},
};
use anyhow::anyhow;
use comments::*;
use move_command_line_common::files::FileHash;
use move_command_line_common::files::{find_move_filenames, FileHash};
use move_symbol_pool::Symbol;
use std::collections::{BTreeSet, HashMap};
use vfs::VfsPath;
Expand All @@ -41,13 +41,18 @@ pub(crate) fn parse_program(
named_address_map: named_address_mapping,
} in paths_with_mapping
{
res.extend(find_move_filenames(&[path], true)?.into_iter().map(|s| {
IndexedVfsPackagePath {
package,
path: s,
named_address_map: named_address_mapping,
}
}));
res.extend(
find_move_filenames(&[path.as_str()], true)?
.into_iter()
.map(|s| {
Ok(IndexedVfsPackagePath {
package,
path: path.root().join(s)?,
named_address_map: named_address_mapping,
})
})
.collect::<Result<Vec<_>, anyhow::Error>>()?,
);
}
// sort the filenames so errors about redefinitions, or other inter-file conflicts, are
// deterministic
Expand Down

0 comments on commit 968636e

Please sign in to comment.