diff options
author | John Hodge <tpg@mutabah.net> | 2016-08-28 12:49:24 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-08-28 12:49:24 +0800 |
commit | 21dbf4949edd87c81f7eb8396fb4f91ef76a10a8 (patch) | |
tree | 9d0e314456d302205305cdba8b592b0b52a84105 /src/expand/cfg.cpp | |
parent | 03bc080d35b6ee09345f012137dd52d6fa6c5b53 (diff) | |
download | mrust-21dbf4949edd87c81f7eb8396fb4f91ef76a10a8.tar.gz |
Expand - Support #[cfg] on use statements
Diffstat (limited to 'src/expand/cfg.cpp')
-rw-r--r-- | src/expand/cfg.cpp | 9 |
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) ) { |