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

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

Issue 11085092: Revert "Made dart2js constructor lookup logic "private"-aware, fixed 4740 bug." and 5 subsequent at… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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
« no previous file with comments | « no previous file | lib/compiler/implementation/elements/elements.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 } 760 }
761 761
762 if (!foundSuperOrRedirect) { 762 if (!foundSuperOrRedirect) {
763 // No super initializer found. Try to find the default constructor if 763 // No super initializer found. Try to find the default constructor if
764 // the class is not Object. 764 // the class is not Object.
765 ClassElement enclosingClass = constructor.getEnclosingClass(); 765 ClassElement enclosingClass = constructor.getEnclosingClass();
766 ClassElement superClass = enclosingClass.superclass; 766 ClassElement superClass = enclosingClass.superclass;
767 if (enclosingClass != compiler.objectClass) { 767 if (enclosingClass != compiler.objectClass) {
768 assert(superClass !== null); 768 assert(superClass !== null);
769 assert(superClass.resolutionState == STATE_DONE); 769 assert(superClass.resolutionState == STATE_DONE);
770
771 Selector selector =
772 new Selector.callDefaultConstructor(enclosingClass.getLibrary());
773
774 FunctionElement targetConstructor = 770 FunctionElement targetConstructor =
775 superClass.lookupConstructor(selector); 771 superClass.lookupConstructor(superClass.name);
776 if (targetConstructor === null) { 772 if (targetConstructor === null) {
777 compiler.internalError("no default constructor available", 773 compiler.internalError("no default constructor available",
778 node: functionNode); 774 node: functionNode);
779 } 775 }
780 776
777 Selector selector = new Selector.call(superClass.name,
778 enclosingClass.getLibrary(),
779 0);
781 evaluateSuperOrRedirectSend(functionNode, 780 evaluateSuperOrRedirectSend(functionNode,
782 selector, 781 selector,
783 const Link<Node>(), 782 const Link<Node>(),
784 targetConstructor); 783 targetConstructor);
785 } 784 }
786 } 785 }
787 } 786 }
788 787
789 /** 788 /**
790 * Simulates the execution of the [constructor] with the given 789 * Simulates the execution of the [constructor] with the given
(...skipping 16 matching lines...) Expand all
807 Constant fieldValue = fieldValues[field]; 806 Constant fieldValue = fieldValues[field];
808 if (fieldValue === null) { 807 if (fieldValue === null) {
809 // Use the default value. 808 // Use the default value.
810 fieldValue = compiler.compileConstant(field); 809 fieldValue = compiler.compileConstant(field);
811 } 810 }
812 jsNewArguments.add(fieldValue); 811 jsNewArguments.add(fieldValue);
813 }); 812 });
814 return jsNewArguments; 813 return jsNewArguments;
815 } 814 }
816 } 815 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/elements/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698