From 6a8b0c3fc67c63d28b1c553bd2744ec83c3c7c53 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sun, 21 May 2017 21:57:09 +1000 Subject: src/lparser.js: Use .getstr() when creating error messages --- src/lparser.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/lparser.js') diff --git a/src/lparser.js b/src/lparser.js index f4947d5..7d99f7d 100644 --- a/src/lparser.js +++ b/src/lparser.js @@ -394,8 +394,9 @@ const closegoto = function(ls, g, label) { assert(eqstr(gt.name, label.name)); if (gt.nactvar < label.nactvar) { let vname = getlocvar(fs, gt.nactvar).varname; - let msg = lobject.luaO_pushfstring(ls.L, defs.to_luastring(" at line %d jumps into the scope of local '%s'"), - gt.name, gt.line, vname); + let msg = lobject.luaO_pushfstring(ls.L, + defs.to_luastring(" at line %d jumps into the scope of local '%s'"), + gt.name.getstr(), gt.line, vname.getstr()); semerror(ls, msg); } lcode.luaK_patchlist(fs, gt.pc, label.pc); @@ -502,7 +503,7 @@ const undefgoto = function(ls, gt) { let msg = llex.isreserved(gt.name) ? "<%s> at line %d not inside a loop" : "no visible label '%s' for at line %d"; - msg = lobject.luaO_pushfstring(ls.L, defs.to_luastring(msg), gt.name, gt.line); + msg = lobject.luaO_pushfstring(ls.L, defs.to_luastring(msg), gt.name.getstr(), gt.line); semerror(ls, msg); }; @@ -1162,7 +1163,10 @@ const gotostat = function(ls, pc) { const checkrepeated = function(fs, ll, label) { for (let i = fs.bl.firstlabel; i < ll.n; i++) { if (eqstr(label, ll.arr[i].name)) { - semerror(fs.ls, defs.to_luastring(`label '${label.jsstring()}' already defined on line ${ll.arr[i].line}`)); + let msg = lobject.luaO_pushfstring(fs.ls.L, + defs.to_luastring("label '%s' already defined on line %d", true), + label.getstr(), ll.arr[i].line); + semerror(fs.ls, msg); } } }; -- cgit v1.2.3-54-g00ecf