Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Issue 11026006: Do not put renaming logic into Unparser. (Closed)

Created:
8 years, 2 months ago by Anton Muhin
Modified:
8 years, 2 months ago
Reviewers:
ahe, Roman
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Do not put renaming logic into Unparser. Move it into EmitterUnparser instead to separate both clearly. R=ahe@google.com,smok@google.com Committed: https://code.google.com/p/dart/source/detail?r=13121

Patch Set 1 #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+33 lines, -32 lines) Patch
M lib/compiler/implementation/dart_backend/backend.dart View 2 chunks +22 lines, -1 line 6 comments Download
M lib/compiler/implementation/tree/unparser.dart View 4 chunks +11 lines, -31 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
Anton Muhin
8 years, 2 months ago (2012-10-01 18:46:40 UTC) #1
Roman
lgtm It's almost the same https://codereview.chromium.org/11026006/diff/1/lib/compiler/implementation/dart_backend/backend.dart File lib/compiler/implementation/dart_backend/backend.dart (right): https://codereview.chromium.org/11026006/diff/1/lib/compiler/implementation/dart_backend/backend.dart#newcode467 lib/compiler/implementation/dart_backend/backend.dart:467: // TODO(smok): Remove ugly ...
8 years, 2 months ago (2012-10-02 07:55:55 UTC) #2
Anton Muhin
https://codereview.chromium.org/11026006/diff/1/lib/compiler/implementation/dart_backend/backend.dart File lib/compiler/implementation/dart_backend/backend.dart (right): https://codereview.chromium.org/11026006/diff/1/lib/compiler/implementation/dart_backend/backend.dart#newcode467 lib/compiler/implementation/dart_backend/backend.dart:467: // TODO(smok): Remove ugly hack for library prefices. O ...
8 years, 2 months ago (2012-10-02 08:48:42 UTC) #3
ahe
LGTM! https://codereview.chromium.org/11026006/diff/1/lib/compiler/implementation/dart_backend/backend.dart File lib/compiler/implementation/dart_backend/backend.dart (right): https://codereview.chromium.org/11026006/diff/1/lib/compiler/implementation/dart_backend/backend.dart#newcode468 lib/compiler/implementation/dart_backend/backend.dart:468: if (node.receiver !== null && renames[node.receiver] == '') ...
8 years, 2 months ago (2012-10-02 14:27:39 UTC) #4
Anton Muhin
https://codereview.chromium.org/11026006/diff/1/lib/compiler/implementation/dart_backend/backend.dart File lib/compiler/implementation/dart_backend/backend.dart (right): https://codereview.chromium.org/11026006/diff/1/lib/compiler/implementation/dart_backend/backend.dart#newcode468 lib/compiler/implementation/dart_backend/backend.dart:468: if (node.receiver !== null && renames[node.receiver] == '') return; ...
8 years, 2 months ago (2012-10-02 14:32:15 UTC) #5
ahe
https://codereview.chromium.org/11026006/diff/1/lib/compiler/implementation/dart_backend/backend.dart File lib/compiler/implementation/dart_backend/backend.dart (right): https://codereview.chromium.org/11026006/diff/1/lib/compiler/implementation/dart_backend/backend.dart#newcode468 lib/compiler/implementation/dart_backend/backend.dart:468: if (node.receiver !== null && renames[node.receiver] == '') return; ...
8 years, 2 months ago (2012-10-09 07:40:59 UTC) #6
Anton Muhin
8 years, 2 months ago (2012-10-10 07:21:40 UTC) #7
https://codereview.chromium.org/11026006/diff/1/lib/compiler/implementation/d...
File lib/compiler/implementation/dart_backend/backend.dart (right):

https://codereview.chromium.org/11026006/diff/1/lib/compiler/implementation/d...
lib/compiler/implementation/dart_backend/backend.dart:468: if (node.receiver !==
null && renames[node.receiver] == '') return;
I assume you're asking for code being transformed.  If not, I'll show how we do
it.

Imagine the code

import 'mylib.dart' as mylib;

main() {
  mylib.topLevelField = 13;
}

where mylib.dart is

int topLevelField = 42;

we'd like to emit (omitting renames):

topLevelField = 42;

main() {
  topLevelField = 13;
}

omitting the prefix.

Our whole renamer can rename the whole AST nodes---we have a map from a node to
string where most of those nodes are identifiers and sometimes it sends, Roma is
currently unifying it all.

However, in this case this would be a send set and there is no node to rename
to, so we need this special trick to mark AST node as one that should be
actually removed the input.

Does that make sense?

Is there simpler approach?

We're considering AST rewrites for those, fyi.


On 2012/10/09 07:40:59, ahe wrote:
> Anton, could you give me an example with actual code?
> 
> On 2012/10/02 14:32:15, Anton Muhin wrote:
> > That'd be great, Peter.
> > 
> > The problem.  Imagine you use name with a prefix.  When we bundle the
> > application in a single file in most of the cases we want to delete this
> prefix
> > and emit the name w/o the prefix and that's the best way we came up by to
> > achieve that.
> > 
> > If notion of the name would have its own Send node, that is prefix.value = 1
> > would have translated into SendSet { target: Send { receiver: prefix,
> selector:
> > value }, value = 1 }, we could have renamed it at the level of nodes.
> > 
> > I'll submit this CL in ~20 mins after I ran the test.
> > 
> > On 2012/10/02 14:27:39, ahe wrote:
> > > I'm not sure what problem this is solving. If you show me an example,
> perhaps
> > I
> > > have a suggestion for getting rid of it.
> > 
>

Powered by Google App Engine
This is Rietveld 408576698