diff options
author | daurnimator <quae@daurnimator.com> | 2017-05-21 21:57:09 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-05-21 22:02:15 +1000 |
commit | 6a8b0c3fc67c63d28b1c553bd2744ec83c3c7c53 (patch) | |
tree | fc8e21c3b7bc067d64bda4ced87c2182aa348c63 | |
parent | 4a6c30d490f903abf077152ce2f88b85b8ee25e6 (diff) | |
download | fengari-6a8b0c3fc67c63d28b1c553bd2744ec83c3c7c53.tar.gz fengari-6a8b0c3fc67c63d28b1c553bd2744ec83c3c7c53.tar.bz2 fengari-6a8b0c3fc67c63d28b1c553bd2744ec83c3c7c53.zip |
src/lparser.js: Use .getstr() when creating error messages
-rw-r--r-- | src/lparser.js | 12 |
1 files changed, 8 insertions, 4 deletions
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("<goto %s> 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("<goto %s> 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 <goto> 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); } } }; |