Commit Graph

7 Commits

Author SHA1 Message Date
Jens Johansen 3a1f732c0f [parser] Make begin/end events always come in pairs
This CL:
* Changes the events so beginX and endX events always comes in pairs
  (though technically not right as some specific events can be beginX
  endY --- but in those cases it is at least documented and used in code
  that actually tests it).
  -> This entails adding some events and converting something from
    "beginX" to "handleX" instead.
* Adds a utility that can generate an AST of sorts directly from the
  parser via a listener using the begin/end matching (and knowing of the
  specific ones that doesn't match directly).
* Adds a test that checks that - at least for all tested (50,000+) files
  - the AST actually generate "correctly", i.e. matches up begin/ends
  and ends up with a single top entry "CompilationUnit".
* Adds a different visualization to the parser listener events by
  displaying the "AST directly from the parser" in a UI that can be
  navigated. The visualization may not be the best, but it's certainly
  a stepping stone.

Change-Id: I9b27f7bbf3be442adc92f357c7b3c46da6f84cf7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159664
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-01 09:30:43 +00:00
Jens Johansen 1b534d04a8 [CFE] Change parser test output slightly
Special handling of beginBinaryExpression/endBinaryExpression as they
don't always comes in pairs.

Change-Id: I74323dd45615fbb340acc1c5144b0ba94ea19f5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137783
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-03-02 08:22:03 +00:00
Jens Johansen 3660b9ecc7 [parser] New syntax for null aware index (2nd try)
This reverts commit bc4893a3b3.

The previous attempt failed because when we check if something is a
conditional expression we used a rewriter that didn't actually rewrite.
This further down the line (still checking if we can parse the expression)
results in errors occurring (that wouldn't have occurred if the rewrite
had happened) and the conclusion was thus that it wasn't a conditional
expression and we parsed it as a null-aware index operator (which gave
errors because it wasn't).

This 2nd try solves it by having a rewriter that actually rewrites,
but then allows to undo the rewrites after we're done parsing.

Change-Id: Ide3c0d6a870d4dc18b6d9475b0227d93c733dc7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136624
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-02-26 13:31:52 +00:00
Jens Johansen bc4893a3b3 Revert "[parser] New syntax for null aware index"
This reverts commit cf4e044e07.

Reason for revert: Breaks internal customer.

Original change's description:
> [parser] New syntax for null aware index
> 
> Change-Id: Iea6b29eb897eb01863a92b223e270d225c3ca1ba
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135903
> Commit-Queue: Jens Johansen <jensj@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

TBR=brianwilkerson@google.com,jensj@google.com,johnniwinther@google.com

Change-Id: Ic0ff607c944e489f29bda7da37afd63c62d368eb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136600
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-02-20 14:11:08 +00:00
Jens Johansen cf4e044e07 [parser] New syntax for null aware index
Change-Id: Iea6b29eb897eb01863a92b223e270d225c3ca1ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135903
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-02-20 12:33:28 +00:00
Jens Johansen c3c31b74fd [parser] Fix bug wrt when the handleNonNullAssertExpression is added
This fix is basically a revert of the first fix for for the same issue,
https://github.com/dart-lang/sdk/commit/627e4c8cad17f069a9dc281e6726cc2080f1af45

Fix #37708

Bug: 37708
Change-Id: Ic470b2663e7171fcac6a8de3d9e1276b7815a64b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118574
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-09-27 11:53:15 +00:00
Jens Johansen acfda5d837 [CFE] Parser test framework
Change-Id: I1f27b380a2e6f8ea34d8ce66de6d581a1da8bf96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118572
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-09-26 08:40:08 +00:00