Don't wrap most syntax trees in invisible delimiters when converting to token tree

Otherwise parsing them again doesn't work.
This commit is contained in:
Florian Diebold 2019-12-05 19:27:39 +01:00
parent 18f6a995d0
commit ab4ecca210

View file

@ -245,8 +245,14 @@ impl Convertor {
}
}
NodeOrToken::Node(node) => {
let child = self.go(&node)?.into();
token_trees.push(child);
let child_subtree = self.go(&node)?;
if child_subtree.delimiter == tt::Delimiter::None
&& node.kind() != SyntaxKind::TOKEN_TREE
{
token_trees.extend(child_subtree.token_trees);
} else {
token_trees.push(child_subtree.into());
}
}
};
}