aboutsummaryrefslogtreecommitdiff
path: root/lparser.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-08-30 11:26:16 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-08-30 11:26:16 -0300
commitf33cda8d6eb1cac5b9042429e85f1096175c7ca5 (patch)
treefc82b6d637628a489bb68fa8ac6f320334170ace /lparser.c
parent96f77142374da8a4a7d4e5e8afd559fbaf0430e8 (diff)
downloadlua-f33cda8d6eb1cac5b9042429e85f1096175c7ca5.tar.gz
lua-f33cda8d6eb1cac5b9042429e85f1096175c7ca5.tar.bz2
lua-f33cda8d6eb1cac5b9042429e85f1096175c7ca5.zip
New macro 'getlstr'
Accesses content and length of a 'TString'.
Diffstat (limited to 'lparser.c')
-rw-r--r--lparser.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lparser.c b/lparser.c
index a1164510..2a84637a 100644
--- a/lparser.c
+++ b/lparser.c
@@ -520,7 +520,8 @@ static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) {
520** local variable. 520** local variable.
521*/ 521*/
522static l_noret jumpscopeerror (LexState *ls, Labeldesc *gt) { 522static l_noret jumpscopeerror (LexState *ls, Labeldesc *gt) {
523 const char *varname = getstr(getlocalvardesc(ls->fs, gt->nactvar)->vd.name); 523 TString *tsname = getlocalvardesc(ls->fs, gt->nactvar)->vd.name;
524 const char *varname = getstr(tsname);
524 const char *msg = "<goto %s> at line %d jumps into the scope of local '%s'"; 525 const char *msg = "<goto %s> at line %d jumps into the scope of local '%s'";
525 msg = luaO_pushfstring(ls->L, msg, getstr(gt->name), gt->line, varname); 526 msg = luaO_pushfstring(ls->L, msg, getstr(gt->name), gt->line, varname);
526 luaK_semerror(ls, msg); /* raise the error */ 527 luaK_semerror(ls, msg); /* raise the error */
@@ -1708,7 +1709,8 @@ static void localfunc (LexState *ls) {
1708static int getlocalattribute (LexState *ls) { 1709static int getlocalattribute (LexState *ls) {
1709 /* ATTRIB -> ['<' Name '>'] */ 1710 /* ATTRIB -> ['<' Name '>'] */
1710 if (testnext(ls, '<')) { 1711 if (testnext(ls, '<')) {
1711 const char *attr = getstr(str_checkname(ls)); 1712 TString *ts = str_checkname(ls);
1713 const char *attr = getstr(ts);
1712 checknext(ls, '>'); 1714 checknext(ls, '>');
1713 if (strcmp(attr, "const") == 0) 1715 if (strcmp(attr, "const") == 0)
1714 return RDKCONST; /* read-only variable */ 1716 return RDKCONST; /* read-only variable */