summaryrefslogtreecommitdiff
path: root/src/lparser.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-21 21:57:09 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-21 22:02:15 +1000
commit6a8b0c3fc67c63d28b1c553bd2744ec83c3c7c53 (patch)
treefc8e21c3b7bc067d64bda4ced87c2182aa348c63 /src/lparser.js
parent4a6c30d490f903abf077152ce2f88b85b8ee25e6 (diff)
downloadfengari-6a8b0c3fc67c63d28b1c553bd2744ec83c3c7c53.tar.gz
fengari-6a8b0c3fc67c63d28b1c553bd2744ec83c3c7c53.tar.bz2
fengari-6a8b0c3fc67c63d28b1c553bd2744ec83c3c7c53.zip
src/lparser.js: Use .getstr() when creating error messages
Diffstat (limited to 'src/lparser.js')
-rw-r--r--src/lparser.js12
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);
}
}
};