Commit Graph

6018 Commits

Author SHA1 Message Date
Johnni Winther bb02531b7e [cfe] Move creation of error nodes to inferrer
During top-level inference we cannot emit errors. With this change
the inferrer controls whether to create and report an error or to create
a revisitable node.

Change-Id: Ia7821c6d2628fdae0897f3cd6108ef12d2f096df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122782
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-10-28 14:08:42 +00:00
Jens Johansen a14bf89eb9 [CFE] Move old dill files to CIPD
Remove from git, add to CIPD, DEPS and gclient sync.

Change-Id: Ib215f51a53108c56c2b129de3fdb156814a31a88
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123245
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-10-28 14:07:18 +00:00
Jens Johansen 0f7343e1a9 [parser] Reproduce analyser crash _OperatorName in endClassConstructor
This will crash the analyser:

class operator {
  operator^(int x) {}
}

The output from the parser looks reasonable to me though.

Change-Id: I956daf43670decca979d9dad6614e139007cda26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121321
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-28 14:00:37 +00:00
Paul Berry 29a040ac55 Flow analysis: Add a clarifying comment to tryCatch assigned_variables test
Change-Id: I58211cd8acc95aea9459513ad1bf4951a8b3bcff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123260
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-28 13:59:07 +00:00
Paul Berry e1fce75301 Flow analysis: clean up unit tests using custom matchers.
Previously, we made heavy use of operator== in the flow analysis
tests.  But we also tried to verify that the flow analysis engine
didn't compare types with operator==.  This was kludgy, because it
meant that we had to use a global variable to keep track of whether a
use of _Type.operator== should succeed.  It was also kludgy because it
required an implementation of operator== in flow analysis code that
was solely meant for testing.

By using custom matchers, we can get the same level of testing
flexibility without making use of operator== anywhere.

Also, fixed a few flaws in the tests for "join".  They were
accidentally setting up variables in the already-written state, so the
"assigned" subtest was passing in spite of incorrect expectations.

Change-Id: If326678aeb20a62433ad090968e150738ba5dc59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123140
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-28 13:59:07 +00:00
Jens Johansen d7c75edd57 [CFE] Use 'SyntheticBeginToken' for BeginToken that origins from a synthetic node
This is a follow-up to
https://dart-review.googlesource.com/c/sdk/+/122863.

Change-Id: I17e79687fe9950ae8ff0f1f8a4a6270926106813
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123241
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-28 11:01:10 +00:00
Jens Johansen 5b7c981086 [CFE] Parser test framework also outputs token stream
This makes it much easier to see what the parser is actually working
with in the face of token stream rewrites.

Change-Id: Ic336f18fab7c8fd7a42020b32af4a480bbde25bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122865
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-28 10:25:30 +00:00
Jens Johansen e9bc071821 [CFE/parser] Fix erroneous assert when parsing blocks
In for instance Parser.parseBlock a loop says while not "}" or EOF.
After the loop we assert it is in fact "}"...

Fixes #39060

Change-Id: I764dc6ab2df180cb55a813ddd42b968391a96f04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122864
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-10-28 07:20:25 +00:00
Paul Berry 9f25d0e1d8 Flow analysis: don't necessarily clear promotions on assignment.
If the RHS of an assignment is a subtype of the current promoted type
(or one of the previously promoted types), any relevant promotions are
kept.

So for example:

  if (x is int) {
    x = x + 1; // Still an int!
    print(x.isEVen); // ok
  }

This required two significant changes:

- Clients must now tell the flow analysis engine the type of the RHS
  of the assignment.  This required some refactoring in the analyzer,
  because this information wasn't always easily available at the point
  where we were calling flow analysis.

- The flow analysis engine now has to keep track of a "chain" of the
  currently active promotions, so that it can potentially un-do some
  promotions but not others.  This meant that the algorithms for
  "join" and "restrict" had to be reworked.

In a future CL I'll add the ability for assignments to promote to
types that have been previously checked against ("types of interest"),
e.g.:

  if (x is! int) {
    x = 0; // x is now an int!
  }
  // x is now known to be an int because it's promoted in both branches

Change-Id: I63d6c9a2021b045d391b2d9c674e9a2e5f770e62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123003
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-26 20:38:28 +00:00
Paul Berry 93afae8d0c Flow analysis: fix AssignedVariablesVisitor treatment of for-each loops.
Change-Id: Icd05b63d1a92f2065de1c04583be9bb47c14bbd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122982
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-26 18:50:18 +00:00
Dmitry Stefantsov 9910fa8454 [cfe] Implement the first part of NNBD-aware isSubtypeOf
This CL is a squashing of the following smaller CLs:

* https://dart-review.googlesource.com/c/sdk/+/120669/
* https://dart-review.googlesource.com/c/sdk/+/120670/
* https://dart-review.googlesource.com/c/sdk/+/121331/
* https://dart-review.googlesource.com/c/sdk/+/121381/
* https://dart-review.googlesource.com/c/sdk/+/121383/
* https://dart-review.googlesource.com/c/sdk/+/121620/
* https://dart-review.googlesource.com/c/sdk/+/121707/
* https://dart-review.googlesource.com/c/sdk/+/122144/
* https://dart-review.googlesource.com/c/sdk/+/122360/
* https://dart-review.googlesource.com/c/sdk/+/122381/
* https://dart-review.googlesource.com/c/sdk/+/122783/
* https://dart-review.googlesource.com/c/sdk/+/122787/

Change-Id: I9d850f531f0fce07055ff9b5cd39abb605752005
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122868
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2019-10-25 16:37:39 +00:00
Paul Berry 0167f91012 Flow analysis: introduce ID tests for AssignedVariables.
This should make it easier to verify that the CFE implementation is
correct.

Note that this effort encountered a few bugs in the analyzer
implementation, which are marked with TODOs.  I will fix them in
follow-up CLs.

Change-Id: Ic164a1cf214b5730f848b17db2838c29d25b00d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122850
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-25 13:44:05 +00:00
Paul Berry 5ba6fb73ec Only use "stmt:" prefix when necessary to avoid ambiguity.
This makes the analyzer test behavior consistent with the CFE.

Change-Id: I5b7739632e08552aa3092a2b7ea6831ecad51ca1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122981
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-25 13:44:05 +00:00
Jens Johansen 165196dbc0 [parser] Fix infinite loop and setting offsets after EOF
Fixed: 38415
Change-Id: Iefc4fdd289d551fa77c341efbab2f59d48bb2b9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122863
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-10-25 10:57:54 +00:00
Johnni Winther d576ce69e1 [cfe] Implement initial integration of reachability
This CL is based on:

https://dart-review.googlesource.com/c/sdk/+/122397
https://dart-review.googlesource.com/c/sdk/+/122500
https://dart-review.googlesource.com/c/sdk/+/122399

Change-Id: Id5474e5338f3d04e6710015b9d1cc1baec93e7ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122861
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-10-25 09:53:34 +00:00
Jens Johansen 2d0cdbdd12 [CFE/Incremental compiler] Don't crash on parts with invalid scheme
Before this CL a part like "part ' package:foo/bar.dart';" would crash
the incremental compiler because the part specifies a scheme that is
invalid.

Change-Id: I567df0a68ff8709e4ca95d24e6dabc4d959c95fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122862
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-25 09:27:24 +00:00
Karl Klose 81a2925ac2 [infra] Front-end unit tests: Check for timeout of each suite separately
This CL also improves the printed messages to include full suite name
and timings.

Change-Id: I7e2129fb27a91e6ab56269f0ef4ed2c80bf4e786
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122788
Commit-Queue: Karl Klose <karlklose@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2019-10-25 07:23:14 +00:00
Jens Johansen 87fa4e49d7 [CFE] Fix of an UTF8 BOM in input file possibly causing a crash
Fixes: #39091
Change-Id: I963d22a49efebbed16b9645d2249c0887c35d780
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122789
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-10-25 07:07:54 +00:00
Johnni Winther 1bc9fba660 [cfe] Allow this access in late field initializers
Change-Id: Ia2139e3e87a4b141b5e0df41541bab5f74acd5dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122760
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2019-10-24 18:11:17 +00:00
Paul Berry 696a374b6f Flow analysis: properly handle the fact that ++ and -- are assignments.
Change-Id: Ie54fbf7c7c750457b2750de90c64e8ea32db15d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122730
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-24 17:57:27 +00:00
Paul Berry 8f5a45c22d Flow analysis: add support for ??=.
Change-Id: I8c99c42cf3a2560d7af3daf27ee316e22a2eb027
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122588
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-24 17:57:27 +00:00
Paul Berry b7911e4490 Flow analysis: add support for asserts.
Fixes #38761.

Change-Id: I6cc4adc0383cc56d99fa73ef75f728db0c56063b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122732
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-24 17:01:33 +00:00
Johnni Winther 4d1bc04d69 [cfe] Flatten TypeInferrer(Engine) hierarchies
Makes TypeInferrerImpl and TypeInferenceEngineImpl fully implement
the interfaces.

Change-Id: Ic058e7c3cb4d6adae98d499df74824e96a395c8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122780
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-10-24 13:07:53 +00:00
Paul Berry 1bd6e20d76 Flow analysis: simplify the use of AssignedVariables.
Previously, the client was responsible for querying AssignedVariables
to find the variables assigned and captured during constructs like
loops, and passing that information into FlowAnalysis methods.  With
this CL, the client simply passes AssignedVariables into the
FlowAnalysis constructor, and the lookup happens automatically.

Change-Id: Ifbbf8ba8ea0d0f8a31d41244892c8c816eea56dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122731
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-24 13:00:50 +00:00
Jens Johansen 752abb5f38 [CFE] Temporarily don't require a dill to exist for the current kernel version
Change-Id: Ie69127a708193b5d07cf08ce717845204d1647ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122785
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-10-24 12:13:33 +00:00
Johnni Winther 33cb6c0a15 [cfe] Skip newly added type promotion tests
Change-Id: Ifc1eba46fd7a71be0b333a6d21f34e03c46b6c73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122781
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-10-24 11:15:39 +00:00
Johnni Winther 18d43babd1 [cfe] Avoid crash for missing object access targets in toplevel inference
We cannot emit errors during toplevel inference.

Change-Id: I2add33892ddf20c27ff53038a3be2b02c34029e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122761
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-10-24 10:51:49 +00:00
Johnni Winther 63d524dec0 [cfe] Add skeleton for testing nullability, definite assignment and type promotion
Change-Id: I8eab67deb401496af5a5aee3a44831a8ade55a1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122641
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-10-24 09:23:06 +00:00
Paul Berry 23dda7c6bc Fix an analyzer corner case with compound assignments.
When analyzing an expression like `x += y`, where `x` may be type
promoted, we need to consider x's unpromoted type when determining
whether the result of the addition may be assigned to `x`.  Before
flow analysis, we didn't need to worry about this subtlety because the
appearance of `x` on the LHS of an assignment used to disqualify it
from type promotion within any scopes containing the assignment.

Change-Id: I17887c457c9d0ce17ce704884e04d93ca8a3e925
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122587
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-23 22:37:57 +00:00
Paul Berry 92c69f224b Flow analysis: promote on successful execution of an "as" expression.
Change-Id: I506281ab2dfe23b4b75daf795028fec979006932
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122586
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-23 17:02:37 +00:00
Paul Berry 5837c65b6e Flow analysis: test unreachability for constructor initializers.
This was already working, it just needed some updates to the test
infrastructure so we could test it properly.

Change-Id: Ie838fb50cf90aabd19c6e0c637df546ddcda16d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122584
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-23 15:50:10 +00:00
Paul Berry 8e23f76ac7 Flow analysis: properly handle promotion of type parameters.
When promoting a type parameter, we need to create an intersection
type (e.g. "T & int").  Such a type is represented in the analyzer and
the front end as a type parameter type pointing to the same type
variable, but with a different bound.

Change-Id: I1655f9242d913ca958c279cc80c3f6329f6b396d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122581
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-23 15:50:10 +00:00
Paul Berry 06a8577de2 Flow analysis: recursively annotate unreachable nodes in test
Previously, in the flow analysis reachability tests, we only annotated
a node as unreachable if it wasn't "covered" by a parent node that was
already marked as unreachable.  This made the tests more compact, but
it meant that the testing was less complete, because it meant that we
weren't verifying that the nodes inside of unreachable nodes were also
unreachable.

This CL changes the tests so that we mark every unreachable node as
unreachable, with one small exception: for an expression statement, we
don't mark the expression; we just mark the statement as unreachable,
and we have an assertion in the data extractor to verify that the
expression's reachability matches that of the statement.

Change-Id: I92454c72e9704b34e2dbafb9f5f19a8ee31f8f15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122583
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-23 15:50:10 +00:00
Johnni Winther 2727fd9b3c [cfe] Add helper for creating property set
The use of the helper removed the creation some unneeded temporary
variables in extension access which is reflected in the expectation
changes.

Change-Id: Ice6afcb223b7740c2555a076c3ddae9a9d4f092d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122394
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-10-23 12:23:53 +00:00
Johnni Winther e5a587fca4 [cfe] Add helper for creating property get during inference
Change-Id: Ic4b8f78cc0ced98f17d2dc27c2d4a6d6e273af91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122389
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-10-23 12:23:53 +00:00
Johnni Winther 857502b1d2 [cfe] Add helpers for creating index set/get operations
Change-Id: I0125d31ed5fb43baeb76b3346a4251703c5f8b4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122383
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-10-23 12:23:53 +00:00
Paul Berry 0887806796 Flow analysis: introduce TypeOperations.tryPromoteToType method.
Previously, any attempt to promote type A to type B produced type B if
B was a subtype of A, and failed otherwise.  But in order to support
promotion of type parameters, we need the ability to produce a fresh
"intersection type" (e.g. `T & int`).  The new
`TypeOperations.tryPromoteToType method` makes this possible by giving
the client the opportunity to synthesize the new type when necessary.

Change-Id: If671d5d865f38469a878329180c3a1c94e25a42c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122582
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-23 11:12:21 +00:00
Jens Johansen 18fa7485ad [kernel] Read ContinueSwitchStatements in nested FunctionNodes correctly
Closes #39040

Change-Id: I8ae9a89cfd750dddbf0a994e93d9b2aa2d46490c
Fixed: 39040
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122386
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-23 08:34:27 +00:00
Paul Berry 2e6afae4c3 Ignore EMACS backup files when running ID tests
Change-Id: I80891b2194522cd9c5746fff8c749a0edf2df4d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122580
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-23 07:04:16 +00:00
Paul Berry dfddeada02 Flow analysis: treat expressions of type Never as unreachable.
Change-Id: I4e6c629e4f9f8ebba3c7b2168b421a723c69928b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122417
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-23 05:52:26 +00:00
Paul Berry 4ab09db0f4 Analyzer flow analysis for null-aware operators.
The front end implementation is in a previous CL
(https://dart-review.googlesource.com/c/sdk/+/122415).  This CL
contains the analyzer implementation and the integration tests.

Note that the analyzer implementation of null shorting is incomplete,
so some corner cases couldn't be tested.  I'll be fixing this in
follow-up CLs.

Change-Id: I0935ee4c67b24f8bf7c70cbb7ec56dd826fbf73a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122416
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-22 19:18:16 +00:00
Paul Berry 689c934406 Flow analysis: add support for null-aware accesses.
Change-Id: I4367a1dd23d981b885a48d7fbe129d2288787a9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122415
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-22 19:18:16 +00:00
Kallen Tu 4601bd7bff Modified supertype check error message to be more descriptive.
Change-Id: I3068bf195eb9a746d25ac62007eaeac0296d3087
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121463
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2019-10-22 16:59:16 +00:00
Jens Johansen 0449905e2d [CFE] Add a serialization-and-unserialization step to strong test
Change-Id: Icb6275e9eaec0bbdd890719d780a0218fa660fec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122384
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-22 13:40:01 +00:00
Johnni Winther b26127fe01 [cfe] Add reachability test skeleton
Change-Id: Iac74d450816f1781512d44d533464e7c9857fed8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122388
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-10-22 12:26:31 +00:00
Paul Berry aeede3c1b0 Flow analysis: pass catch variables to tryCatchStatement_catchBegin.
Previously, it was the caller's responsibility to call initialize()
for any variables declared in a catch block.  Now this is done
automatically.

Change-Id: If9c586e12f7d114517476e56e984d16a570648e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122413
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-22 10:56:54 +00:00
Paul Berry 1e7bfd6449 Sort declarations in flow_analysis_test.dart
Change-Id: Ie82537ffe4daa41ca9a15436d8f0788b1c1cfe8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122412
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-22 10:56:54 +00:00
Paul Berry 9579c4bc3c Flow analysis: simplify use of isExpression_end.
Previously, it was the caller's responsibility to determine if the
subexpression of an "is" expression was a read of a promotable
variable.  Now, the caller calls isExpression_end regardless of what
the subexpression is, and flow analysis determines whether promotion
should happen or not.

Change-Id: Ibba689935580d4e9c5ab79e5afb534c173386232
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122411
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-22 10:56:54 +00:00
Johnni Winther a58d337bd3 [cfe] Add helper for creating binary expressions.
Change-Id: Ieeafa15bbecaaa53c4624219fa0256c03d2c3207
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122380
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-10-22 10:04:54 +00:00
Johnni Winther e76f6d49e4 [cfe] Implement null-shorting for most expressions
Binary operations and parenthesized expression are shorted which they
shouldn't be. Also, so complex expressions, like compound assignment,
are not handled because they need to be encoded in a more high-level
internal expression to support choosing the receiver based on shorting.

Change-Id: I0bdeabdc21da7d80f533ea0880662bfb11341c6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121856
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-10-22 10:04:54 +00:00