| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 import 'dart:collection' show Queue; | 5 import 'dart:collection' show Queue; |
| 6 | 6 |
| 7 import 'package:kernel/ast.dart' as ir; | 7 import 'package:kernel/ast.dart' as ir; |
| 8 import 'package:kernel/verifier.dart' show CheckParentPointers; | 8 import 'package:kernel/verifier.dart' show CheckParentPointers; |
| 9 | 9 |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 } | 700 } |
| 701 return false; | 701 return false; |
| 702 } | 702 } |
| 703 | 703 |
| 704 ir.Constructor getDartCoreConstructor( | 704 ir.Constructor getDartCoreConstructor( |
| 705 String className, String constructorName) { | 705 String className, String constructorName) { |
| 706 LibraryElement library = | 706 LibraryElement library = |
| 707 compiler.libraryLoader.lookupLibrary(Uris.dart_core); | 707 compiler.libraryLoader.lookupLibrary(Uris.dart_core); |
| 708 ClassElement cls = library.implementation.localLookup(className); | 708 ClassElement cls = library.implementation.localLookup(className); |
| 709 cls.ensureResolved(compiler.resolution); | 709 cls.ensureResolved(compiler.resolution); |
| 710 assert(invariant(CURRENT_ELEMENT_SPANNABLE, cls != null, | 710 assert( |
| 711 message: 'dart:core class $className not found.')); | 711 cls != null, |
| 712 failedAt(CURRENT_ELEMENT_SPANNABLE, |
| 713 'dart:core class $className not found.')); |
| 712 ConstructorElement constructor = cls.lookupConstructor(constructorName); | 714 ConstructorElement constructor = cls.lookupConstructor(constructorName); |
| 713 assert(invariant(CURRENT_ELEMENT_SPANNABLE, constructor != null, | 715 assert( |
| 714 message: "Constructor '$constructorName' not found " | 716 constructor != null, |
| 715 "in class '$className'.")); | 717 failedAt(CURRENT_ELEMENT_SPANNABLE, |
| 718 "Constructor '$constructorName' not found in class '$className'.")); |
| 716 compiler.resolution.ensureResolved(constructor); | 719 compiler.resolution.ensureResolved(constructor); |
| 717 return functionToIr(constructor); | 720 return functionToIr(constructor); |
| 718 } | 721 } |
| 719 | 722 |
| 720 ir.Procedure getDartCoreMethod(String name) { | 723 ir.Procedure getDartCoreMethod(String name) { |
| 721 LibraryElement library = | 724 LibraryElement library = |
| 722 compiler.libraryLoader.lookupLibrary(Uris.dart_core); | 725 compiler.libraryLoader.lookupLibrary(Uris.dart_core); |
| 723 Element function = library.implementation.localLookup(name); | 726 Element function = library.implementation.localLookup(name); |
| 724 assert(invariant(CURRENT_ELEMENT_SPANNABLE, function != null, | 727 assert( |
| 725 message: "dart:core method '$name' not found.")); | 728 function != null, |
| 729 failedAt( |
| 730 CURRENT_ELEMENT_SPANNABLE, "dart:core method '$name' not found.")); |
| 726 compiler.resolution.ensureResolved(function); | 731 compiler.resolution.ensureResolved(function); |
| 727 return functionToIr(function); | 732 return functionToIr(function); |
| 728 } | 733 } |
| 729 | 734 |
| 730 ir.Procedure getMalformedTypeErrorBuilder() { | 735 ir.Procedure getMalformedTypeErrorBuilder() { |
| 731 return getDartCoreMethod('_malformedTypeError'); | 736 return getDartCoreMethod('_malformedTypeError'); |
| 732 } | 737 } |
| 733 | 738 |
| 734 ir.Procedure getUnresolvedConstructorBuilder() { | 739 ir.Procedure getUnresolvedConstructorBuilder() { |
| 735 return getDartCoreMethod('_unresolvedConstructorError'); | 740 return getDartCoreMethod('_unresolvedConstructorError'); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 } | 786 } |
| 782 | 787 |
| 783 class ConstructorTarget { | 788 class ConstructorTarget { |
| 784 final ConstructorElement element; | 789 final ConstructorElement element; |
| 785 final ResolutionDartType type; | 790 final ResolutionDartType type; |
| 786 | 791 |
| 787 ConstructorTarget(this.element, this.type); | 792 ConstructorTarget(this.element, this.type); |
| 788 | 793 |
| 789 String toString() => "ConstructorTarget($element, $type)"; | 794 String toString() => "ConstructorTarget($element, $type)"; |
| 790 } | 795 } |
| OLD | NEW |