aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lparser.c2
-rw-r--r--testes/goto.lua7
2 files changed, 8 insertions, 1 deletions
diff --git a/lparser.c b/lparser.c
index 3c2f57ab..93991cb0 100644
--- a/lparser.c
+++ b/lparser.c
@@ -1858,8 +1858,8 @@ static void funcstat (LexState *ls, int line) {
1858 expdesc v, b; 1858 expdesc v, b;
1859 luaX_next(ls); /* skip FUNCTION */ 1859 luaX_next(ls); /* skip FUNCTION */
1860 ismethod = funcname(ls, &v); 1860 ismethod = funcname(ls, &v);
1861 body(ls, &b, ismethod, line);
1862 check_readonly(ls, &v); 1861 check_readonly(ls, &v);
1862 body(ls, &b, ismethod, line);
1863 luaK_storevar(ls->fs, &v, &b); 1863 luaK_storevar(ls->fs, &v, &b);
1864 luaK_fixline(ls->fs, line); /* definition "happens" in the first line */ 1864 luaK_fixline(ls->fs, line); /* definition "happens" in the first line */
1865} 1865}
diff --git a/testes/goto.lua b/testes/goto.lua
index b41399ff..59713dd7 100644
--- a/testes/goto.lua
+++ b/testes/goto.lua
@@ -342,6 +342,13 @@ do
342 global foo <const>; 342 global foo <const>;
343 function foo (x) return end -- ERROR: foo is read-only 343 function foo (x) return end -- ERROR: foo is read-only
344 ]], "assign to const variable 'foo'") 344 ]], "assign to const variable 'foo'")
345
346 checkerr([[
347 global foo <const>;
348 function foo (x) -- ERROR: foo is read-only
349 return
350 end
351 ]], "%:2%:") -- correct line in error message
345 352
346end 353end
347 354