| 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 | 8 import '../common/backend_api.dart' show |
| 9 ForeignResolver; | 9 ForeignResolver; |
| 10 import '../common/registry.dart' show | 10 import '../common/registry.dart' show |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 nativeClasses.forEach(walkPotentialSubclasses); | 229 nativeClasses.forEach(walkPotentialSubclasses); |
| 230 | 230 |
| 231 nativeClasses.addAll(nativeClassesAndSubclasses); | 231 nativeClasses.addAll(nativeClassesAndSubclasses); |
| 232 unusedClasses.addAll(nativeClassesAndSubclasses); | 232 unusedClasses.addAll(nativeClassesAndSubclasses); |
| 233 } | 233 } |
| 234 | 234 |
| 235 /** | 235 /** |
| 236 * Returns the source string of the class named in the extends clause, or | 236 * Returns the source string of the class named in the extends clause, or |
| 237 * `null` if there is no extends clause. | 237 * `null` if there is no extends clause. |
| 238 */ | 238 */ |
| 239 String findExtendsNameOfClass(ClassElement classElement) { | 239 String findExtendsNameOfClass(BaseClassElementX classElement) { |
| 240 if (classElement.isResolved) { | |
| 241 return classElement?.superclass?.name; | |
| 242 } | |
| 243 | |
| 244 // "class B extends A ... {}" --> "A" | 240 // "class B extends A ... {}" --> "A" |
| 245 // "class B extends foo.A ... {}" --> "A" | 241 // "class B extends foo.A ... {}" --> "A" |
| 246 // "class B<T> extends foo.A<T,T> with M1, M2 ... {}" --> "A" | 242 // "class B<T> extends foo.A<T,T> with M1, M2 ... {}" --> "A" |
| 247 | 243 |
| 248 // We want to avoid calling classElement.parseNode on every class. Doing so | 244 // We want to avoid calling classElement.parseNode on every class. Doing so |
| 249 // will slightly increase parse time and size and cause compiler errors and | 245 // will slightly increase parse time and size and cause compiler errors and |
| 250 // warnings to me emitted in more unused code. | 246 // warnings to me emitted in more unused code. |
| 251 | 247 |
| 252 // An alternative to this code is to extend the API of ClassElement to | 248 // An alternative to this code is to extend the API of ClassElement to |
| 253 // expose the name of the extended element. | 249 // expose the name of the extended element. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 | 361 |
| 366 void flushQueue() { | 362 void flushQueue() { |
| 367 if (flushing) return; | 363 if (flushing) return; |
| 368 flushing = true; | 364 flushing = true; |
| 369 while (!queue.isEmpty) { | 365 while (!queue.isEmpty) { |
| 370 (queue.removeFirst())(); | 366 (queue.removeFirst())(); |
| 371 } | 367 } |
| 372 flushing = false; | 368 flushing = false; |
| 373 } | 369 } |
| 374 | 370 |
| 375 processClass(ClassElement classElement, cause) { | 371 processClass(BaseClassElementX classElement, cause) { |
| 376 // TODO(ahe): Fix this assertion to work in incremental compilation. | 372 // TODO(ahe): Fix this assertion to work in incremental compilation. |
| 377 assert(compiler.hasIncrementalSupport || | 373 assert(compiler.hasIncrementalSupport || |
| 378 !registeredClasses.contains(classElement)); | 374 !registeredClasses.contains(classElement)); |
| 379 | 375 |
| 380 bool firstTime = registeredClasses.isEmpty; | 376 bool firstTime = registeredClasses.isEmpty; |
| 381 pendingClasses.remove(classElement); | 377 pendingClasses.remove(classElement); |
| 382 registeredClasses.add(classElement); | 378 registeredClasses.add(classElement); |
| 383 | 379 |
| 384 // TODO(ahe): Is this really a global dependency? | 380 // TODO(ahe): Is this really a global dependency? |
| 385 classElement.ensureResolved(resolution); | 381 classElement.ensureResolved(resolution); |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 superclass, | 721 superclass, |
| 726 () => <ClassElement>[]); | 722 () => <ClassElement>[]); |
| 727 directSubtypes.add(cls); | 723 directSubtypes.add(cls); |
| 728 } | 724 } |
| 729 | 725 |
| 730 void logSummary(log(message)) { | 726 void logSummary(log(message)) { |
| 731 log('Compiled ${registeredClasses.length} native classes, ' | 727 log('Compiled ${registeredClasses.length} native classes, ' |
| 732 '${unusedClasses.length} native classes omitted.'); | 728 '${unusedClasses.length} native classes omitted.'); |
| 733 } | 729 } |
| 734 } | 730 } |
| OLD | NEW |