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

Issue 2999523002: Share code for parsing local functions. (Closed)

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

Description

Patch Set 1 #

Patch Set 2 : Update _BodySkippingParser. #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+42 lines, -44 lines) Patch
M pkg/front_end/lib/src/fasta/parser/parser.dart View 9 chunks +41 lines, -43 lines 0 comments Download
M pkg/front_end/lib/src/incremental/unlinked_unit.dart View 1 1 chunk +1 line, -1 line 5 comments Download

Messages

Total messages: 13 (3 generated)
ahe
Address Dan's comments from CL 2985673002 and more.
3 years, 4 months ago (2017-08-07 11:45:54 UTC) #2
Johnni Winther
lgtm
3 years, 4 months ago (2017-08-07 11:57:12 UTC) #3
danrubel
LGTM
3 years, 4 months ago (2017-08-07 12:43:35 UTC) #4
ahe
Konstantin, I'd uploaded this CL based on a two week old branch, so when I ...
3 years, 4 months ago (2017-08-07 13:46:25 UTC) #6
ahe
Committed patchset #2 (id:20001) manually as dbe482caac4185532649b0169904e74562c0039e (presubmit successful).
3 years, 4 months ago (2017-08-07 14:06:12 UTC) #8
scheglov
https://codereview.chromium.org/2999523002/diff/20001/pkg/front_end/lib/src/incremental/unlinked_unit.dart File pkg/front_end/lib/src/incremental/unlinked_unit.dart (right): https://codereview.chromium.org/2999523002/diff/20001/pkg/front_end/lib/src/incremental/unlinked_unit.dart#newcode117 pkg/front_end/lib/src/incremental/unlinked_unit.dart:117: return isExpression ? close.next : close; I don't understand ...
3 years, 4 months ago (2017-08-08 01:42:27 UTC) #9
ahe
https://codereview.chromium.org/2999523002/diff/20001/pkg/front_end/lib/src/incremental/unlinked_unit.dart File pkg/front_end/lib/src/incremental/unlinked_unit.dart (right): https://codereview.chromium.org/2999523002/diff/20001/pkg/front_end/lib/src/incremental/unlinked_unit.dart#newcode117 pkg/front_end/lib/src/incremental/unlinked_unit.dart:117: return isExpression ? close.next : close; On 2017/08/08 01:42:27, ...
3 years, 4 months ago (2017-08-08 08:13:30 UTC) #10
scheglov
https://codereview.chromium.org/2999523002/diff/20001/pkg/front_end/lib/src/incremental/unlinked_unit.dart File pkg/front_end/lib/src/incremental/unlinked_unit.dart (right): https://codereview.chromium.org/2999523002/diff/20001/pkg/front_end/lib/src/incremental/unlinked_unit.dart#newcode117 pkg/front_end/lib/src/incremental/unlinked_unit.dart:117: return isExpression ? close.next : close; On 2017/08/08 08:13:30, ...
3 years, 4 months ago (2017-08-08 15:54:57 UTC) #11
ahe
https://codereview.chromium.org/2999523002/diff/20001/pkg/front_end/lib/src/incremental/unlinked_unit.dart File pkg/front_end/lib/src/incremental/unlinked_unit.dart (right): https://codereview.chromium.org/2999523002/diff/20001/pkg/front_end/lib/src/incremental/unlinked_unit.dart#newcode117 pkg/front_end/lib/src/incremental/unlinked_unit.dart:117: return isExpression ? close.next : close; On 2017/08/08 15:54:57, ...
3 years, 4 months ago (2017-08-08 16:03:33 UTC) #12
scheglov
3 years, 4 months ago (2017-08-08 16:06:03 UTC) #13
Message was sent while issue was closed.
https://codereview.chromium.org/2999523002/diff/20001/pkg/front_end/lib/src/i...
File pkg/front_end/lib/src/incremental/unlinked_unit.dart (right):

https://codereview.chromium.org/2999523002/diff/20001/pkg/front_end/lib/src/i...
pkg/front_end/lib/src/incremental/unlinked_unit.dart:117: return isExpression ?
close.next : close;
On 2017/08/08 16:03:33, ahe wrote:
> On 2017/08/08 15:54:57, scheglov wrote:
> > On 2017/08/08 08:13:30, ahe wrote:
> > > On 2017/08/08 01:42:27, scheglov wrote:
> > > > I don't understand this change.
> > > > How could it be an expression if it starts with '{'?
> > > 
> > > [isExpression] is true if the function is in expression context, for
> example:
> > > 
> > > print(() { return "I'm a function in expression context."; }());
> > > 
> > > foo() {
> > >   print("I'm a function in statement context, or a declaration.");
> > > }
> > > 
> > > There's a subtle difference in expression context when using the arrow
> > notation:
> > > 
> > > print(() => "I don't have a trailing semicolon.");
> > > 
> > > bar() => "But I do.";
> > > 
> > > The way I deal with that difference is by having this invariant: when
> parsing
> > a
> > > function expression, this method returns the next token which isn't part
of
> > the
> > > expression. Otherwise, this is a function declaration, and we always
return
> > the
> > > end token (which is a "}" for a function with a block body, and semicolon
> for
> > > arrow notation).
> > 
> > Now I understand.
> > Thank you.
> 
> Great. Would it have been less confusing initially if I had called this
boolean
> "isFunctionExpression"?

Even better would be "ofFunctionExpression", because the body we're parsing
*isn't* function expression, but a part of it.

Powered by Google App Engine
This is Rietveld 408576698