Review Request: kjs: Allow keywords as object propertynames
Maksim Orlovich
mo85 at cornell.edu
Tue Feb 28 02:04:05 GMT 2012
Thanks for the patch.
I don't think that this is a good approach. Spec-wise, what permits
keywords to be used in a few spots is not just the production
MemberExpression ::= MemberExpression . IdentifierName and likewise
for CallExpression (where IdentifierName matches both our
IdentifierOrKeyword and our Identifier) but also the PropertyName ::=
IdentifierName production, which occurs in other contexts -- in
particular object literals. And you can't say that a reserved word is
an identifier after a {, but
{ if : 42 } is legal! I think it would be both more general and
cleaner to add a new non-terminal to our syntactic grammar
corresponding to IdentifierName and then use it in spots where the
ES5.1 grammar calls for it.
Hope this helps,
Maks
On 2/23/12, Bernd Buschinski <b.buschinski at googlemail.com> wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/104058/
> -----------------------------------------------------------
>
> Review request for kdelibs.
>
>
> Description
> -------
>
> For kjs,
>
> Allow keywords as object propterynames, like:
>
> var tokenCodes = {};
> tokenCodes.null = 0;
> tokenCodes.true = 1;
>
> This fixes 24 ecmascript262 tests
> 7.6.1-2-1 to 7.6.1-2-12
> and
> 7.6.1-6-1 to 7.6.1-6-12
>
>
> Diffs
> -----
>
> kjs/lexer.cpp e89de5f
>
> Diff: http://git.reviewboard.kde.org/r/104058/diff/
>
>
> Testing
> -------
>
> tested with ecmascript262 (until konq hits the freeze bug), no new fails
>
>
> Thanks,
>
> Bernd Buschinski
>
>
More information about the kde-core-devel
mailing list