aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-05-03 16:56:45 +0100
committerBenjamin Coenen <[email protected]>2020-05-03 16:56:45 +0100
commitbed115d6e1a634d79e175e543a7936cd03200ebc (patch)
tree10548a96ae07d24b8cb276da02fbf84fb6b46032 /crates/ra_hir_def
parent682c079043656a55775eff33d806da517542f9eb (diff)
add support of cfg attributes on enum variants #4279
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r--crates/ra_hir_def/src/adt.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs
index 8eef51828..d0912ddaa 100644
--- a/crates/ra_hir_def/src/adt.rs
+++ b/crates/ra_hir_def/src/adt.rs
@@ -117,7 +117,13 @@ fn lower_enum(
117 ast: &InFile<ast::EnumDef>, 117 ast: &InFile<ast::EnumDef>,
118 module_id: ModuleId, 118 module_id: ModuleId,
119) { 119) {
120 for var in ast.value.variant_list().into_iter().flat_map(|it| it.variants()) { 120 let expander = CfgExpander::new(db, ast.file_id, module_id.krate);
121 let variants =
122 ast.value.variant_list().into_iter().flat_map(|it| it.variants()).filter(|var| {
123 let attrs = expander.parse_attrs(var);
124 expander.is_cfg_enabled(&attrs)
125 });
126 for var in variants {
121 trace.alloc( 127 trace.alloc(
122 || var.clone(), 128 || var.clone(),
123 || EnumVariantData { 129 || EnumVariantData {