From 2245c883680ccfbe545f230d6b68c38ce54bceb6 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 24 Aug 2025 17:13:48 -0400 Subject: Shift some code around. --- src/compile/statements.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/compile/statements.c') diff --git a/src/compile/statements.c b/src/compile/statements.c index 8649b978..ee70fdea 100644 --- a/src/compile/statements.c +++ b/src/compile/statements.c @@ -22,6 +22,13 @@ typedef ast_t *(*comprehension_body_t)(ast_t *, ast_t *); +public +Text_t with_source_info(env_t *env, ast_t *ast, Text_t code) { + if (code.length == 0 || !ast || !ast->file || !env->do_source_mapping) return code; + int64_t line = get_line_number(ast->file, ast->start); + return Texts("\n#line ", String(line), "\n", code); +} + public Text_t compile_inline_block(env_t *env, ast_t *ast) { if (ast->tag != Block) return compile_statement(env, ast); -- cgit v1.2.3