summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--compiler.c6
-rw-r--r--tests/custom/04_modules/06_export_errors1
2 files changed, 3 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);
diff --git a/tests/custom/04_modules/06_export_errors b/tests/custom/04_modules/06_export_errors
index 5c9f676..83227b1 100644
--- a/tests/custom/04_modules/06_export_errors
+++ b/tests/custom/04_modules/06_export_errors
@@ -10,6 +10,7 @@ export let x = 1;
-- Expect stderr --
Syntax error: Exports may only appear at top level of a module
+In line 1, byte 1:
`export let x = 1;`
^-- Near here