diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-08-06 14:10:23 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-08-06 23:25:11 +0200 |
commit | 41ccd193acceb1532ab1372433351c0a1eac59c2 (patch) | |
tree | 304d8b8eefb04c3bd62f938ae271b6fd65535ee7 /compiler.c | |
parent | f1e393873a17571ada80c189fbedef020d89cdad (diff) |
compiler: don't treat offset 0 special at syntax errors
If a compile error is raised at offset 0, try to resolve line and
character position anyway.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'compiler.c')
-rw-r--r-- | compiler.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -187,10 +187,8 @@ uc_compiler_syntax_error(uc_compiler_t *compiler, size_t off, const char *fmt, . off = uc_program_function_srcpos(compiler->function, uc_compiler_current_chunk(compiler)->count); - if (off) { - byte = off; - line = uc_source_get_line(source, &byte); - } + byte = off; + line = uc_source_get_line(source, &byte); va_start(ap, fmt); len = xvasprintf(&s, fmt, ap); |