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

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

Issue 2956723002: Implement inference tests for logical operators. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.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) 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 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 : super(left, operator, right); 1067 : super(left, operator, right);
1068 1068
1069 @override 1069 @override
1070 void _collectDependencies(KernelDependencyCollector collector) { 1070 void _collectDependencies(KernelDependencyCollector collector) {
1071 // No inference dependencies. 1071 // No inference dependencies.
1072 } 1072 }
1073 1073
1074 @override 1074 @override
1075 DartType _inferExpression( 1075 DartType _inferExpression(
1076 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { 1076 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
1077 // TODO(scheglov): implement. 1077 typeNeeded = inferrer.listener.logicalExpressionEnter(this, typeContext) ||
1078 return typeNeeded ? const DynamicType() : null; 1078 typeNeeded;
1079 var boolType = inferrer.coreTypes.boolClass.rawType;
1080 inferrer.inferExpression(left, boolType, false);
1081 inferrer.inferExpression(right, boolType, false);
1082 var inferredType = typeNeeded ? boolType : null;
1083 inferrer.listener.logicalExpressionExit(this, inferredType);
1084 return inferredType;
1079 } 1085 }
1080 } 1086 }
1081 1087
1082 /// Shadow object for [MapLiteral]. 1088 /// Shadow object for [MapLiteral].
1083 class KernelMapLiteral extends MapLiteral implements KernelExpression { 1089 class KernelMapLiteral extends MapLiteral implements KernelExpression {
1084 final DartType _declaredKeyType; 1090 final DartType _declaredKeyType;
1085 final DartType _declaredValueType; 1091 final DartType _declaredValueType;
1086 1092
1087 KernelMapLiteral(List<MapEntry> entries, 1093 KernelMapLiteral(List<MapEntry> entries,
1088 {DartType keyType, DartType valueType, bool isConst: false}) 1094 {DartType keyType, DartType valueType, bool isConst: false})
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 } 2242 }
2237 2243
2238 transformChildren(v) { 2244 transformChildren(v) {
2239 return internalError("Internal error: Unsupported operation."); 2245 return internalError("Internal error: Unsupported operation.");
2240 } 2246 }
2241 2247
2242 visitChildren(v) { 2248 visitChildren(v) {
2243 return internalError("Internal error: Unsupported operation."); 2249 return internalError("Internal error: Unsupported operation.");
2244 } 2250 }
2245 } 2251 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698