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

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

Issue 812523002: Change signature of lookupConstructor to only require a name. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fail gracefully on missing default constructors when evaluating constant constructors. Created 5 years, 11 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of js_backend; 5 part of js_backend;
6 6
7 const VERBOSE_OPTIMIZER_HINTS = false; 7 const VERBOSE_OPTIMIZER_HINTS = false;
8 8
9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR");
10 10
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 enqueue(enqueuer, getNativeInterceptorMethod, registry); 844 enqueue(enqueuer, getNativeInterceptorMethod, registry);
845 enqueueClass(enqueuer, jsInterceptorClass, compiler.globalDependencies); 845 enqueueClass(enqueuer, jsInterceptorClass, compiler.globalDependencies);
846 enqueueClass(enqueuer, jsPlainJavaScriptObjectClass, registry); 846 enqueueClass(enqueuer, jsPlainJavaScriptObjectClass, registry);
847 } else if (cls == mapLiteralClass) { 847 } else if (cls == mapLiteralClass) {
848 // For map literals, the dependency between the implementation class 848 // For map literals, the dependency between the implementation class
849 // and [Map] is not visible, so we have to add it manually. 849 // and [Map] is not visible, so we have to add it manually.
850 Element getFactory(String name, int arity) { 850 Element getFactory(String name, int arity) {
851 // The constructor is on the patch class, but dart2js unit tests don't 851 // The constructor is on the patch class, but dart2js unit tests don't
852 // have a patch class. 852 // have a patch class.
853 ClassElement implementation = cls.patch != null ? cls.patch : cls; 853 ClassElement implementation = cls.patch != null ? cls.patch : cls;
854 return implementation.lookupConstructor( 854 Selector selector = new Selector.callConstructor(name,
855 new Selector.callConstructor( 855 mapLiteralClass.library, arity);
856 name, mapLiteralClass.library, arity), 856 return implementation.validateConstructorLookupResults(selector,
Johnni Winther 2015/01/08 09:47:44 Remove [Element.validateConstructorLookupResults]
herhut 2015/01/22 10:33:20 Done.
857 (element) { 857 implementation.lookupConstructor(name),
858 compiler.internalError(mapLiteralClass, 858 (element) {
859 "Map literal class $mapLiteralClass missing " 859 compiler.internalError(mapLiteralClass,
860 "'$name' constructor" 860 "Map literal class $mapLiteralClass missing "
861 " ${mapLiteralClass.constructors}"); 861 "'$name' constructor"
862 }); 862 " ${mapLiteralClass.constructors}");
863 });
863 } 864 }
864 mapLiteralConstructor = getFactory('_literal', 1); 865 mapLiteralConstructor = getFactory('_literal', 1);
865 mapLiteralConstructorEmpty = getFactory('_empty', 0); 866 mapLiteralConstructorEmpty = getFactory('_empty', 0);
866 enqueueInResolution(mapLiteralConstructor, registry); 867 enqueueInResolution(mapLiteralConstructor, registry);
867 enqueueInResolution(mapLiteralConstructorEmpty, registry); 868 enqueueInResolution(mapLiteralConstructorEmpty, registry);
868 } 869 }
869 } 870 }
870 if (cls == closureClass) { 871 if (cls == closureClass) {
871 enqueue(enqueuer, findHelper('closureFromTearOff'), registry); 872 enqueue(enqueuer, findHelper('closureFromTearOff'), registry);
872 } 873 }
(...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 } 2507 }
2507 } 2508 }
2508 2509
2509 /// Records that [constant] is used by the element behind [registry]. 2510 /// Records that [constant] is used by the element behind [registry].
2510 class Dependency { 2511 class Dependency {
2511 final ConstantValue constant; 2512 final ConstantValue constant;
2512 final Element annotatedElement; 2513 final Element annotatedElement;
2513 2514
2514 const Dependency(this.constant, this.annotatedElement); 2515 const Dependency(this.constant, this.annotatedElement);
2515 } 2516 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698