зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
e1312c52c9
Коммит
5b41f43d8b
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче