Skip to content

Commit

Permalink
Remove when statement
Browse files Browse the repository at this point in the history
Breaking? Technically. But, no one uses it.... literally, not even our unit tests.
  • Loading branch information
well-in-that-case committed Apr 6, 2023
1 parent 3c1b5c8 commit 90f0cfd
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 24 deletions.
5 changes: 1 addition & 4 deletions src/llex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,13 @@ static const char *const luaX_tokens [] = {
#ifdef PLUTO_COMPATIBLE_CLASS
"class",
#endif
"pluto_switch", "pluto_continue", "pluto_when", "pluto_enum", "pluto_new", "pluto_class", "pluto_parent", "pluto_export",
"pluto_switch", "pluto_continue", "pluto_enum", "pluto_new", "pluto_class", "pluto_parent", "pluto_export",
#ifndef PLUTO_COMPATIBLE_SWITCH
"switch",
#endif
#ifndef PLUTO_COMPATIBLE_CONTINUE
"continue",
#endif
#ifndef PLUTO_COMPATIBLE_WHEN
"when",
#endif
#ifndef PLUTO_COMPATIBLE_ENUM
"enum",
#endif
Expand Down
5 changes: 1 addition & 4 deletions src/llex.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,14 @@ enum RESERVED {
#ifdef PLUTO_COMPATIBLE_CLASS
TK_CLASS,
#endif
TK_PSWITCH, TK_PCONTINUE, TK_PWHEN, TK_PENUM, TK_PNEW, TK_PCLASS, TK_PPARENT, TK_PEXPORT, // New compatibility keywords.
TK_PSWITCH, TK_PCONTINUE, TK_PENUM, TK_PNEW, TK_PCLASS, TK_PPARENT, TK_PEXPORT, // New compatibility keywords.
/* New non-compatible keywords. */
#ifndef PLUTO_COMPATIBLE_SWITCH
TK_SWITCH,
#endif
#ifndef PLUTO_COMPATIBLE_CONTINUE
TK_CONTINUE,
#endif
#ifndef PLUTO_COMPATIBLE_WHEN
TK_WHEN,
#endif
#ifndef PLUTO_COMPATIBLE_ENUM
TK_ENUM,
#endif
Expand Down
14 changes: 0 additions & 14 deletions src/lparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1067,10 +1067,6 @@ static int block_follow (LexState *ls, int withuntil) {
case TK_ELSE: case TK_ELSEIF:
case TK_END: case TK_EOS:
return 1;
case TK_PWHEN:
#ifndef PLUTO_COMPATIBLE_WHEN
case TK_WHEN:
#endif
case TK_UNTIL: return withuntil;
default: return 0;
}
Expand Down Expand Up @@ -3339,16 +3335,6 @@ static void repeatstat (LexState *ls) {
luaK_patchtohere(fs, bl1.scopeend);
if (testnext(ls, TK_UNTIL)) {
condexit = cond(ls); /* read condition (inside scope block) */
#ifdef PLUTO_COMPATIBLE_WHEN
} else if (testnext(ls, TK_PWHEN)) {
#else
} else if (testnext2(ls, TK_PWHEN, TK_WHEN)) {
#endif
expdesc v;
expr(ls, &v); /* read condition */
v.normaliseFalse();
luaK_goiffalse(ls->fs, &v);
condexit = v.t;
}
else {
error_expected(ls, TK_UNTIL);
Expand Down
2 changes: 0 additions & 2 deletions src/luaconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -836,8 +836,6 @@
// If defined, only 'pluto_... you get the idea.
#define PLUTO_COMPATIBLE_CONTINUE

#define PLUTO_COMPATIBLE_WHEN

#define PLUTO_COMPATIBLE_ENUM

#define PLUTO_COMPATIBLE_NEW
Expand Down

0 comments on commit 90f0cfd

Please sign in to comment.