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

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

Issue 2904653002: Always record inference of implicit function expression params, even if dynamic. (Closed)
Patch Set: Created 3 years, 7 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 | no next file » | 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 // recovery path. 420 // recovery path.
421 substitution = Substitution.empty; 421 substitution = Substitution.empty;
422 } 422 }
423 423
424 // Define `Ri` as follows: if `Pi` is not `_`, let `Ri` be `Pi`. 424 // Define `Ri` as follows: if `Pi` is not `_`, let `Ri` be `Pi`.
425 // Otherwise, if `Qi` is not `_`, let `Ri` be the greatest closure of 425 // Otherwise, if `Qi` is not `_`, let `Ri` be the greatest closure of
426 // `Qi[T/S]` with respect to `?`. Otherwise, let `Ri` be `dynamic`. 426 // `Qi[T/S]` with respect to `?`. Otherwise, let `Ri` be `dynamic`.
427 for (int i = 0; i < formals.length; i++) { 427 for (int i = 0; i < formals.length; i++) {
428 KernelVariableDeclaration formal = formals[i]; 428 KernelVariableDeclaration formal = formals[i];
429 if (KernelVariableDeclaration.isImplicitlyTyped(formal)) { 429 if (KernelVariableDeclaration.isImplicitlyTyped(formal)) {
430 DartType inferredType;
430 if (formalTypesFromContext[i] != null) { 431 if (formalTypesFromContext[i] != null) {
431 var inferredType = greatestClosure(inferrer.coreTypes, 432 inferredType = greatestClosure(inferrer.coreTypes,
432 substitution.substituteType(formalTypesFromContext[i])); 433 substitution.substituteType(formalTypesFromContext[i]));
433 inferrer.instrumentation?.record( 434 } else {
434 Uri.parse(inferrer.uri), 435 inferredType = const DynamicType();
435 formal.fileOffset,
436 'type',
437 new InstrumentationValueForType(inferredType));
438 formal.type = inferredType;
439 } 436 }
437 inferrer.instrumentation?.record(
438 Uri.parse(inferrer.uri),
439 formal.fileOffset,
440 'type',
441 new InstrumentationValueForType(inferredType));
442 formal.type = inferredType;
440 } 443 }
441 } 444 }
442 445
443 // Let `N'` be `N[T/S]`. The [ClosureContext] constructor will adjust 446 // Let `N'` be `N[T/S]`. The [ClosureContext] constructor will adjust
444 // accordingly if the closure is declared with `async`, `async*`, or 447 // accordingly if the closure is declared with `async`, `async*`, or
445 // `sync*`. 448 // `sync*`.
446 if (returnContext != null) { 449 if (returnContext != null) {
447 returnContext = substitution.substituteType(returnContext); 450 returnContext = substitution.substituteType(returnContext);
448 } 451 }
449 452
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 closureContext.isAsync 1321 closureContext.isAsync
1319 ? inferrer.coreTypes.streamClass 1322 ? inferrer.coreTypes.streamClass
1320 : inferrer.coreTypes.iterableClass); 1323 : inferrer.coreTypes.iterableClass);
1321 } 1324 }
1322 var inferredType = inferrer.inferExpression( 1325 var inferredType = inferrer.inferExpression(
1323 expression, typeContext, closureContext != null); 1326 expression, typeContext, closureContext != null);
1324 closureContext?.handleYield(inferrer, isYieldStar, inferredType); 1327 closureContext?.handleYield(inferrer, isYieldStar, inferredType);
1325 inferrer.listener.yieldStatementExit(this); 1328 inferrer.listener.yieldStatementExit(this);
1326 } 1329 }
1327 } 1330 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698