aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-01-15 19:41:57 +0000
committerAleksey Kladov <[email protected]>2018-01-15 19:41:57 +0000
commit3c612bfa3a86675ef18b1effcc76037cb6b9fddf (patch)
treee70e7351f498958606e77c24c9805f50ed873642
parent91fb7e208863eb712654367c0793f010e118a918 (diff)
Simplify
-rw-r--r--src/parser/event_parser/grammar/items.rs4
-rw-r--r--src/parser/event_parser/parser.rs3
2 files changed, 4 insertions, 3 deletions
diff --git a/src/parser/event_parser/grammar/items.rs b/src/parser/event_parser/grammar/items.rs
index d2bfeac97..5b0180b81 100644
--- a/src/parser/event_parser/grammar/items.rs
+++ b/src/parser/event_parser/grammar/items.rs
@@ -49,9 +49,7 @@ fn item(p: &mut Parser) -> bool {
49 || node_if(p, STRUCT_KW, STRUCT_ITEM, struct_item) 49 || node_if(p, STRUCT_KW, STRUCT_ITEM, struct_item)
50 || node_if(p, FN_KW, FN_ITEM, fn_item); 50 || node_if(p, FN_KW, FN_ITEM, fn_item);
51 51
52 if item_parsed && attrs_start != item_start { 52 p.forward_parent(attrs_start, item_start);
53 p.forward_parent(attrs_start, item_start);
54 }
55 item_parsed 53 item_parsed
56} 54}
57 55
diff --git a/src/parser/event_parser/parser.rs b/src/parser/event_parser/parser.rs
index 14c0efe2d..6171b3579 100644
--- a/src/parser/event_parser/parser.rs
+++ b/src/parser/event_parser/parser.rs
@@ -55,6 +55,9 @@ impl<'t> Parser<'t> {
55 } 55 }
56 56
57 pub(crate) fn forward_parent(&mut self, child: Mark, parent: Mark) { 57 pub(crate) fn forward_parent(&mut self, child: Mark, parent: Mark) {
58 if child == parent || parent == self.mark() {
59 return
60 }
58 assert!(child.0 < parent.0); 61 assert!(child.0 < parent.0);
59 let diff = parent.0 - child.0; 62 let diff = parent.0 - child.0;
60 match self.events[child.0 as usize] { 63 match self.events[child.0 as usize] {