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

Side by Side Diff: lib/compiler/implementation/compile_time_constants.dart

Issue 10947024: Made dart2js constructor lookup logic "private"-aware, fixed 4740 bug. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed indentation. Created 8 years, 3 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 /** 5 /**
6 * The [ConstantHandler] keeps track of compile-time constants, 6 * The [ConstantHandler] keeps track of compile-time constants,
7 * initializations of global and static fields, and default values of 7 * initializations of global and static fields, and default values of
8 * optional parameters. 8 * optional parameters.
9 */ 9 */
10 class ConstantHandler extends CompilerTask { 10 class ConstantHandler extends CompilerTask {
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 } 745 }
746 746
747 if (!foundSuperOrRedirect) { 747 if (!foundSuperOrRedirect) {
748 // No super initializer found. Try to find the default constructor if 748 // No super initializer found. Try to find the default constructor if
749 // the class is not Object. 749 // the class is not Object.
750 ClassElement enclosingClass = constructor.getEnclosingClass(); 750 ClassElement enclosingClass = constructor.getEnclosingClass();
751 ClassElement superClass = enclosingClass.superclass; 751 ClassElement superClass = enclosingClass.superclass;
752 if (enclosingClass != compiler.objectClass) { 752 if (enclosingClass != compiler.objectClass) {
753 assert(superClass !== null); 753 assert(superClass !== null);
754 assert(superClass.resolutionState == STATE_DONE); 754 assert(superClass.resolutionState == STATE_DONE);
755
756 Selector selector = new Selector.callConstructor(
757 new SelectorName.namedClass(superClass.name),
758 enclosingClass.getLibrary());
755 FunctionElement targetConstructor = 759 FunctionElement targetConstructor =
756 superClass.lookupConstructor(superClass.name); 760 superClass.lookupConstructor(selector);
757 if (targetConstructor === null) { 761 if (targetConstructor === null) {
758 compiler.internalError("no default constructor available", 762 compiler.internalError("no default constructor available",
759 node: functionNode); 763 node: functionNode);
760 } 764 }
761 765
762 Selector selector = new Selector.call(superClass.name,
763 enclosingClass.getLibrary(),
764 0);
765 evaluateSuperOrRedirectSend(functionNode, 766 evaluateSuperOrRedirectSend(functionNode,
766 selector, 767 selector,
767 const EmptyLink<Node>(), 768 const EmptyLink<Node>(),
768 targetConstructor); 769 targetConstructor);
769 } 770 }
770 } 771 }
771 } 772 }
772 773
773 /** 774 /**
774 * Simulates the execution of the [constructor] with the given 775 * Simulates the execution of the [constructor] with the given
(...skipping 16 matching lines...) Expand all
791 Constant fieldValue = fieldValues[field]; 792 Constant fieldValue = fieldValues[field];
792 if (fieldValue === null) { 793 if (fieldValue === null) {
793 // Use the default value. 794 // Use the default value.
794 fieldValue = compiler.compileConstant(field); 795 fieldValue = compiler.compileConstant(field);
795 } 796 }
796 jsNewArguments.add(fieldValue); 797 jsNewArguments.add(fieldValue);
797 }); 798 });
798 return jsNewArguments; 799 return jsNewArguments;
799 } 800 }
800 } 801 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698