mirror of https://github.com/rust-lang/rust.git
Introduce a config property to the crate AST node
This represents the compilation environment, defined as AST meta_items, Used for driving conditional compilation and will eventually replace the environment used by the parser for the current conditional compilation scheme. Issue #489
This commit is contained in:
parent
cbcc7bba30
commit
d53bfad8e7
|
@ -76,11 +76,16 @@ fn def_id_of_def(def d) -> def_id {
|
|||
fail;
|
||||
}
|
||||
|
||||
// The set of meta_items that define the compilation environment of the crate,
|
||||
// used to drive conditional compilation
|
||||
type crate_cfg = vec[@meta_item];
|
||||
|
||||
type crate = spanned[crate_];
|
||||
|
||||
type crate_ = rec(vec[@crate_directive] directives,
|
||||
_mod module,
|
||||
vec[attribute] attrs);
|
||||
vec[attribute] attrs,
|
||||
crate_cfg config);
|
||||
|
||||
tag crate_directive_ {
|
||||
cdir_expr(@expr);
|
||||
|
|
|
@ -131,7 +131,8 @@ fn noop_fold_crate(&crate_ c, ast_fold fld) -> crate_ {
|
|||
auto fold_attribute = bind fold_attribute_(_,fold_meta_item);
|
||||
|
||||
ret rec(directives=map(fld.fold_crate_directive, c.directives),
|
||||
module=c.module, attrs=map(fold_attribute, c.attrs));
|
||||
module=c.module, attrs=map(fold_attribute, c.attrs),
|
||||
config=map(fold_meta_item, c.config));
|
||||
}
|
||||
|
||||
fn noop_fold_crate_directive(&crate_directive_ cd, ast_fold fld)
|
||||
|
|
|
@ -2318,7 +2318,8 @@ fn parse_crate_from_source_file(&parser p) -> @ast::crate {
|
|||
let vec[@ast::crate_directive] cdirs = [];
|
||||
ret @spanned(lo, p.get_lo_pos(), rec(directives=cdirs,
|
||||
module=m,
|
||||
attrs=crate_attrs._0));
|
||||
attrs=crate_attrs._0,
|
||||
config=[]));
|
||||
}
|
||||
|
||||
fn parse_str(&parser p) -> ast::ident {
|
||||
|
@ -2450,7 +2451,8 @@ fn parse_crate_from_crate_file(&parser p) -> @ast::crate {
|
|||
expect(p, token::EOF);
|
||||
ret @spanned(lo, hi, rec(directives=cdirs,
|
||||
module=m,
|
||||
attrs=crate_attrs));
|
||||
attrs=crate_attrs,
|
||||
config=[]));
|
||||
}
|
||||
//
|
||||
// Local Variables:
|
||||
|
|
Loading…
Reference in New Issue