diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-07-05 15:51:23 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-07-05 15:51:23 -0400 |
| commit | a86dc05d366c0733b645763dd5c3e7396041bd7b (patch) | |
| tree | 409af6b99d0bb828ca44b75202e170dea87389b9 /repl.c | |
| parent | e51e6f840cb2414cad6e816aea7adea74ee8b1b8 (diff) | |
Cache AST parsings so we don't have to re-parse files
Diffstat (limited to 'repl.c')
| -rw-r--r-- | repl.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -60,8 +60,7 @@ void repl(void) } else { code = heap_strf("func main(): >> %s", code); } - file_t *f = spoof_file("<repl>", code); - ast_t *ast = parse_file(f, &on_err); + ast_t *ast = parse_file(heap_strf("<code>%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); |
