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

Side by Side Diff: pkg/compiler/lib/src/compile_time_constants.dart

Issue 1437463005: Compute NewStructure in resolution. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Long line. Created 5 years, 1 month 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) 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 library dart2js.compile_time_constant_evaluator; 5 library dart2js.compile_time_constant_evaluator;
6 6
7 import 'common.dart'; 7 import 'common.dart';
8 import 'common/resolution.dart' show 8 import 'common/resolution.dart' show
9 Resolution; 9 Resolution;
10 import 'common/tasks.dart' show 10 import 'common/tasks.dart' show
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 ConstructorElement constructor, CallStructure callStructure, 819 ConstructorElement constructor, CallStructure callStructure,
820 {Link<Node> arguments, List<AstConstant> normalizedArguments}) { 820 {Link<Node> arguments, List<AstConstant> normalizedArguments}) {
821 // TODO(ahe): This is nasty: we must eagerly analyze the 821 // TODO(ahe): This is nasty: we must eagerly analyze the
822 // constructor to ensure the redirectionTarget has been computed 822 // constructor to ensure the redirectionTarget has been computed
823 // correctly. Find a way to avoid this. 823 // correctly. Find a way to avoid this.
824 _analyzeElementEagerly(compiler, constructor); 824 _analyzeElementEagerly(compiler, constructor);
825 825
826 // The redirection chain of this element may not have been resolved through 826 // The redirection chain of this element may not have been resolved through
827 // a post-process action, so we have to make sure it is done here. 827 // a post-process action, so we have to make sure it is done here.
828 compiler.resolver.resolveRedirectionChain(constructor, node); 828 compiler.resolver.resolveRedirectionChain(constructor, node);
829 InterfaceType constructedType =
830 constructor.computeEffectiveTargetType(type);
831 ConstructorElement target = constructor.effectiveTarget;
832 // The constructor must be an implementation to ensure that field
833 // initializers are handled correctly.
834 ConstructorElement implementation = target.implementation;
835 829
836 if (implementation.isMalformed) { 830 bool isInvalid = false;
837 // TODO(johnniwinther): This should probably be an [ErroneousAstConstant]. 831 InterfaceType constructedType = type;
838 return new AstConstant(context, node, new ConstructedConstantExpression( 832 ConstructorElement implementation;
839 type, constructor, callStructure, const <ConstantExpression>[]), 833 if (constructor.isRedirectingFactory) {
840 new ConstructedConstantValue( 834 if (constructor.isEffectiveTargetMalformed) {
841 constructedType, const <FieldElement, ConstantValue>{})); 835 isInvalid = true;
836 } else {
837 constructedType =
838 constructor.computeEffectiveTargetType(type);
839 ConstructorElement target = constructor.effectiveTarget;
840 // The constructor must be an implementation to ensure that field
841 // initializers are handled correctly.
842 implementation = target.implementation;
843 }
844 } else {
845 // The constructor must be an implementation to ensure that field
846 // initializers are handled correctly.
847 implementation = constructor.implementation;
848 isInvalid = implementation.isMalformed;
849 if (implementation.isGenerativeConstructor &&
850 constructor.enclosingClass.isAbstract) {
851 isInvalid = true;
852 }
853 }
854 if (isInvalid) {
855 return signalNotCompileTimeConstant(node);
842 } 856 }
843 857
844 List<AstConstant> concreteArguments; 858 List<AstConstant> concreteArguments;
845 if (arguments != null) { 859 if (arguments != null) {
846 Map<Node, AstConstant> concreteArgumentMap = <Node, AstConstant>{}; 860 Map<Node, AstConstant> concreteArgumentMap = <Node, AstConstant>{};
847 for (Link<Node> link = arguments; !link.isEmpty; link = link.tail) { 861 for (Link<Node> link = arguments; !link.isEmpty; link = link.tail) {
848 Node argument = link.head; 862 Node argument = link.head;
849 NamedArgument namedArgument = argument.asNamedArgument(); 863 NamedArgument namedArgument = argument.asNamedArgument();
850 if (namedArgument != null) { 864 if (namedArgument != null) {
851 argument = namedArgument.expression; 865 argument = namedArgument.expression;
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 class _CompilerEnvironment implements Environment { 1292 class _CompilerEnvironment implements Environment {
1279 final Compiler compiler; 1293 final Compiler compiler;
1280 1294
1281 _CompilerEnvironment(this.compiler); 1295 _CompilerEnvironment(this.compiler);
1282 1296
1283 @override 1297 @override
1284 String readFromEnvironment(String name) { 1298 String readFromEnvironment(String name) {
1285 return compiler.fromEnvironment(name); 1299 return compiler.fromEnvironment(name);
1286 } 1300 }
1287 } 1301 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | pkg/compiler/lib/src/elements/elements.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698