Fixed error message associated with trying to use a keyword as an

identifier; it was only printing the first character of the
identifier, because it expected 8-bit chars, and was being called with
a 16-bit representation of the offending keyword.
This commit is contained in:
mccabe 1998-04-29 23:52:40 +00:00
parent a10d8fc983
commit 1fa5a6ab37
2 changed files with 8 additions and 6 deletions

View File

@ -2333,9 +2333,10 @@ PrimaryExpr(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
case TOK_IMPORT:
#endif
case TOK_RESERVED:
js_ReportCompileError(cx, ts, "%.*s is a reserved identifier",
ts->token.pos.end.index - ts->token.pos.begin.index,
ts->token.ptr);
js_ReportCompileError(cx, ts, "%s is a reserved identifier",
js_DeflateString(cx, ts->token.ptr,
ts->token.pos.end.index -
ts->token.pos.begin.index));
return NULL;
case TOK_ERROR:

View File

@ -2337,9 +2337,10 @@ PrimaryExpr(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
case TOK_IMPORT:
#endif
case TOK_RESERVED:
js_ReportCompileError(cx, ts, "%.*s is a reserved identifier",
ts->token.pos.end.index - ts->token.pos.begin.index,
ts->token.ptr);
js_ReportCompileError(cx, ts, "%s is a reserved identifier",
js_DeflateString(cx, ts->token.ptr,
ts->token.pos.end.index -
ts->token.pos.begin.index));
return NULL;
case TOK_ERROR: