From a86dc05d366c0733b645763dd5c3e7396041bd7b Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 5 Jul 2024 15:51:23 -0400 Subject: Cache AST parsings so we don't have to re-parse files --- repl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'repl.c') diff --git a/repl.c b/repl.c index d3d433dc..f4051451 100644 --- a/repl.c +++ b/repl.c @@ -60,8 +60,7 @@ void repl(void) } else { code = heap_strf("func main(): >> %s", code); } - file_t *f = spoof_file("", code); - ast_t *ast = parse_file(f, &on_err); + ast_t *ast = parse_file(heap_strf("%s", code), &on_err); ast_t *doctest = Match(Match(Match(ast, Block)->statements->ast, FunctionDef)->body, Block)->statements->ast; if (doctest->tag == DocTest) doctest->__data.DocTest.skip_source = 1; run(env, doctest); -- cgit v1.2.3