OLD | NEW |
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 part of dart_backend; | 5 part of dart_backend; |
6 | 6 |
7 class LocalPlaceholder { | 7 class LocalPlaceholder { |
8 final String identifier; | 8 final String identifier; |
9 final Set<Node> nodes; | 9 final Set<Node> nodes; |
10 LocalPlaceholder(this.identifier) : nodes = new Set<Node>(); | 10 LocalPlaceholder(this.identifier) : nodes = new Set<Node>(); |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 return; | 362 return; |
363 } | 363 } |
364 | 364 |
365 ClassElement cls = element.enclosingClass; | 365 ClassElement cls = element.enclosingClass; |
366 if (cls != null && cls.isEnumClass) { | 366 if (cls != null && cls.isEnumClass) { |
367 // Enums and enum values cannot be changed, since the semantics of | 367 // Enums and enum values cannot be changed, since the semantics of |
368 // `toString` is defined by the names of the declarations. | 368 // `toString` is defined by the names of the declarations. |
369 return; | 369 return; |
370 } | 370 } |
371 | 371 |
372 if (element.isGetter || element.isSetter) { | 372 if (element.isAccessor) { |
373 element = (element as FunctionElement).abstractField; | 373 element = (element as AccessorElement).abstractField; |
374 } | 374 } |
375 elementNodes.putIfAbsent(element, () => new Set<Node>()).add(node); | 375 elementNodes.putIfAbsent(element, () => new Set<Node>()).add(node); |
376 } | 376 } |
377 | 377 |
378 /// Marks [node] to be renamed per-library if it names an instance member | 378 /// Marks [node] to be renamed per-library if it names an instance member |
379 /// and has a private name. | 379 /// and has a private name. |
380 void tryMakePrivateIdentifier(Node node, Element element) { | 380 void tryMakePrivateIdentifier(Node node, Element element) { |
381 if (node is Identifier && | 381 if (node is Identifier && |
382 !Elements.isStaticOrTopLevel(element) && | 382 !Elements.isStaticOrTopLevel(element) && |
383 !Elements.isLocal(element) && | 383 !Elements.isLocal(element) && |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 | 718 |
719 visitBlock(Block node) { | 719 visitBlock(Block node) { |
720 for (Node statement in node.statements.nodes) { | 720 for (Node statement in node.statements.nodes) { |
721 if (statement is VariableDefinitions) { | 721 if (statement is VariableDefinitions) { |
722 makeVarDeclarationTypePlaceholder(statement); | 722 makeVarDeclarationTypePlaceholder(statement); |
723 } | 723 } |
724 } | 724 } |
725 node.visitChildren(this); | 725 node.visitChildren(this); |
726 } | 726 } |
727 } | 727 } |
OLD | NEW |