summaryrefslogtreecommitdiff
path: root/src/expand/cfg.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-08-28 12:49:24 +0800
committerJohn Hodge <tpg@mutabah.net>2016-08-28 12:49:24 +0800
commit21dbf4949edd87c81f7eb8396fb4f91ef76a10a8 (patch)
tree9d0e314456d302205305cdba8b592b0b52a84105 /src/expand/cfg.cpp
parent03bc080d35b6ee09345f012137dd52d6fa6c5b53 (diff)
downloadmrust-21dbf4949edd87c81f7eb8396fb4f91ef76a10a8.tar.gz
Expand - Support #[cfg] on use statements
Diffstat (limited to 'src/expand/cfg.cpp')
-rw-r--r--src/expand/cfg.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/expand/cfg.cpp b/src/expand/cfg.cpp
index 70ac6ac1..2a629432 100644
--- a/src/expand/cfg.cpp
+++ b/src/expand/cfg.cpp
@@ -117,6 +117,15 @@ class CCfgHandler:
mac.clear();
}
}
+ void handle(const Span& sp, const AST::MetaItem& mi, ::AST::Crate& crate, AST::UseStmt& use) const override {
+ DEBUG("#[cfg] use - " << mi);
+ if( check_cfg(sp, mi) ) {
+ // Leave as is
+ }
+ else {
+ use.path = AST::Path();
+ }
+ }
void handle(const Span& sp, const AST::MetaItem& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item&i) const override {
DEBUG("#[cfg] item - " << mi);
if( check_cfg(sp, mi) ) {