mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 01:13:11 +00:00
rustc: Actually hook the crate_type attribute into session
This commit is contained in:
parent
4f17131855
commit
54f72fbc10
@ -138,6 +138,8 @@ fn compile_input(sess: session::session, cfg: ast::crate_cfg, input: str,
|
||||
time(time_passes, "parsing", bind parse_input(sess, cfg, input));
|
||||
if sess.get_opts().parse_only { ret; }
|
||||
|
||||
sess.set_building_library(crate);
|
||||
|
||||
crate =
|
||||
time(time_passes, "configuration",
|
||||
bind front::config::strip_unconfigured_items(crate));
|
||||
@ -492,7 +494,7 @@ fn build_session(sopts: @session::options) -> session::session {
|
||||
sopts.addl_lib_search_paths);
|
||||
ret session::session(target_cfg, sopts, cstore,
|
||||
@{cm: codemap::new_codemap(), mutable next_id: 0},
|
||||
none, 0u, filesearch);
|
||||
none, 0u, filesearch, false);
|
||||
}
|
||||
|
||||
fn parse_pretty(sess: session::session, &&name: str) -> pp_mode {
|
||||
|
@ -59,7 +59,8 @@ obj session(targ_cfg: @config,
|
||||
// For a library crate, this is always none
|
||||
mutable main_fn: option::t<node_id>,
|
||||
mutable err_count: uint,
|
||||
filesearch: filesearch::filesearch) {
|
||||
filesearch: filesearch::filesearch,
|
||||
mutable building_library: bool) {
|
||||
fn get_targ_cfg() -> @config { ret targ_cfg; }
|
||||
fn get_opts() -> @options { ret opts; }
|
||||
fn get_cstore() -> metadata::cstore::cstore { cstore }
|
||||
@ -118,7 +119,10 @@ obj session(targ_cfg: @config,
|
||||
fn set_main_id(d: node_id) { main_fn = some(d); }
|
||||
fn get_main_id() -> option::t<node_id> { main_fn }
|
||||
fn filesearch() -> filesearch::filesearch { filesearch }
|
||||
fn building_library() -> bool { opts.crate_type == lib_crate }
|
||||
fn building_library() -> bool { building_library }
|
||||
fn set_building_library(crate: @ast::crate) {
|
||||
building_library = session::building_library(opts.crate_type, crate);
|
||||
}
|
||||
}
|
||||
|
||||
fn building_library(req_crate_type: crate_type, crate: @ast::crate) -> bool {
|
||||
|
Loading…
Reference in New Issue
Block a user