Skip to content

Commit ab4ecca

Browse files
committed
Don't wrap most syntax trees in invisible delimiters when converting to token tree
Otherwise parsing them again doesn't work.
1 parent 18f6a99 commit ab4ecca

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

crates/ra_mbe/src/syntax_bridge.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,14 @@ impl Convertor {
245245
}
246246
}
247247
NodeOrToken::Node(node) => {
248-
let child = self.go(&node)?.into();
249-
token_trees.push(child);
248+
let child_subtree = self.go(&node)?;
249+
if child_subtree.delimiter == tt::Delimiter::None
250+
&& node.kind() != SyntaxKind::TOKEN_TREE
251+
{
252+
token_trees.extend(child_subtree.token_trees);
253+
} else {
254+
token_trees.push(child_subtree.into());
255+
}
250256
}
251257
};
252258
}

0 commit comments

Comments
 (0)