Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(294)

Issue 110096: An Alpha Renamer that makes it safe to embed user code in generated code. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
16 years, 7 months ago by MikeSamuel
Modified:
16 years, 6 months ago
Reviewers:
DavidSarah, ihab.awad
CC:
google-caja-discuss_googlegroups.com
Base URL:
http://google-caja.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Returns an expression that is structurally the same as e, but with identifiers renamed using the alpha renaming. If the input expression contains synthetic references or declarations, then those synthetic identifiers will not be rewritten. So after alpha renaming, matching references and declarations with non-synthetic identifiers is trivial. This renaming does not affect property names, so any relationship between a property name and a global variable will be broken. For this reason, all free variables must be specified in the input context or freeSynthetics set. Submitted @3729

Patch Set 1 #

Patch Set 2 : An Alpha Renamer that makes it safe to embed user code in generated code. #

Patch Set 3 : An Alpha Renamer that makes it safe to embed user code in generated code. #

Patch Set 4 : An Alpha Renamer that makes it safe to embed user code in generated code. #

Patch Set 5 : An Alpha Renamer that makes it safe to embed user code in generated code. #

Patch Set 6 : An Alpha Renamer that makes it safe to embed user code in generated code. #

Total comments: 28

Patch Set 7 : An Alpha Renamer that makes it safe to embed user code in generated code. #

Total comments: 16

Patch Set 8 : An Alpha Renamer that makes it safe to embed user code in generated code. #

Total comments: 21
Unified diffs Side-by-side diffs Delta from patch set Stats (+1239 lines, -11 lines) Patch
M src/com/google/caja/lexer/Keyword.java View 1 2 3 4 5 6 7 1 chunk +2 lines, -6 lines 2 comments Download
A src/com/google/caja/parser/quasiliteral/AlphaRenaming.java View 1 2 3 4 5 6 7 1 chunk +221 lines, -0 lines 10 comments Download
A src/com/google/caja/parser/quasiliteral/AlphaRenamingRewriter.java View 7 1 chunk +369 lines, -0 lines 2 comments Download
A src/com/google/caja/parser/quasiliteral/NameContext.java View 1 2 3 4 5 6 1 chunk +125 lines, -0 lines 2 comments Download
M src/com/google/caja/parser/quasiliteral/RewriterMessageType.java View 1 2 3 4 5 6 7 5 chunks +16 lines, -1 line 0 comments Download
M src/com/google/caja/parser/quasiliteral/Scope.java View 1 2 3 4 5 6 7 3 chunks +13 lines, -4 lines 0 comments Download
A src/com/google/caja/util/SafeIdentifierMaker.java View 1 2 3 4 5 6 1 chunk +94 lines, -0 lines 5 comments Download
A tests/com/google/caja/parser/quasiliteral/AlphaRenamingTest.java View 1 2 3 4 5 6 7 1 chunk +341 lines, -0 lines 0 comments Download
A tests/com/google/caja/util/SafeIdentifierMakerTest.java View 1 chunk +58 lines, -0 lines 0 comments Download

Messages

Total messages: 8
MikeSamuel
16 years, 7 months ago (2009-08-27 19:00:30 UTC) #1
ihab.awad
I have not looked in detail at the rules in AlphaRenamingRewriter or the tests in ...
16 years, 6 months ago (2009-09-10 04:11:19 UTC) #2
MikeSamuel
snapshotted http://codereview.appspot.com/110096/diff/3023/3028 File src/com/google/caja/parser/quasiliteral/AlphaRenaming.java (right): http://codereview.appspot.com/110096/diff/3023/3028#newcode48 Line 48: * that has no masking identifiers, and ...
16 years, 6 months ago (2009-09-10 19:14:44 UTC) #3
ihab.awad
LGTM http://codereview.appspot.com/110096/diff/2030/3041 File src/com/google/caja/parser/quasiliteral/AlphaRenaming.java (right): http://codereview.appspot.com/110096/diff/2030/3041#newcode62 Line 62: * not to conflict with generated code ...
16 years, 6 months ago (2009-09-14 20:13:18 UTC) #4
MikeSamuel
http://codereview.appspot.com/110096/diff/2030/3041 File src/com/google/caja/parser/quasiliteral/AlphaRenaming.java (right): http://codereview.appspot.com/110096/diff/2030/3041#newcode62 Line 62: * not to conflict with generated code names. ...
16 years, 6 months ago (2009-09-15 15:10:57 UTC) #5
DavidSarah
http://codereview.appspot.com/110096/diff/4003/4006 File src/com/google/caja/lexer/Keyword.java (right): http://codereview.appspot.com/110096/diff/4003/4006#newcode118 Line 118: public static boolean isKeyword(String identifier) { "isKeyword(String name)" ...
16 years, 6 months ago (2009-09-15 18:31:58 UTC) #6
MikeSamuel
Addressed in CL 116114 since this was committed. http://codereview.appspot.com/110096/diff/4003/4006 File src/com/google/caja/lexer/Keyword.java (right): http://codereview.appspot.com/110096/diff/4003/4006#newcode118 Line 118: ...
16 years, 6 months ago (2009-09-15 19:00:22 UTC) #7
MikeSamuel
16 years, 6 months ago (2009-09-16 02:47:04 UTC) #8
http://codereview.appspot.com/110096/diff/4003/4012
File src/com/google/caja/util/SafeIdentifierMaker.java (right):

http://codereview.appspot.com/110096/diff/4003/4012#newcode64
Line 64: public boolean isSafeIdentifier(String ident) {
David-Sarah responded:
> Right, but I meant that there is a maintenance and security review
> issue with having these checks in multiple places.

Ok.  So you're arguing for code consolidation.  I'll poke around and see if I
can find a way to consolidate, location-wise at least, the various identifier
predicates.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b