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

Issue 2981693002: Start copying resolution/inference data from front end to analyzer ASTs. (Closed)

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

Description

Start copying resolution/inference data from front end to analyzer ASTs. This CL lays the groundwork for integrating the front end with analyzer by creating a mechanism to copy resolution and type inference information (produced by the front end's type inference engine) into analyzer ASTs (produced by AstBuilder). The general technique is to parse each function twice: once with BodyBuilder as a listener and once with AstBuilder as a listener. The BodyBuilder generates a kernel representation of the function, but this isn't used; instead, type inference and resolution information is captured using ResolutionStorer (which is a TypeInferenceListener). Later, this information is applied to the analyzer AST generated by AstBuilder using ResolutionApplier (which is an analyzer AST visitor). At the moment the intermediate data exchanged between ResolutionStorer and ResolutionApplier is simply a list of types (one for each subexpression, in a post-order traversal of the program syntax). For debugging and validation purposes, this is augmented with a list of file offsets, so that if the ResolutionStorer and ResolutionApplier get out of sync we can diagnose the problem easily. In later CLs, more data will need to be exchanged between ResolutionStorer and ResolutionApplier (e.g. a list of elements to which identifiers are resolved). This CL doesn't tackle the problem of translating between the kernel and analyzer representation of types; for now we simply map each type to `dynamic`. This is sufficient for early development, since it is still enough to let us verify that ResolutionStorer and ResolutionApplier stay in sync. R=ahe@google.com, scheglov@google.com Committed: https://github.com/dart-lang/sdk/commit/b87556e00df95257f242c307fcb14abb074af3e9

Patch Set 1 #

Total comments: 6

Patch Set 2 : Address code review comments. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+970 lines, -41 lines) Patch
M pkg/analyzer/lib/src/dart/analysis/file_state.dart View 1 1 chunk +1 line, -0 lines 0 comments Download
M pkg/analyzer/lib/src/fasta/analyzer_diet_listener.dart View 3 chunks +163 lines, -5 lines 2 comments Download
M pkg/analyzer/lib/src/fasta/analyzer_loader.dart View 2 chunks +26 lines, -2 lines 0 comments Download
M pkg/analyzer/lib/src/fasta/analyzer_target.dart View 1 chunk +26 lines, -3 lines 0 comments Download
M pkg/analyzer/lib/src/fasta/ast_builder.dart View 2 chunks +13 lines, -7 lines 0 comments Download
A pkg/analyzer/lib/src/fasta/resolution_applier.dart View 1 1 chunk +75 lines, -0 lines 0 comments Download
A pkg/analyzer/lib/src/fasta/resolution_storer.dart View 1 chunk +45 lines, -0 lines 0 comments Download
M pkg/analyzer/lib/src/generated/parser_fasta.dart View 1 chunk +1 line, -1 line 0 comments Download
M pkg/analyzer/test/generated/parser_fasta_test.dart View 1 chunk +1 line, -1 line 0 comments Download
M pkg/front_end/lib/src/fasta/source/diet_listener.dart View 3 chunks +23 lines, -5 lines 0 comments Download
A + pkg/front_end/test/fasta/ast_builder_test.dart View 2 chunks +3 lines, -3 lines 0 comments Download
M pkg/front_end/test/fasta/kompile_test.dart View 1 chunk +1 line, -0 lines 0 comments Download
M pkg/front_end/test/fasta/testing/suite.dart View 6 chunks +31 lines, -12 lines 0 comments Download
A pkg/front_end/testcases/ast_builder.status View 1 chunk +541 lines, -0 lines 0 comments Download
M pkg/front_end/testing.json View 1 chunk +17 lines, -0 lines 0 comments Download
M pkg/front_end/tool/_fasta/analyzer_compile.dart View 1 chunk +1 line, -1 line 0 comments Download
M pkg/front_end/tool/fasta_perf.dart View 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 8 (2 generated)
Paul Berry
I'd appreciate a review from both Peter and Konstantin. Peter--the integration with DietListener feels a ...
3 years, 5 months ago (2017-07-12 21:27:23 UTC) #2
scheglov
LGTM https://codereview.chromium.org/2981693002/diff/1/pkg/analyzer/lib/src/dart/analysis/file_state.dart File pkg/analyzer/lib/src/dart/analysis/file_state.dart (right): https://codereview.chromium.org/2981693002/diff/1/pkg/analyzer/lib/src/dart/analysis/file_state.dart#newcode591 pkg/analyzer/lib/src/dart/analysis/file_state.dart:591: true, This probably does not matter much, given ...
3 years, 5 months ago (2017-07-12 21:43:47 UTC) #3
Paul Berry
https://codereview.chromium.org/2981693002/diff/1/pkg/analyzer/lib/src/dart/analysis/file_state.dart File pkg/analyzer/lib/src/dart/analysis/file_state.dart (right): https://codereview.chromium.org/2981693002/diff/1/pkg/analyzer/lib/src/dart/analysis/file_state.dart#newcode591 pkg/analyzer/lib/src/dart/analysis/file_state.dart:591: true, On 2017/07/12 21:43:46, scheglov wrote: > This probably ...
3 years, 5 months ago (2017-07-12 22:20:12 UTC) #4
ahe
lgtm https://codereview.chromium.org/2981693002/diff/20001/pkg/analyzer/lib/src/fasta/analyzer_diet_listener.dart File pkg/analyzer/lib/src/fasta/analyzer_diet_listener.dart (right): https://codereview.chromium.org/2981693002/diff/20001/pkg/analyzer/lib/src/fasta/analyzer_diet_listener.dart#newcode159 pkg/analyzer/lib/src/fasta/analyzer_diet_listener.dart:159: // resolution data or inferred types. Run the ...
3 years, 5 months ago (2017-07-13 14:51:40 UTC) #5
Paul Berry
https://codereview.chromium.org/2981693002/diff/20001/pkg/analyzer/lib/src/fasta/analyzer_diet_listener.dart File pkg/analyzer/lib/src/fasta/analyzer_diet_listener.dart (right): https://codereview.chromium.org/2981693002/diff/20001/pkg/analyzer/lib/src/fasta/analyzer_diet_listener.dart#newcode159 pkg/analyzer/lib/src/fasta/analyzer_diet_listener.dart:159: // resolution data or inferred types. Run the body ...
3 years, 5 months ago (2017-07-13 15:54:46 UTC) #6
Paul Berry
3 years, 5 months ago (2017-07-13 15:55:35 UTC) #8
Message was sent while issue was closed.
Committed patchset #2 (id:20001) manually as
b87556e00df95257f242c307fcb14abb074af3e9 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698