aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-07-30 16:14:14 +0100
committerAleksey Kladov <[email protected]>2018-07-30 16:14:14 +0100
commit6fc66c4ee667da871ea1f0c8b48b5e9b7373a187 (patch)
tree11bf3d276afe15e328f6d600ea84010c2c693b52
parentbeaddb478097223c87e507bf9367d85d86df5d06 (diff)
Use boxed sliced for red nodes
-rw-r--r--src/grammar.ron1
-rw-r--r--src/yellow/red.rs6
2 files changed, 4 insertions, 3 deletions
diff --git a/src/grammar.ron b/src/grammar.ron
index 38453b45c..3efd60ee5 100644
--- a/src/grammar.ron
+++ b/src/grammar.ron
@@ -150,6 +150,5 @@ Grammar(
150 "LIFETIME_PARAM", 150 "LIFETIME_PARAM",
151 "TYPE_PARAM_LIST", 151 "TYPE_PARAM_LIST",
152 "TYPE_ARG_LIST", 152 "TYPE_ARG_LIST",
153
154 ] 153 ]
155) 154)
diff --git a/src/yellow/red.rs b/src/yellow/red.rs
index 8907100e4..bffb72510 100644
--- a/src/yellow/red.rs
+++ b/src/yellow/red.rs
@@ -5,7 +5,7 @@ use {yellow::GreenNode, TextUnit};
5pub(crate) struct RedNode { 5pub(crate) struct RedNode {
6 green: GreenNode, 6 green: GreenNode,
7 parent: Option<ParentData>, 7 parent: Option<ParentData>,
8 children: RwLock<Vec<Option<RedNode>>>, 8 children: RwLock<Box<[Option<RedNode>]>>,
9} 9}
10 10
11#[derive(Debug)] 11#[derive(Debug)]
@@ -36,7 +36,9 @@ impl RedNode {
36 36
37 fn new(green: GreenNode, parent: Option<ParentData>) -> RedNode { 37 fn new(green: GreenNode, parent: Option<ParentData>) -> RedNode {
38 let n_children = green.children().len(); 38 let n_children = green.children().len();
39 let children = (0..n_children).map(|_| None).collect(); 39 let children = (0..n_children).map(|_| None)
40 .collect::<Vec<_>>()
41 .into_boxed_slice();
40 RedNode { 42 RedNode {
41 green, 43 green,
42 parent, 44 parent,