aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index 4611305e..6da984ea 100644
--- a/compile.c
+++ b/compile.c
@@ -19,13 +19,18 @@ CORD compile_type(env_t *env, type_ast_t *t)
CORD compile_statement(env_t *env, ast_t *ast)
{
+ CORD stmt;
switch (ast->tag) {
case If: case For: case While: case FunctionDef: case Return: case StructDef: case EnumDef:
case Declare: case Assign: case UpdateAssign: case DocTest:
- return compile(env, ast);
+ stmt = compile(env, ast);
+ break;
default:
- return CORD_asprintf("(void)%r;", compile(env, ast));
+ stmt = CORD_asprintf("(void)%r;", compile(env, ast));
+ break;
}
+ int64_t line = get_line_number(ast->file, ast->start);
+ return stmt ? CORD_asprintf("#line %ld\n%r", line, stmt) : stmt;
}
CORD compile(env_t *env, ast_t *ast)