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

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

Issue 2954063002: Small fixes to top level type inference. (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
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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 collector.collectDependencies(then); 421 collector.collectDependencies(then);
422 collector.collectDependencies(otherwise); 422 collector.collectDependencies(otherwise);
423 } 423 }
424 424
425 @override 425 @override
426 DartType _inferExpression( 426 DartType _inferExpression(
427 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { 427 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
428 typeNeeded = 428 typeNeeded =
429 inferrer.listener.conditionalExpressionEnter(this, typeContext) || 429 inferrer.listener.conditionalExpressionEnter(this, typeContext) ||
430 typeNeeded; 430 typeNeeded;
431 if (!inferrer.isTopLevel) { 431 if (!inferrer.isTopLevel ||
432 TypeInferenceEngineImpl.expandedTopLevelInference) {
432 inferrer.inferExpression( 433 inferrer.inferExpression(
433 condition, inferrer.coreTypes.boolClass.rawType, false); 434 condition, inferrer.coreTypes.boolClass.rawType, false);
434 } 435 }
435 DartType thenType = inferrer.inferExpression(then, typeContext, true); 436 DartType thenType = inferrer.inferExpression(then, typeContext, true);
436 DartType otherwiseType = 437 DartType otherwiseType =
437 inferrer.inferExpression(otherwise, typeContext, true); 438 inferrer.inferExpression(otherwise, typeContext, true);
438 DartType type = inferrer.typeSchemaEnvironment 439 DartType type = inferrer.typeSchemaEnvironment
439 .getLeastUpperBound(thenType, otherwiseType); 440 .getLeastUpperBound(thenType, otherwiseType);
440 if (inferrer.strongMode) { 441 if (inferrer.strongMode) {
441 staticType = type; 442 staticType = type;
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after
2216 } 2217 }
2217 2218
2218 transformChildren(v) { 2219 transformChildren(v) {
2219 return internalError("Internal error: Unsupported operation."); 2220 return internalError("Internal error: Unsupported operation.");
2220 } 2221 }
2221 2222
2222 visitChildren(v) { 2223 visitChildren(v) {
2223 return internalError("Internal error: Unsupported operation."); 2224 return internalError("Internal error: Unsupported operation.");
2224 } 2225 }
2225 } 2226 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698