Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend_helpers.dart

Issue 2545153002: Handle synthetic nodes use to throw exceptions (Closed)
Patch Set: Also handle malformed type Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.js_backend.helpers; 5 library dart2js.js_backend.helpers;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/names.dart' show Identifiers, Uris; 8 import '../common/names.dart' show Identifiers, Uris;
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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 Element findHelper(String name) => find(jsHelperLibrary, name); 208 Element findHelper(String name) => find(jsHelperLibrary, name);
209 Element findAsyncHelper(String name) => find(asyncLibrary, name); 209 Element findAsyncHelper(String name) => find(asyncLibrary, name);
210 Element findInterceptor(String name) => find(interceptorsLibrary, name); 210 Element findInterceptor(String name) => find(interceptorsLibrary, name);
211 Element find(LibraryElement library, String name) { 211 Element find(LibraryElement library, String name) {
212 Element element = library.implementation.findLocal(name); 212 Element element = library.implementation.findLocal(name);
213 assert(invariant(library, element != null, 213 assert(invariant(library, element != null,
214 message: "Element '$name' not found in '${library.canonicalUri}'.")); 214 message: "Element '$name' not found in '${library.canonicalUri}'."));
215 return element; 215 return element;
216 } 216 }
217 217
218 Element findCoreHelper(String name) =>
219 compiler.commonElements.coreLibrary.implementation.localLookup(name);
220
218 ConstructorElement _findConstructor(ClassElement cls, String name) { 221 ConstructorElement _findConstructor(ClassElement cls, String name) {
219 cls.ensureResolved(resolution); 222 cls.ensureResolved(resolution);
220 ConstructorElement constructor = cls.lookupConstructor(name); 223 ConstructorElement constructor = cls.lookupConstructor(name);
221 assert(invariant(cls, constructor != null, 224 assert(invariant(cls, constructor != null,
222 message: "Constructor '$name' not found in '${cls}'.")); 225 message: "Constructor '$name' not found in '${cls}'."));
223 return constructor; 226 return constructor;
224 } 227 }
225 228
226 void onLibraryCreated(LibraryElement library) { 229 void onLibraryCreated(LibraryElement library) {
227 Uri uri = library.canonicalUri; 230 Uri uri = library.canonicalUri;
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 } 629 }
627 630
628 Element get checkDeferredIsLoaded { 631 Element get checkDeferredIsLoaded {
629 return findHelper('checkDeferredIsLoaded'); 632 return findHelper('checkDeferredIsLoaded');
630 } 633 }
631 634
632 Element get throwNoSuchMethod { 635 Element get throwNoSuchMethod {
633 return findHelper('throwNoSuchMethod'); 636 return findHelper('throwNoSuchMethod');
634 } 637 }
635 638
639 Element get genericNoSuchMethod =>
640 _genericNoSuchMethod ??= findCoreHelper('_genericNoSuchMethod');
641 MethodElement _genericNoSuchMethod;
642
643 Element get unresolvedConstructorError => _unresolvedConstructorError ??=
644 findCoreHelper('_unresolvedConstructorError');
645 MethodElement _unresolvedConstructorError;
646
647 Element get malformedTypeError =>
648 _malformedTypeError ??= findCoreHelper('_malformedTypeError');
649 MethodElement _malformedTypeError;
650
636 Element get createRuntimeType { 651 Element get createRuntimeType {
637 return findHelper('createRuntimeType'); 652 return findHelper('createRuntimeType');
638 } 653 }
639 654
640 Element get fallThroughError { 655 Element get fallThroughError {
641 return findHelper("getFallThroughError"); 656 return findHelper("getFallThroughError");
642 } 657 }
643 658
644 Element get createInvocationMirror { 659 Element get createInvocationMirror {
645 return findHelper('createInvocationMirror'); 660 return findHelper('createInvocationMirror');
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 MethodElement _objectNoSuchMethod; 810 MethodElement _objectNoSuchMethod;
796 811
797 MethodElement get objectNoSuchMethod { 812 MethodElement get objectNoSuchMethod {
798 if (_objectNoSuchMethod == null) { 813 if (_objectNoSuchMethod == null) {
799 _objectNoSuchMethod = 814 _objectNoSuchMethod =
800 coreClasses.objectClass.lookupLocalMember(Identifiers.noSuchMethod_); 815 coreClasses.objectClass.lookupLocalMember(Identifiers.noSuchMethod_);
801 } 816 }
802 return _objectNoSuchMethod; 817 return _objectNoSuchMethod;
803 } 818 }
804 } 819 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698