diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-11-05 04:16:26 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-11-22 01:48:10 +0000 |
| commit | 5675d9d28007691c4f396abcd4b29a228150eeb4 (patch) | |
| tree | ff28ee180c2e904520168d953a6946574c94b18b /src/libsyntax/parse/mod.rs | |
| parent | 7b3eeea22c9b81f6e7277b79517a0dab25b9f383 (diff) | |
| download | rust-5675d9d28007691c4f396abcd4b29a228150eeb4.tar.gz rust-5675d9d28007691c4f396abcd4b29a228150eeb4.zip | |
Clean up directory ownership semantics.
Diffstat (limited to 'src/libsyntax/parse/mod.rs')
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index be340a5b5aa..f969e45b83a 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -76,6 +76,19 @@ impl ParseSess { } } +#[derive(Clone)] +pub struct Directory { + pub path: PathBuf, + pub ownership: DirectoryOwnership, +} + +#[derive(Copy, Clone)] +pub enum DirectoryOwnership { + Owned, + UnownedViaBlock, + UnownedViaMod, +} + // a bunch of utility functions of the form parse_<thing>_from_<source> // where <thing> includes crate, expr, item, stmt, tts, and one that // uses a HOF to parse anything, and <source> includes file and @@ -152,11 +165,11 @@ pub fn new_parser_from_file<'a>(sess: &'a ParseSess, path: &Path) -> Parser<'a> /// On an error, use the given span as the source of the problem. pub fn new_sub_parser_from_file<'a>(sess: &'a ParseSess, path: &Path, - owns_directory: bool, + directory_ownership: DirectoryOwnership, module_name: Option<String>, sp: Span) -> Parser<'a> { let mut p = filemap_to_parser(sess, file_to_filemap(sess, path, Some(sp))); - p.owns_directory = owns_directory; + p.directory.ownership = directory_ownership; p.root_module_name = module_name; p } |
