summaryrefslogtreecommitdiffhomepage
path: root/compiler.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-08-06 14:10:23 +0200
committerJo-Philipp Wich <jo@mein.io>2022-08-06 23:25:11 +0200
commit41ccd193acceb1532ab1372433351c0a1eac59c2 (patch)
tree304d8b8eefb04c3bd62f938ae271b6fd65535ee7 /compiler.c
parentf1e393873a17571ada80c189fbedef020d89cdad (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.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler.c b/compiler.c
index 0042c15..7fd4da2 100644
--- a/compiler.c
+++ b/compiler.c
@@ -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);