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:
parent
18f6a995d0
commit
ab4ecca210
@ -245,8 +245,14 @@ fn go(&mut self, tt: &SyntaxNode) -> Option<tt::Subtree> {
|
||||
}
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user