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

Issue 2742233002: Fix for parsing EmptyFunctionBody with Fasta. (Closed)

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

Description

Patch Set 1 #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+32 lines, -3 lines) Patch
M pkg/analyzer/test/generated/parser_test.dart View 2 chunks +5 lines, -1 line 0 comments Download
M pkg/compiler/lib/src/parser/node_listener.dart View 1 chunk +4 lines, -0 lines 0 comments Download
M pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart View 2 chunks +12 lines, -1 line 0 comments Download
M pkg/front_end/lib/src/fasta/kernel/body_builder.dart View 1 chunk +6 lines, -0 lines 0 comments Download
M pkg/front_end/lib/src/fasta/parser/listener.dart View 1 chunk +4 lines, -0 lines 3 comments Download
M pkg/front_end/lib/src/fasta/parser/parser.dart View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 6 (1 generated)
scheglov
3 years, 9 months ago (2017-03-12 18:06:14 UTC) #1
ahe
lgtm https://codereview.chromium.org/2742233002/diff/1/pkg/front_end/lib/src/fasta/parser/listener.dart File pkg/front_end/lib/src/fasta/parser/listener.dart (right): https://codereview.chromium.org/2742233002/diff/1/pkg/front_end/lib/src/fasta/parser/listener.dart#newcode562 pkg/front_end/lib/src/fasta/parser/listener.dart:562: void endEmptyFunctionBody(Token semicolon) { Overall, I think it ...
3 years, 9 months ago (2017-03-13 09:20:19 UTC) #2
scheglov
https://codereview.chromium.org/2742233002/diff/1/pkg/front_end/lib/src/fasta/parser/listener.dart File pkg/front_end/lib/src/fasta/parser/listener.dart (right): https://codereview.chromium.org/2742233002/diff/1/pkg/front_end/lib/src/fasta/parser/listener.dart#newcode562 pkg/front_end/lib/src/fasta/parser/listener.dart:562: void endEmptyFunctionBody(Token semicolon) { On 2017/03/13 09:20:19, ahe wrote: ...
3 years, 9 months ago (2017-03-13 15:48:40 UTC) #3
scheglov
Committed patchset #1 (id:1) manually as e12dc7c2f86229020cb628edfbec4f40133e5fd7 (presubmit successful).
3 years, 9 months ago (2017-03-13 16:05:50 UTC) #5
Paul Berry
3 years, 9 months ago (2017-03-13 16:55:16 UTC) #6
Message was sent while issue was closed.
lgtm

https://codereview.chromium.org/2742233002/diff/1/pkg/front_end/lib/src/fasta...
File pkg/front_end/lib/src/fasta/parser/listener.dart (right):

https://codereview.chromium.org/2742233002/diff/1/pkg/front_end/lib/src/fasta...
pkg/front_end/lib/src/fasta/parser/listener.dart:562: void
endEmptyFunctionBody(Token semicolon) {
On 2017/03/13 15:48:40, scheglov wrote:
> On 2017/03/13 09:20:19, ahe wrote:
> > Overall, I think it might be simpler to add a boolean to endFunctionBody.
> 
>   It depends.
>   This way we get at least some documentation about tokens in form of
parameter
> names.
> 
> > 
> > However, if you prefer this approach, you should add a comment to both
> > beginFunctionBody and endFunctionBody that this method might be called
instead
> > of endFunctionBody. See lines 22-24.
> 
>   It does not look that endFunctionBody() or most of the other methods have
> documentation. So, any reader should expect to use search to learn anything.
> 
>   Actually, beginFunctionBody() is not what it says at all.
>   It is not consistent with the language specification.
>   It is more like beginBlockFunctionBody().
>   So search and thoughtful reading is a must.
> 

I agree that the current state of the documentation in the Fasta code base isn't
great--often the developer has to read the code carefully to understand what's
going on.  But it sounds like you're making the argument that since the
developer has to read the code carefully, there's no point in writing
documentation.  I think that's a dangerous line of thinking--applied
universally, it would mean that we never got around to adding documentation to
code that lacked it.

I think that whenever one of us learns something by reading code, or a subtlety
is discussed in a code review that would have been nice to have been in a
comment, we should add comments.  If we keep doing this consistently, the code
base will eventually have good enough documentation that developers can
consistently rely on it.

Powered by Google App Engine
This is Rietveld 408576698