| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 dart2js.mirrors_used; | 5 library dart2js.mirrors_used; |
| 6 | 6 |
| 7 import 'dart2jslib.dart' show | 7 import 'dart2jslib.dart' show |
| 8 Compiler, | 8 Compiler, |
| 9 CompilerTask, | 9 CompilerTask, |
| 10 Constant, | 10 Constant, |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 node, | 429 node, |
| 430 kind, {'name': node, 'type': apiTypeOf(constant)}); | 430 kind, {'name': node, 'type': apiTypeOf(constant)}); |
| 431 return null; | 431 return null; |
| 432 } | 432 } |
| 433 } | 433 } |
| 434 | 434 |
| 435 /// Find the first non-implementation interface of constant. | 435 /// Find the first non-implementation interface of constant. |
| 436 DartType apiTypeOf(Constant constant) { | 436 DartType apiTypeOf(Constant constant) { |
| 437 DartType type = constant.computeType(compiler); | 437 DartType type = constant.computeType(compiler); |
| 438 LibraryElement library = type.element.library; | 438 LibraryElement library = type.element.library; |
| 439 if (type.kind == TypeKind.INTERFACE && library.isInternalLibrary) { | 439 if (type.isInterfaceType && library.isInternalLibrary) { |
| 440 InterfaceType interface = type; | 440 InterfaceType interface = type; |
| 441 ClassElement cls = type.element; | 441 ClassElement cls = type.element; |
| 442 cls.ensureResolved(compiler); | 442 cls.ensureResolved(compiler); |
| 443 for (DartType supertype in cls.allSupertypes) { | 443 for (DartType supertype in cls.allSupertypes) { |
| 444 if (supertype.kind == TypeKind.INTERFACE | 444 if (supertype.isInterfaceType |
| 445 && !supertype.element.library.isInternalLibrary) { | 445 && !supertype.element.library.isInternalLibrary) { |
| 446 return interface.asInstanceOf(supertype.element); | 446 return interface.asInstanceOf(supertype.element); |
| 447 } | 447 } |
| 448 } | 448 } |
| 449 } | 449 } |
| 450 return type; | 450 return type; |
| 451 } | 451 } |
| 452 | 452 |
| 453 /// Convert a list of strings and types to a list of elements. Types are | 453 /// Convert a list of strings and types to a list of elements. Types are |
| 454 /// converted to their corresponding element, and strings are resolved as | 454 /// converted to their corresponding element, and strings are resolved as |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 // @MirrorsUsed(targets: fisk) | 582 // @MirrorsUsed(targets: fisk) |
| 583 // ^^^^ | 583 // ^^^^ |
| 584 // | 584 // |
| 585 // Instead of saying 'fisk' should pretty print the problematic constant | 585 // Instead of saying 'fisk' should pretty print the problematic constant |
| 586 // value. | 586 // value. |
| 587 return spannable; | 587 return spannable; |
| 588 } | 588 } |
| 589 return node; | 589 return node; |
| 590 } | 590 } |
| 591 } | 591 } |
| OLD | NEW |