Approved.

One comment:  This confused me at first:

  protected boolean isKeyword(String s) {
    return (! KEYWORDS_WHITELIST.contains(s))
        && (KEYWORDS_BLACKLIST.contains(s) || super.isKeyword(s));
  }

because it makes it seem like a keyword might be both on the whitelist and the 
blacklist.  Maybe

  protected boolean isKeyword(String s) {
    return KEYWORDS_BLACKLIST.contains(s) ||
        ((! KEYWORDS_WHITELIST.contains(s)) && super.isKeyword(s));
  }

would be more legible?

On 2011-04-14, at 06:07, André Bargull wrote:

> Change bargull-20110408-0bu by bargull@Bargull02 on 2011-04-08 00:50:04
> in /home/anba/src/svn/openlaszlo/trunk
> for http://svn.openlaszlo.org/openlaszlo/trunk
> 
> Summary: Allow reserved words in object literals and call/member expressions
> 
> New Features: LPP-9868 (ECMAScript5: Allow ReservedWord in ObjectLiteral, 
> MemberExpression, CallExpression)
> 
> Technical Reviewer: ptw
> QA Reviewer: (pending)
> 
> Overview:
> ECMAScript5 allows reserved words in object literal and call/member 
> expressions, this is useful to avoid annoying quoting (e.g. `foo.class = bar` 
> instead of `foo["class"] = bar`).
> 
> Details:
> Parser.jjt:
> - ordered token entries in IdentifierOrAS3Keyword()
> - added ReservedWord() production which contains all reserved words minus 
> "static" and "final"
> - removed IdentifierOrKeyword() and replaced with IdentifierName() production
> - IdentifierName() accepts any identifier including reserved words
> - changed PrimarySuffix() and PropertyNameValue() to use IdentifierName() per 
> ES5
> 
> ScriptCompiler.java:
> - ordered keyword list
> - added helper method to identify keywords
> - (note: the keyword lists don't match with the parser, tracked in LPP-9866)
> 
> JavascriptGenerator.java:
> - the updates for this class are necessary to make the generated code ES3 
> compliant
> #visitObjectLiteral()
> - quote keywords in ASTObjectLiteral
> #visitPropertyIdentifierReference()
> - rewrite ASTPropertyIdentifierReference to ASTPropertyValueReference if 
> identifier is a keyword
> #translateReference()
> - rewrite ASTPropertyIdentifierReference to ASTPropertyValueReference if 
> identifier is a keyword
> 
> SWF9Generator.java:
> - override isKeyword() to account for namespaces in AS3
> 
> 
> Tests:
> smokecheck (swf10,dhtml) x [IE, Firefox, Safari, Opera]
> 
> Files:
> M WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java
> M WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java
> M WEB-INF/lps/server/src/org/openlaszlo/sc/ScriptCompiler.java
> M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/Parser.jjt
> 
> Changeset: 
> http://svn.openlaszlo.org/openlaszlo/patches/bargull-20110408-0bu.tar
> 


Reply via email to