Commit Graph

4770 Commits

Author SHA1 Message Date
Dan Rubel a984c5ce57 improve invalid string literal recovery to fix crash
Fix https://github.com/dart-lang/sdk/issues/37877

Change-Id: If9fe3d42659608bf7cd050de515ec41ca45a697b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-08-19 17:46:47 +00:00
Dan Rubel bdd77cd0b2 Ensure function type param has non-null identifier
Fix https://github.com/dart-lang/sdk/issues/37733

Change-Id: I552d67aa048eeb5ae4417205f641d71ca7ecadd0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113700
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-08-19 17:46:47 +00:00
Paul Berry 0ff0cc1229 Flow analysis: remove unnecessary argument to doStatement_end.
And add unit testing of do statements.

Change-Id: I976780a400cbd852f71d915f1c67b5433ba8807c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113267
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-08-19 15:49:43 +00:00
Johnni Winther ee37965e49 [cfe] Handle static access of static extension members
Change-Id: I9c52ddc7b0c7ef0952471542ee41c231989d80d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113441
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-08-19 14:47:33 +00:00
Jens Johansen 0e201edeeb [CFE] Second batch of fixes for requiring explicit types
Change-Id: If4f35550e1df10763b4c13d15eba1d9f53e6095e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113324
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-08-19 07:19:45 +00:00
Johnni Winther 9c649e67df [cfe] Handle most accesses to extension members from within the extension
Change-Id: I1be167bff0f398793c67834bb80328418e9bb4c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113020
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-08-18 12:25:34 +00:00
Mike Fairhurst 0477f8df9e Fix keyword infinite loop
Change-Id: I92bee9991400c229bbf665414a096efae72c14c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113126
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-08-16 20:08:30 +00:00
Johnni Winther eae781c73e [cfe] Add Field.isLate, VariableDeclaration.isLate and VariableDeclaration.isRequired
Add support for the `late` modifier on fields and local variables in
CFE, and `required` on named parameters When using the option
--enable-experiment=non-nullable the `isLate` and `isRequired` flags will be set
accordingly on Field and VariableDeclaration nodes.

Closes #37686
Closes #37684

Change-Id: If37fc93defdabc5cc974f3f068f57752a665f4cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113036
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-08-16 19:39:05 +00:00
Paul Berry 8ab978b6d4 Flow analysis: remove unnecessary parameters from conditional_* methods.
Also rework the flow analysis tests a bit to allow tests to be written
in a more compact way.

Change-Id: I6642ce9987bb89b9b858e709575ce12510c8f442
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-08-16 18:44:00 +00:00
Johnni Winther 2fda7f8002 [cfe] Handle qualified name as an AmbiguousBuilder.
+ strengthen checkState invariants in the path of the error.

Handles problem brought out by #37776

Change-Id: I55165a1bdaa3a8a0910d71c6d56472bdbfe592c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113183
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-08-16 16:12:58 +00:00
Aske Simon Christensen 528292bd30 Expire constant-update-2018 flag.
All uses of no-constant-update-2018 in the Dart SDK, Flutter and
Fuchsia have been cleaned out, which means we can expire the flag.

Closes https://github.com/dart-lang/sdk/issues/37874

Change-Id: Ie31dfbf87db52d37fdf4218afa8c6f7a894bafff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113182
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-08-16 13:48:27 +00:00
Aske Simon Christensen e611357309 [CFE] Error on bitwise or shift operation on a double constant.
Fixes https://github.com/dart-lang/sdk/issues/36823

Change-Id: I9aeb34b9f80261889434f85bf39af3d78a38202e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112391
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-08-16 11:11:27 +00:00
Paul Berry 23387d636b Flow analysis: merge APIs for handling && and ||.
This will make it easier to integrate flow analysis into the migration
tool, since the migration tool has a shared code path for handling
`&&` and `||`.

Change-Id: Ibf1c7362dfeaab505a2ecf7298b2569a40fca781
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113038
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-08-15 13:34:30 +00:00
Johnni Winther 06ab457ff3 [cfe] Merge Fangorn into Forest
+ rename creation methods of AST node X to createX to simplify usage.

Change-Id: I323c0dba9417f93cd43f409c3f55d17108f53013
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112395
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-08-15 13:14:50 +00:00
Jens Johansen 9552646dc4 [CFE] First batch of fixes for requiring explicit types
Change-Id: Ic27f8508bc95409a5ee8f90b72f34a73d0f8e2e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113034
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-15 13:13:20 +00:00
Johnni Winther 9d4e778cde [cfe] Support getters, setters, fields and operators in extensions
Change-Id: Ic84380ea767691bbbb802c65cb72fe43893f78a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112257
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-08-15 12:12:00 +00:00
Jens Johansen 93d4d28f6c [CFE] Add lint test: Require explicit types
This CL adds a test (lint_test.dart) that gives errors if using e.g.
"var foo = 42;".
We opted to not use the lint "always_specify_types" as that does
more than what the team voted for.

Change-Id: Ia37066ee04ff676d15f41222751557a9245f953f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113032
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-15 10:21:00 +00:00
Jens Johansen cae08c6813 [CFE] Apply lines_longer_than_80_chars lint
Change-Id: I35b62b34d3ccc7098c21a680a80612c0bb927123
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113030
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-08-15 10:01:20 +00:00
Johnni Winther 54f26e3554 [cfe+ddc] Support --target=dartdevc in _fasta/compile.dart
Change-Id: I7288dd3dd03fb58188e3652d9b86e5751c104142
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113037
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-08-15 09:08:40 +00:00
Johnni Winther 024052f367 [cfe+dart2js+analyzer] Remove support for libs in id testing
We now have support for a test as a directory instead.

Change-Id: I3c43e2e57ecda8e3c9d97aa8842be7093c1df5ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113035
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-08-15 07:31:50 +00:00
Jens Johansen 48af666c9f [CFE] apply curly_braces_in_flow_control_structures lint
Change-Id: Id6c7e60b40f7dd0ffd68d007fe86abb785ac0dba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113025
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-08-14 13:00:44 +00:00
Dmitry Stefantsov 85e26c2ce9 [cfe] Update greatest lower bound ruels for FutureOr
Closes #37439.

Bug: http://dartbug.com/37439
Change-Id: Id4043373e614d8cd4bef6c6d1fc7b7704b3f6ce8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112722
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-14 10:16:54 +00:00
Jens Johansen b9217efc77 [CFE] [Language versioning] Issue error on multiple 'dart=' entries
Issue error when the .packages file specifies more than on 'dart=' entry.
Also add another test of the library and part mismatch being an error.

Change-Id: I0a894e6ef86eb9f976b9fbdce67f0c9adb03be9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112881
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-13 10:07:39 +00:00
Jens Johansen e47f354919 Allow ddc in kernel mode to output used inputs
This change basically consists of these steps:
* Enable the incremental compiler to trace used inputs.
* Translate used libraries into used dill inputs.
* Output the list of used dills.

Bug: #37788
Change-Id: Icbc3942226f50ba733196586fac8715e21d6ed34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112385
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2019-08-13 08:37:29 +00:00
Jens Johansen aeb864a43f Allow bazels kernel_worker to output used inputs
This change basically consists of these steps:
* Enable the incremental compiler to trace used inputs.
* Translate used libraries into used dill inputs.
* Output the list of used dills.

Bug: #37788
Change-Id: I08cffe299166cf10e990c9e261f190afd25da8b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112384
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2019-08-13 08:28:09 +00:00
Jens Johansen 38336d6b5a [CFE] Split spell dictionary into several different dictionaries
Change-Id: Ie7e274b66d554eb9db8fffdf0e945d78be231ea8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112392
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-13 07:18:29 +00:00
Johnni Winther 271ad96813 [cfe] Create Extension nodes for extensions
Adds Extension node to kernel/ast, currently with serialization. This
is needed to support resolution of extension methods through dill
boundaries.

Adds (Source)ExtensionBuilder for build Extension nodes and
DeclarationBuilder as common superclass of ClassBuilder and
ExtensionBuilder.

Change-Id: Id945a40452f2729f9a4f390477dd6c76f9030eaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112256
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-08-09 20:46:01 +00:00
Johnni Winther 19654f30d0 [cfe+vm+ddc] Return ClassHierarchy and CoreTypes together with Component
Users of the CFE often need the ClassHierarchy and may CoreTypes after
invoking the CFE. This CL extends the result of `kernelForProgram` and
`kernelForComponent` to a `CompilerResult` that includes these objects.

Change-Id: I08491198fe876b6514e49993ad794388d6662c9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112259
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-08-09 13:02:12 +00:00
Vyacheslav Egorov 573789f7f1 [cfe] Insert default super initializer when outlining const constructor
This ensures that it is invoked when performing constant evaluation
in modular setting.

Fixes https://github.com/dart-lang/sdk/issues/37794

Bug: 37794
Change-Id: I26c891044e030ac7702f02b2d4996984f9e898c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112383
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-09 11:26:59 +00:00
Johnni Winther 3312fe3d26 [cfe] Fully support expired flags in CFE
This ensures that we can prohibit the disabling of an enabled and
expired flag while still support the use of enum value in
implementation code.

Change-Id: Ib92c506365bb61853d6ff791461c5065acabcd4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99173
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2019-08-09 09:23:01 +00:00
Jens Johansen 5601eabda6 [CFE] Spell check messages and dart code
This CL adds a simple spell-checker, adds a spell-checking-phase to
messages_test to spell-check our messages, adds a new test that
spell-check our dart-code and fixes a lot of spelling mistakes / typos.

Change-Id: I8943a5bd67970e9a8a775251ae0aa97799eab097
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112346
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-09 08:47:00 +00:00
Johnni Winther cd3b34f86d [cfe] Don't expect external field to have no initializer
Change-Id: I146eff333466683b4375212397f6b54c8ff72aa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109262
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-08-08 17:33:45 +00:00
Johnni Winther 9a71c998f9 [cfe] Rename Declaration and DeclarationBuilder
Rename Declaration to Builder and DeclarationBuilder to TypeParameterScopeBuilder.
This prepares for the introduciton of a DeclarationBuilder superclass of
ClassBuilder, MixinDeclarationBuilder and ExtensionDeclarationBuilder.

Change-Id: I2d392372f458f39ebaea87ec10f365b822ee3841
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112088
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-08-08 14:01:16 +00:00
Johnni Winther e9a9d9452e [cfe] Build extension methods as toplevel members
+ add an 'isExtensionMethod' property to Procedure.

Change-Id: I8fb1af1802570c827bf3ccbbb9d710eb2a6981ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112081
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-08-08 12:51:40 +00:00
Jens Johansen aac8204ad3 [CFE] Error when library and part(s) doesn't agree on language version
From the feature spec: "Part files must be marked with the same version
as their library. They must always be treated the same way as the
library they belong to, so it is a compile-time error if a part file has
a different language level override than its library. It is also a
compile-time error if a part file has no language version marker,
and the importing library does".

Change-Id: I29805e261e63b89a7d8832770ed2b007fb6df37f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112247
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-08 08:07:53 +00:00
Jens Johansen b9c0f5c09f [CFE] Issue error when .packages specifies wrong language version
From the feature specification: "If an entry contains an invalid dart
version value, #dart=arglebargle or #dart= or any other value which is
not a semantic versioning version, then tools which need the version
should report an error."

Change-Id: Ieb54dbbad6f2fecb341e27b468e3ffdf90717a7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112245
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-08 07:05:00 +00:00
Jens Johansen 21b026dd88 [CFE] Issue error when langauge version is specified too high
Specifying a language version higher than the highest supported version
(aka the default version) is an error.

Specifying a language verison in code that is higher than the one
specified in .packages is an error.

Change-Id: I44e1c8c45cef715038786dbf248925b73bd6cd7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112240
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-08 06:55:38 +00:00
Paul Berry bff5732c10 Flow analysis: unify API for handling == null and != null.
This reduces code duplication in the client.

Change-Id: I278fb4d3c7fc7b913498d4a69f4f361f6227da32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112146
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-08-07 19:21:24 +00:00
Johnni Winther 08205fd62f [cfe] Add implicit as and type arguments to static_type_test
+ add test for issue 37439 showing

Change-Id: I3b42a5a05df5a89f5bd8255a3f305a2c2caa0176
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112087
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-08-07 15:40:00 +00:00
Paul Berry 7912216cd6 Flow analysis: store all variables in promoted map.
Previously we only stored promoted variables.  Storing all variables
paves the way for expanding the `promoted` map into a map from
variable to VariableModel, which will be necessary to bring the
implementation in line with
https://github.com/dart-lang/language/pull/473.

Change-Id: Ief7190b565da03e3c8dc22f8401f96f3e8a1d356
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112040
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-08-07 14:16:11 +00:00
Paul Berry 7893fdbf2f Flow analysis: Rename State to FlowModel.
This makes the terminology consistent with
https://github.com/dart-lang/language/pull/473.

No change other than renaming the class, sorting the file, and
reformatting some comments.

Change-Id: I81ab759decd0495f18d2afbe9a4c9d734f393b04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112037
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-08-07 14:16:11 +00:00
Paul Berry 4d6adbf15c Flow analysis: Move join into State and document it.
Change-Id: I8cec06c0d19107b4973e192534d63f05a5b3d902
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112036
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-08-07 14:16:11 +00:00
Aske Simon Christensen 5121a2e831 [cfe] Read product mode directly from environment in async transform.
When we perform constant evaluation in the CFE, the async transform
runs after constant evaluation. Thus, it can no longer use const
bool.fromEnvironment("dart.vm.product") to query whether the VM is
in product mode.

Instead, it can read the product mode define directly from the
environment defines given to the CFE and generate different code
depending on the value.

Change-Id: I2aabc4a84b50a940d35d5664ff4ebdf0680ed5c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111645
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-07 08:28:25 +00:00
Jens Johansen 574c4a51c6 [CFE] Initial support for parsing language version from .packages
If the .packages file specifies a fragment on a uri on the form
"dart=x.y", x.y becomes the default lanaguage version for libraries in
that package.

Change-Id: I69cb4157fdf5852184cc3519b033c3624792f783
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112082
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-06 12:42:47 +00:00
Jens Johansen 69ae29076a Default language version if nothing is specified
A kernel library will say it has the newest language version if no
language version is set.
This basically preserves the current semantics of always being on the
newest version (if nothing is explicitly done), e.g. if creating a kernel
library by hand and not setting it.
The front_end also utilize this and just doesn't set it, if it isn't set.

Change-Id: I033fef13626ee034030ba8fc9d141b182ba1a5ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111739
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-06 09:13:29 +00:00
danrubel 627e4c8cad Parse additional NNBD not-null assertions
Fix https://github.com/dart-lang/sdk/issues/37708

Change-Id: I2fc696663d2dd03c5af44fe204fe6058674b5134
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111987
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-08-06 01:17:47 +00:00
Paul Berry 9f9abe5fcd Flow analysis: get rid of "identity" state.
Previously, flow analysis was using the `_identity` state for two
purposes:

1. As the "if true" state for "false" and the "if false" state for
   "true".

2. As the base state for the "break" and "continue" code paths of
   loops, before any "break" or "continue" statements had been seen.

For the first purpose, it is more consistent to use
`_current.setReachable(false)`.  This ensures that in code disabled by
`if (false)`, promotions are not lost.  For the second purpose, it is
easier to just use `null` as the base state.

There is a small behavioral change: previously in unreachable code, if
we used the `_identity` state, all variables were considered assigned;
otherwise they were considered assigned or not according to the state
of the code prior to the branch point that caused the variables to
become unassigned.  Now, unreachable code consistently has the latter
behavior.

Change-Id: If77a3fcff9391b66164c0445d5242cb04c9a6b76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112023
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-08-05 23:23:47 +00:00
Johnni Winther 5c7fe46e3e [cfe] Merge more Kernel*Builders into *Builders
Change-Id: I335216e2702fe881287e296e0dd1d457e6c7cea7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111541
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-08-05 19:31:28 +00:00
Johnni Winther 262aaf13a0 [cfe] Merge KernelLibraryBuilder into SourceLibraryBuilder
Change-Id: I8c654aa8065b5e2b43c864a43924925cbfd972b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111540
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-08-05 19:31:28 +00:00
Johnni Winther 067c6ea5b6 [cfe] Add extension type variables to procedures
Adds synthesized type variable builders and formal parameter builders to
the procedure builder. This ensure that both the outline and body
building correctly resolve extension type variables and extension this types.

Change-Id: I55d5665286dafedb4e47316faafb32ddb6cc33d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111730
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-08-05 17:15:37 +00:00