From a1d84f5fb033113a0a0b9a0b4d9951a6a0bf04b8 Mon Sep 17 00:00:00 2001 From: pcpthm Date: Sun, 17 Mar 2019 00:27:07 +0900 Subject: Allow attribute on struct literal field --- .../ok/0125_struct_literal_field_with_attr.rs | 3 ++ .../ok/0125_struct_literal_field_with_attr.txt | 45 ++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 crates/ra_syntax/tests/data/parser/inline/ok/0125_struct_literal_field_with_attr.rs create mode 100644 crates/ra_syntax/tests/data/parser/inline/ok/0125_struct_literal_field_with_attr.txt (limited to 'crates/ra_syntax/tests/data/parser') diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0125_struct_literal_field_with_attr.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0125_struct_literal_field_with_attr.rs new file mode 100644 index 000000000..a6c7760c7 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0125_struct_literal_field_with_attr.rs @@ -0,0 +1,3 @@ +fn main() { + S { #[cfg(test)] field: 1 } +} diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0125_struct_literal_field_with_attr.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0125_struct_literal_field_with_attr.txt new file mode 100644 index 000000000..34c80500a --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0125_struct_literal_field_with_attr.txt @@ -0,0 +1,45 @@ +SOURCE_FILE@[0; 46) + FN_DEF@[0; 45) + FN_KW@[0; 2) + WHITESPACE@[2; 3) + NAME@[3; 7) + IDENT@[3; 7) "main" + PARAM_LIST@[7; 9) + L_PAREN@[7; 8) + R_PAREN@[8; 9) + WHITESPACE@[9; 10) + BLOCK@[10; 45) + L_CURLY@[10; 11) + WHITESPACE@[11; 16) + STRUCT_LIT@[16; 43) + PATH@[16; 17) + PATH_SEGMENT@[16; 17) + NAME_REF@[16; 17) + IDENT@[16; 17) "S" + WHITESPACE@[17; 18) + NAMED_FIELD_LIST@[18; 43) + L_CURLY@[18; 19) + WHITESPACE@[19; 20) + NAMED_FIELD@[20; 41) + ATTR@[20; 32) + POUND@[20; 21) + TOKEN_TREE@[21; 32) + L_BRACK@[21; 22) + IDENT@[22; 25) "cfg" + TOKEN_TREE@[25; 31) + L_PAREN@[25; 26) + IDENT@[26; 30) "test" + R_PAREN@[30; 31) + R_BRACK@[31; 32) + WHITESPACE@[32; 33) + NAME_REF@[33; 38) + IDENT@[33; 38) "field" + COLON@[38; 39) + WHITESPACE@[39; 40) + LITERAL@[40; 41) + INT_NUMBER@[40; 41) "1" + WHITESPACE@[41; 42) + R_CURLY@[42; 43) + WHITESPACE@[43; 44) + R_CURLY@[44; 45) + WHITESPACE@[45; 46) -- cgit v1.2.3