rustc: Be explicit about which peer modules the metadata mod can access

This is the first step in eliminating dependencies on rustc so we can extract
the metadata code into its own crate.
This commit is contained in:
Brian Anderson 2012-05-13 15:56:45 -07:00
parent a6b9fa0cd1
commit ecf290d448
2 changed files with 59 additions and 0 deletions

47
src/rustc/metadata.rs Normal file
View File

@ -0,0 +1,47 @@
// Define the rustc API's that the metadata module has access to
// Over time we will reduce these dependencies and, once metadata has
// no dependencies on rustc it can move into its own crate.
mod middle {
import ast_map = middle_::ast_map;
export ast_map;
import ty = middle_::ty;
export ty;
import trans = middle_::trans;
export trans;
import typeck = middle_::typeck;
export typeck;
import last_use = middle_::last_use;
export last_use;
import freevars = middle_::freevars;
export freevars;
import resolve = middle_::resolve;
export resolve;
}
mod front {
}
mod back {
}
mod driver {
import session = driver_::session;
export session;
import diagnostic = rustsyntax::diagnostic;
export diagnostic;
}
mod util {
import common = util_::common;
export common;
import ppaux = util_::ppaux;
export ppaux;
import filesearch = util_::filesearch;
export filesearch;
}
mod lib {
import llvm = lib_::llvm;
export llvm;
}

View File

@ -17,6 +17,18 @@ use rustsyntax(vers = "0.2");
import core::*;
/*
Alternate names for some modules.
I am using this to help extract metadata into its own crate. In metadata.rs
it redefines all these modules in order to gate access from metadata to the
rest of the compiler, then uses these to access the original implementation.
*/
import util_ = util;
import lib_ = lib;
import driver_ = driver;
import middle_ = middle;
mod middle {
mod trans {
mod common;