| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library analyzer2dart.treeShaker; | 5 library analyzer2dart.treeShaker; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/analyzer.dart'; | 9 import 'package:analyzer/analyzer.dart'; |
| 10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
| 11 import 'package:analyzer/src/generated/source.dart'; | 11 import 'package:analyzer/src/generated/source.dart'; |
| 12 import 'package:analyzer/src/generated/resolver.dart'; | 12 import 'package:analyzer/src/generated/resolver.dart'; |
| 13 import 'package:compiler/src/universe/universe.dart'; | 13 import 'package:compiler/src/universe/universe.dart'; |
| 14 import 'package:sharedfrontend/src/access_semantics.dart'; |
| 14 | 15 |
| 15 import 'closed_world.dart'; | 16 import 'closed_world.dart'; |
| 16 import 'util.dart'; | 17 import 'util.dart'; |
| 17 import 'semantic_visitor.dart'; | 18 import 'semantic_visitor.dart'; |
| 18 import 'identifier_semantics.dart'; | 19 import 'identifier_semantics.dart'; |
| 19 | 20 |
| 20 /** | 21 /** |
| 21 * The result of performing local reachability analysis on a method. | 22 * The result of performing local reachability analysis on a method. |
| 22 */ | 23 */ |
| 23 class MethodAnalysis { | 24 class MethodAnalysis { |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 @override | 304 @override |
| 304 void visitStaticPropertyInvocation(MethodInvocation node, | 305 void visitStaticPropertyInvocation(MethodInvocation node, |
| 305 AccessSemantics semantics) { | 306 AccessSemantics semantics) { |
| 306 // Invocation of a property. TODO(paulberry): handle this. | 307 // Invocation of a property. TODO(paulberry): handle this. |
| 307 super.visitStaticPropertyInvocation(node, semantics); | 308 super.visitStaticPropertyInvocation(node, semantics); |
| 308 } | 309 } |
| 309 | 310 |
| 310 void handleDynamicAccess(AccessSemantics semantics) { | 311 void handleDynamicAccess(AccessSemantics semantics) { |
| 311 if (semantics.isRead) { | 312 if (semantics.isRead) { |
| 312 analysis.invokes.add( | 313 analysis.invokes.add( |
| 313 new Selector.getter(semantics.identifier.name, null)); | 314 new Selector.getter(semantics.name, null)); |
| 314 } | 315 } |
| 315 if (semantics.isWrite) { | 316 if (semantics.isWrite) { |
| 316 // Selector.setter constructor uses the convention that setter names | 317 // Selector.setter constructor uses the convention that setter names |
| 317 // don't end in '='. | 318 // don't end in '='. |
| 318 analysis.invokes.add( | 319 analysis.invokes.add( |
| 319 new Selector.setter(semantics.identifier.name, null)); | 320 new Selector.setter(semantics.name, null)); |
| 320 } | 321 } |
| 321 } | 322 } |
| 322 | 323 |
| 323 @override | 324 @override |
| 324 void visitDynamicAccess(AstNode node, AccessSemantics semantics) { | 325 void visitDynamicAccess(AstNode node, AccessSemantics semantics) { |
| 325 handleDynamicAccess(semantics); | 326 handleDynamicAccess(semantics); |
| 326 } | 327 } |
| 327 | 328 |
| 328 @override | 329 @override |
| 329 void visitLocalFunctionAccess(AstNode node, AccessSemantics semantics) { | 330 void visitLocalFunctionAccess(AstNode node, AccessSemantics semantics) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // null, because that would have been detected by the analyzer and | 390 // null, because that would have been detected by the analyzer and |
| 390 // reported as a compile time error. | 391 // reported as a compile time error. |
| 391 analysis.calls.add(node.staticElement); | 392 analysis.calls.add(node.staticElement); |
| 392 } | 393 } |
| 393 | 394 |
| 394 @override | 395 @override |
| 395 void handleAssignmentExpression(AssignmentExpression node) { | 396 void handleAssignmentExpression(AssignmentExpression node) { |
| 396 // Don't special-case assignment expressions. | 397 // Don't special-case assignment expressions. |
| 397 } | 398 } |
| 398 } | 399 } |
| OLD | NEW |