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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/compile_time_constants.dart
diff --git a/pkg/compiler/lib/src/compile_time_constants.dart b/pkg/compiler/lib/src/compile_time_constants.dart
index f4f306c62d50116058c0b1b9c83b8de87fdbecaa..d633e6b1394eab126a3a3b88fffc02f70b9ce6bc 100644
--- a/pkg/compiler/lib/src/compile_time_constants.dart
+++ b/pkg/compiler/lib/src/compile_time_constants.dart
@@ -826,19 +826,33 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
// The redirection chain of this element may not have been resolved through
// a post-process action, so we have to make sure it is done here.
compiler.resolver.resolveRedirectionChain(constructor, node);
- InterfaceType constructedType =
- constructor.computeEffectiveTargetType(type);
- ConstructorElement target = constructor.effectiveTarget;
- // The constructor must be an implementation to ensure that field
- // initializers are handled correctly.
- ConstructorElement implementation = target.implementation;
-
- if (implementation.isMalformed) {
- // TODO(johnniwinther): This should probably be an [ErroneousAstConstant].
- return new AstConstant(context, node, new ConstructedConstantExpression(
- type, constructor, callStructure, const <ConstantExpression>[]),
- new ConstructedConstantValue(
- constructedType, const <FieldElement, ConstantValue>{}));
+
+ bool isInvalid = false;
+ InterfaceType constructedType = type;
+ ConstructorElement implementation;
+ if (constructor.isRedirectingFactory) {
+ if (constructor.isEffectiveTargetMalformed) {
+ isInvalid = true;
+ } else {
+ constructedType =
+ constructor.computeEffectiveTargetType(type);
+ ConstructorElement target = constructor.effectiveTarget;
+ // The constructor must be an implementation to ensure that field
+ // initializers are handled correctly.
+ implementation = target.implementation;
+ }
+ } else {
+ // The constructor must be an implementation to ensure that field
+ // initializers are handled correctly.
+ implementation = constructor.implementation;
+ isInvalid = implementation.isMalformed;
+ if (implementation.isGenerativeConstructor &&
+ constructor.enclosingClass.isAbstract) {
+ isInvalid = true;
+ }
+ }
+ if (isInvalid) {
+ return signalNotCompileTimeConstant(node);
}
List<AstConstant> concreteArguments;
« 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