dead code

This commit is contained in:
Aleksey Kladov 2021-12-28 19:13:30 +03:00
parent bfc263f1f9
commit 660cf34d8c
8 changed files with 9 additions and 70 deletions

View file

@ -5,6 +5,7 @@
use crate::{ast, AstNode};
pub fn parse_expr_from_str(s: &str) -> Option<ast::Expr> {
let s = s.trim();
let file = ast::SourceFile::parse(&format!("const _: () = {};", s));
let expr = file.syntax_node().descendants().find_map(ast::Expr::cast)?;
if expr.syntax().text() != s {