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

Side by Side Diff: lib/compiler/implementation/dart_backend/placeholder_collector.dart

Issue 10837343: Unify private names treatment. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | lib/compiler/implementation/dart_backend/renamer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class LocalPlaceholder implements Hashable { 5 class LocalPlaceholder implements Hashable {
6 final String identifier; 6 final String identifier;
7 final Set<Node> nodes; 7 final Set<Node> nodes;
8 LocalPlaceholder(this.identifier) : nodes = new Set<Node>(); 8 LocalPlaceholder(this.identifier) : nodes = new Set<Node>();
9 int hashCode() => identifier.hashCode(); 9 int hashCode() => identifier.hashCode();
10 String toString() => 10 String toString() =>
(...skipping 16 matching lines...) Expand all
27 } 27 }
28 } 28 }
29 29
30 visitDynamicSend(Send node) { 30 visitDynamicSend(Send node) {
31 tryRenamePrivateSelector(node); 31 tryRenamePrivateSelector(node);
32 } 32 }
33 33
34 visitGetterSend(Send node) { 34 visitGetterSend(Send node) {
35 final element = elements[node]; 35 final element = elements[node];
36 // element === null means dynamic property access. 36 // element === null means dynamic property access.
37 if (element === null || element.isInstanceMember()) { 37 if (element === null || element.isMember()) {
38 tryRenamePrivateSelector(node); 38 tryRenamePrivateSelector(node);
39 return; 39 return;
40 } 40 }
41 // We don't want to rename non top-level element access 41 // We don't want to rename non top-level element access
42 // unless it's a local variable. 42 // unless it's a local variable.
43 if (element.isPrefix()) { 43 if (element.isPrefix()) {
44 // Node is prefix part in case of source 'lib.somesetter = 5;' 44 // Node is prefix part in case of source 'lib.somesetter = 5;'
45 collector.makeNullPlaceholder(node); 45 collector.makeNullPlaceholder(node);
46 return; 46 return;
47 } else if (!element.isTopLevel()) { 47 } else if (!element.isTopLevel()) {
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 visit(Node node) => (node === null) ? null : node.accept(this); 289 visit(Node node) => (node === null) ? null : node.accept(this);
290 290
291 visitNode(Node node) { node.visitChildren(this); } // We must go deeper. 291 visitNode(Node node) { node.visitChildren(this); } // We must go deeper.
292 292
293 visitSend(Send send) { 293 visitSend(Send send) {
294 new SendVisitor(this, treeElements).visitSend(send); 294 new SendVisitor(this, treeElements).visitSend(send);
295 send.visitChildren(this); 295 send.visitChildren(this);
296 } 296 }
297 297
298 visitSendSet(SendSet send) { 298 visitSendSet(SendSet send) {
299 if (send.selector is Identifier) {
300 tryMakePrivateIdentifier(send.selector.asIdentifier());
301 }
299 final element = treeElements[send]; 302 final element = treeElements[send];
300 if (element !== null) { 303 if (element !== null) {
301 if (element.isInstanceMember()) { 304 if (element.isTopLevel()) {
302 tryMakePrivateIdentifier(send.selector.asIdentifier());
303 } else if (element.isTopLevel()) {
304 assert(element is VariableElement || element.isSetter()); 305 assert(element is VariableElement || element.isSetter());
305 makeElementPlaceholder(send.selector, element); 306 makeElementPlaceholder(send.selector, element);
306 } else { 307 } else {
307 assert(send.selector is Identifier); 308 assert(send.selector is Identifier);
308 tryMakeLocalPlaceholder(element, send.selector); 309 tryMakeLocalPlaceholder(element, send.selector);
309 } 310 }
310 } 311 }
311 send.visitChildren(this); 312 send.visitChildren(this);
312 } 313 }
313 314
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 visit(node.defaultClause.typeArguments); 421 visit(node.defaultClause.typeArguments);
421 } 422 }
422 } 423 }
423 424
424 visitTypedef(Typedef node) { 425 visitTypedef(Typedef node) {
425 assert(currentElement is TypedefElement); 426 assert(currentElement is TypedefElement);
426 makeElementPlaceholder(node.name, currentElement); 427 makeElementPlaceholder(node.name, currentElement);
427 node.visitChildren(this); 428 node.visitChildren(this);
428 } 429 }
429 } 430 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/dart_backend/renamer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698