compress method
Implementation
Node compress(Node syntaxTree) {
var node = syntaxTree;
final children = <Node>[];
switch (syntaxTree.type) {
case ST.message:
case ST.pluralParts:
case ST.selectParts:
while (node.children.length == 2) {
children.add(node.children[0]);
compress(node.children[0]);
node = node.children[1];
}
syntaxTree.children = children;
break;
// ignore: no_default_cases
default:
node.children.forEach(compress);
}
return syntaxTree;
}