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

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

Issue 23452038: Check cycles in redirecting factories. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/elements/modelx.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 part of dart2js; 5 part of dart2js;
6 6
7 /** 7 /**
8 * The [ConstantHandler] keeps track of compile-time constants, 8 * The [ConstantHandler] keeps track of compile-time constants,
9 * initializations of global and static fields, and default values of 9 * initializations of global and static fields, and default values of
10 * optional parameters. 10 * optional parameters.
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 return makeConstructedConstant(node, type, constructor, evaluateArguments); 706 return makeConstructedConstant(node, type, constructor, evaluateArguments);
707 } 707 }
708 708
709 Constant makeConstructedConstant( 709 Constant makeConstructedConstant(
710 Node node, InterfaceType type, FunctionElement constructor, 710 Node node, InterfaceType type, FunctionElement constructor,
711 List<Constant> getArguments(FunctionElement constructor)) { 711 List<Constant> getArguments(FunctionElement constructor)) {
712 if (constructor.isRedirectingFactory) { 712 if (constructor.isRedirectingFactory) {
713 type = constructor.computeTargetType(compiler, type); 713 type = constructor.computeTargetType(compiler, type);
714 } 714 }
715 715
716 constructor = constructor.redirectionTarget; 716 FunctionElement target = constructor.redirectionTarget;
717 if (target != null) {
718 constructor = target;
719 } else {
720 constructor = constructor.defaultImplementation;
721 }
717 ClassElement classElement = constructor.getEnclosingClass(); 722 ClassElement classElement = constructor.getEnclosingClass();
718 // The constructor must be an implementation to ensure that field 723 // The constructor must be an implementation to ensure that field
719 // initializers are handled correctly. 724 // initializers are handled correctly.
720 constructor = constructor.implementation; 725 constructor = constructor.implementation;
721 assert(invariant(node, constructor.isImplementation)); 726 assert(invariant(node, constructor.isImplementation));
722 727
723 List<Constant> arguments = getArguments(constructor); 728 List<Constant> arguments = getArguments(constructor);
724 ConstructorEvaluator evaluator = 729 ConstructorEvaluator evaluator =
725 new ConstructorEvaluator(constructor, handler, compiler); 730 new ConstructorEvaluator(constructor, handler, compiler);
726 evaluator.evaluateConstructorFieldValues(arguments); 731 evaluator.evaluateConstructorFieldValues(arguments);
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 if (fieldValue == null) { 955 if (fieldValue == null) {
951 // Use the default value. 956 // Use the default value.
952 fieldValue = handler.compileConstant(field); 957 fieldValue = handler.compileConstant(field);
953 } 958 }
954 jsNewArguments.add(fieldValue); 959 jsNewArguments.add(fieldValue);
955 }, 960 },
956 includeSuperAndInjectedMembers: true); 961 includeSuperAndInjectedMembers: true);
957 return jsNewArguments; 962 return jsNewArguments;
958 } 963 }
959 } 964 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/elements/modelx.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698