ECMA-conformance fix to (95045) - added 'enum' and 'debugger' as

reserved words, and changed the versioning check that previously
applied to 'export' to accept any 'ecma' version... which means that
export becomes a keyword for the default version.  Does this mean
we'll need to unreserve all the java keywords?  Not sure we want to do
that...
This commit is contained in:
mccabe 1998-04-29 23:57:20 +00:00
Родитель e1312c52c9
Коммит 5b41f43d8b
2 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -43,12 +43,13 @@
#include "jsscan.h"
#define RESERVE_JAVA_KEYWORDS
#define RESERVE_ECMA_KEYWORDS
static struct keyword {
char *name;
int16 tokentype; /* JSTokenType */
int8 op; /* JSOp */
int8 version; /* JSVersion */
uint8 version; /* JSVersion */
} keywords[] = {
{"break", TOK_BREAK, JSOP_NOP},
{"case", TOK_CASE, JSOP_NOP},
@ -124,6 +125,11 @@ static struct keyword {
{"volatile", TOK_RESERVED, JSOP_NOP},
#endif
#ifdef RESERVE_ECMA_KEYWORDS
{"debugger", TOK_RESERVED, JSOP_NOP, JSVERSION_1_3},
{"enum", TOK_RESERVED, JSOP_NOP, JSVERSION_1_3},
#endif
{0}
};
@ -137,7 +143,8 @@ js_InitScanner(JSContext *cx)
atom = js_Atomize(cx, kw->name, strlen(kw->name), ATOM_PINNED);
if (!atom)
return JS_FALSE;
atom->kwindex = (kw->version <= cx->version) ? kw - keywords : -1;
atom->kwindex = (JSVERSION_IS_ECMA(cx->version)
|| kw->version <= cx->version) ? kw - keywords : -1;
}
return JS_TRUE;
}

Просмотреть файл

@ -47,12 +47,13 @@
#include "jsscan.h"
#define RESERVE_JAVA_KEYWORDS
#define RESERVE_ECMA_KEYWORDS
static struct keyword {
char *name;
int16 tokentype; /* JSTokenType */
int8 op; /* JSOp */
int8 version; /* JSVersion */
uint8 version; /* JSVersion */
} keywords[] = {
{"break", TOK_BREAK, JSOP_NOP},
{"case", TOK_CASE, JSOP_NOP},
@ -128,6 +129,11 @@ static struct keyword {
{"volatile", TOK_RESERVED, JSOP_NOP},
#endif
#ifdef RESERVE_ECMA_KEYWORDS
{"debugger", TOK_RESERVED, JSOP_NOP, JSVERSION_1_3},
{"enum", TOK_RESERVED, JSOP_NOP, JSVERSION_1_3},
#endif
{0}
};
@ -141,7 +147,8 @@ js_InitScanner(JSContext *cx)
atom = js_Atomize(cx, kw->name, strlen(kw->name), ATOM_PINNED);
if (!atom)
return JS_FALSE;
atom->kwindex = (kw->version <= cx->version) ? kw - keywords : -1;
atom->kwindex = (JSVERSION_IS_ECMA(cx->version)
|| kw->version <= cx->version) ? kw - keywords : -1;
}
return JS_TRUE;
}