diff options
author | darksv <[email protected]> | 2018-09-10 22:21:16 +0100 |
---|---|---|
committer | darksv <[email protected]> | 2018-09-10 22:21:16 +0100 |
commit | d0cfeb4f1616e125ca3a941f2dcf5dfbb5f2b03f (patch) | |
tree | 51e6ec506b5bc263eaad6cd4af87e2afcff974cb | |
parent | 64d07c1bd475c4945db8d7cd1fa1a61e467b079b (diff) |
Do not reparse token tree when it is not delimited by braces
-rw-r--r-- | crates/libsyntax2/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/libsyntax2/tests/test/main.rs | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/crates/libsyntax2/src/lib.rs b/crates/libsyntax2/src/lib.rs index 74e8e7338..fd58cb4fa 100644 --- a/crates/libsyntax2/src/lib.rs +++ b/crates/libsyntax2/src/lib.rs | |||
@@ -149,7 +149,7 @@ fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(Syntax | |||
149 | MATCH_ARM_LIST => grammar::match_arm_list, | 149 | MATCH_ARM_LIST => grammar::match_arm_list, |
150 | USE_TREE_LIST => grammar::use_tree_list, | 150 | USE_TREE_LIST => grammar::use_tree_list, |
151 | EXTERN_ITEM_LIST => grammar::extern_item_list, | 151 | EXTERN_ITEM_LIST => grammar::extern_item_list, |
152 | TOKEN_TREE => grammar::token_tree, | 152 | TOKEN_TREE if node.first_child().unwrap().kind() == L_CURLY => grammar::token_tree, |
153 | ITEM_LIST => { | 153 | ITEM_LIST => { |
154 | let parent = node.parent().unwrap(); | 154 | let parent = node.parent().unwrap(); |
155 | match parent.kind() { | 155 | match parent.kind() { |
diff --git a/crates/libsyntax2/tests/test/main.rs b/crates/libsyntax2/tests/test/main.rs index 24058efa9..644df9f3c 100644 --- a/crates/libsyntax2/tests/test/main.rs +++ b/crates/libsyntax2/tests/test/main.rs | |||
@@ -85,6 +85,11 @@ pub enum A { | |||
85 | foo!{a, b<|><|> d} | 85 | foo!{a, b<|><|> d} |
86 | ", ", c[3]"); | 86 | ", ", c[3]"); |
87 | do_check(r" | 87 | do_check(r" |
88 | fn foo() { | ||
89 | vec![<|><|>] | ||
90 | } | ||
91 | ", "123"); | ||
92 | do_check(r" | ||
88 | extern { | 93 | extern { |
89 | fn<|>;<|> | 94 | fn<|>;<|> |
90 | } | 95 | } |