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

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart

Issue 2998573002: Add type inference for invalid constructor initializers. (Closed)
Patch Set: Created 3 years, 4 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
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 /// This file declares a "shadow hierarchy" of concrete classes which extend 5 /// This file declares a "shadow hierarchy" of concrete classes which extend
6 /// the kernel class hierarchy, adding methods and fields needed by the 6 /// the kernel class hierarchy, adding methods and fields needed by the
7 /// BodyBuilder. 7 /// BodyBuilder.
8 /// 8 ///
9 /// Instances of these classes may be created using the factory methods in 9 /// Instances of these classes may be created using the factory methods in
10 /// `ast_factory.dart`. 10 /// `ast_factory.dart`.
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 DartType _inferExpression( 1012 DartType _inferExpression(
1013 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { 1013 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
1014 typeNeeded = 1014 typeNeeded =
1015 inferrer.listener.intLiteralEnter(this, typeContext) || typeNeeded; 1015 inferrer.listener.intLiteralEnter(this, typeContext) || typeNeeded;
1016 var inferredType = typeNeeded ? inferrer.coreTypes.intClass.rawType : null; 1016 var inferredType = typeNeeded ? inferrer.coreTypes.intClass.rawType : null;
1017 inferrer.listener.intLiteralExit(this, inferredType); 1017 inferrer.listener.intLiteralExit(this, inferredType);
1018 return inferredType; 1018 return inferredType;
1019 } 1019 }
1020 } 1020 }
1021 1021
1022 /// Concrete shadow object representing an invalid initializer in kernel form.
1023 class KernelInvalidInitializer extends LocalInitializer
1024 implements KernelInitializer {
1025 KernelInvalidInitializer(VariableDeclaration variable) : super(variable);
1026
1027 @override
1028 void _inferInitializer(KernelTypeInferrer inferrer) {
1029 inferrer.listener.invalidInitializerEnter(this);
1030 inferrer.inferExpression(variable.initializer, null, false);
1031 inferrer.listener.invalidInitializerExit(this);
1032 }
1033 }
1034
1022 /// Concrete shadow object representing a non-inverted "is" test in kernel form. 1035 /// Concrete shadow object representing a non-inverted "is" test in kernel form.
1023 class KernelIsExpression extends IsExpression implements KernelExpression { 1036 class KernelIsExpression extends IsExpression implements KernelExpression {
1024 KernelIsExpression(Expression operand, DartType type) : super(operand, type); 1037 KernelIsExpression(Expression operand, DartType type) : super(operand, type);
1025 1038
1026 @override 1039 @override
1027 void _collectDependencies(KernelDependencyCollector collector) { 1040 void _collectDependencies(KernelDependencyCollector collector) {
1028 // No inference dependencies. 1041 // No inference dependencies.
1029 } 1042 }
1030 1043
1031 @override 1044 @override
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
2462 accept(v) => unsupported("accept", -1, null); 2475 accept(v) => unsupported("accept", -1, null);
2463 2476
2464 accept1(v, arg) => unsupported("accept1", -1, null); 2477 accept1(v, arg) => unsupported("accept1", -1, null);
2465 2478
2466 getStaticType(types) => unsupported("getStaticType", -1, null); 2479 getStaticType(types) => unsupported("getStaticType", -1, null);
2467 2480
2468 transformChildren(v) => unsupported("transformChildren", -1, null); 2481 transformChildren(v) => unsupported("transformChildren", -1, null);
2469 2482
2470 visitChildren(v) => unsupported("visitChildren", -1, null); 2483 visitChildren(v) => unsupported("visitChildren", -1, null);
2471 } 2484 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698