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

Issue 2902683004: Populate TypeInferrerImpl.closureContext more frequently. (Closed)

Created:
3 years, 7 months ago by Paul Berry
Modified:
3 years, 7 months ago
Reviewers:
scheglov
CC:
reviews_dartlang.org, dart-fe-team+reviews_google.com
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Populate TypeInferrerImpl.closureContext more frequently. Previously, we only used a ClosureContext in the case where the innermost function being inferred was a function expression. This meant that we couldn't use the declared return type as the context for `return` or `yield` statements in any other sort of function. As a first step towards fixing that, this CL makes the following changes: - The entry point to type inference is now a separate TypeInferrer.inferFunctionBody method rather than re-using TypeInferrer.inferStatement; this gives us an opportunity to set up the context. - Some of the logic from KernelFunctionExpression._inferExpression (particularly to do with asynchronous and generator functions) is moved to ClosureContext so that it can be used for other sorts of functions. - The only time TypeInferrerImpl.closureContext is ever `null` is now when inferring a top level or field initializer expression, so we can eliminate some null checks from KernelReturnStatement._inferStatement and KernelYieldStatement._inferStatement. R=scheglov@google.com Committed: https://github.com/dart-lang/sdk/commit/0d31c8c524d73a2265df23113d77204fbe0370aa

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+109 lines, -92 lines) Patch
M pkg/front_end/lib/src/fasta/kernel/body_builder.dart View 1 chunk +2 lines, -1 line 0 comments Download
M pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart View 6 chunks +21 lines, -68 lines 0 comments Download
M pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart View 9 chunks +86 lines, -23 lines 0 comments Download

Messages

Total messages: 5 (2 generated)
Paul Berry
3 years, 7 months ago (2017-05-23 18:01:03 UTC) #2
scheglov
LGTM
3 years, 7 months ago (2017-05-23 18:11:19 UTC) #3
Paul Berry
3 years, 7 months ago (2017-05-23 18:21:50 UTC) #5
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
0d31c8c524d73a2265df23113d77204fbe0370aa (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698