| 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 import 'dart:collection' show Queue; | 5 import 'dart:collection' show Queue; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/backend_api.dart' show ForeignResolver; | 8 import '../common/backend_api.dart' show ForeignResolver; |
| 9 import '../common/resolution.dart' show Resolution; | 9 import '../common/resolution.dart' show Resolution; |
| 10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 assert(type is VoidType); | 480 assert(type is VoidType); |
| 481 } | 481 } |
| 482 } | 482 } |
| 483 if (matchingClasses.isNotEmpty && _registeredClasses.isEmpty) { | 483 if (matchingClasses.isNotEmpty && _registeredClasses.isEmpty) { |
| 484 matchingClasses.addAll(_onFirstNativeClass(impactBuilder)); | 484 matchingClasses.addAll(_onFirstNativeClass(impactBuilder)); |
| 485 } | 485 } |
| 486 _registerTypeUses(impactBuilder, matchingClasses, cause); | 486 _registerTypeUses(impactBuilder, matchingClasses, cause); |
| 487 | 487 |
| 488 // Give an info so that library developers can compile with -v to find why | 488 // Give an info so that library developers can compile with -v to find why |
| 489 // all the native classes are included. | 489 // all the native classes are included. |
| 490 if (unusedBefore == matchingClasses.length) { | 490 if (unusedBefore > 0 && unusedBefore == matchingClasses.length) { |
| 491 reporter.log('All native types marked as used due to $cause.'); | 491 reporter.log('All native types marked as used due to $cause.'); |
| 492 } | 492 } |
| 493 } | 493 } |
| 494 | 494 |
| 495 Iterable<ClassElement> _findUnusedClassesMatching( | 495 Iterable<ClassElement> _findUnusedClassesMatching( |
| 496 bool predicate(classElement)) { | 496 bool predicate(classElement)) { |
| 497 return _unusedClasses.where(predicate); | 497 return _unusedClasses.where(predicate); |
| 498 } | 498 } |
| 499 | 499 |
| 500 Iterable<ClassElement> _onFirstNativeClass(WorldImpactBuilder impactBuilder) { | 500 Iterable<ClassElement> _onFirstNativeClass(WorldImpactBuilder impactBuilder) { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 List<Element> directSubtypes = | 662 List<Element> directSubtypes = |
| 663 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassElement>[]); | 663 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassElement>[]); |
| 664 directSubtypes.add(cls); | 664 directSubtypes.add(cls); |
| 665 } | 665 } |
| 666 | 666 |
| 667 void logSummary(log(message)) { | 667 void logSummary(log(message)) { |
| 668 log('Compiled ${_registeredClasses.length} native classes, ' | 668 log('Compiled ${_registeredClasses.length} native classes, ' |
| 669 '${_unusedClasses.length} native classes omitted.'); | 669 '${_unusedClasses.length} native classes omitted.'); |
| 670 } | 670 } |
| 671 } | 671 } |
| OLD | NEW |