Commit graph

1873 commits

Author SHA1 Message Date
Alexander Markov 6e989dfe35 [vm/kernel] Generate new invocation nodes in async transformers
This change replaces generation of old invocation AST nodes
(such as PropertyGet, PropertySet and MethodInvocation) in async
transformers with new nodes (InstanceGet, InstanceSet,
InstanceInvocation, LocalFunctionInvocation).
The old nodes will be deleted eventually.

TEST=existing tests

Issue: https://github.com/dart-lang/sdk/issues/45340
Change-Id: I8c2ead9509cfd2def2f75f9d82dc13b2a9490fdf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202801
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-06-09 22:14:51 +00:00
Mayank Patke 93c96d5857 [dart2js] Implement basic lowering for late instance variables.
This feature is gated behind the --experiment-late-instance-variables
flag.

Change-Id: I1ecb2d4d960b58204207ea055361463efa3a0bcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200922
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-06-02 23:21:24 +00:00
Dmitry Stefantsov 6a3fc5010e [cfe] Rewrite computeConstCanonicalType using ReplacementVisitor
Change-Id: I2154fe11fb23e4e184f59cffef89dbcf48528662
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200869
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-05-21 14:26:12 +00:00
Johnni Winther d8bbd356a9 [cfe] Migrate constant evaluator
Change-Id: I6e8496886257bd1361a004c8672064542427928e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200867
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-05-21 08:39:01 +00:00
Alexander Markov b07305d2c3 [kernel] Visit/transform Typedef fields
Previously, certain fields of Typedef kernel AST nodes
were omitted from visitChildren(), transformChildren() and
transformOrRemoveChildren() and were not properly visited.

Also, the following related problems are fixed in this CL:
* parents of VariableDeclaration nodes in Typedef were not properly set;
* verifier didn't account for VariableDeclaration nodes in Typedefs.

TEST=existing tests

Change-Id: I4f9cb694ad9cacc9c20fe66e8a49f73f547ca245
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96964
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-05-19 17:47:02 +00:00
Alexander Markov f6f2f5044c [kernel] Visit functionType/resultType fields in new invocation nodes
New invocation nodes have explicit functionType/resultType fields
which should be also visited by various visitors and transformers.

Without visiting those fields not all types are processed by
certain transformation (e.g. tree shaker) which causes crashes
during AOT compilation if new invocation nodes are enabled.

TEST=runtime/tests/vm/dart/regress_45966_test.dart (with new
invocation nodes).

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

Change-Id: I61d79650984a353d842b58da082a021ab37ab777
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199365
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-05-19 17:41:42 +00:00
Jeffrey Swan fed6cadf77 fix(docs): corrects common typos in project documentation
Scope of changes is restricted to markdown docs only. Changes made in agreement with Standard American English.

Closes https://github.com/dart-lang/sdk/pull/45818
https://github.com/dart-lang/sdk/pull/45818

TEST=Manual review of the changed markdown files.

GitOrigin-RevId: 6df9128b46e4e51e634baf534c0169f62bc6a67e
Change-Id: I7b67dcb5a6e0a03db2b6eea24ace8dee207c4a11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196742
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2021-05-18 15:48:18 +00:00
Sam Rawlins 64c2dd6193 Remove "unnecessary" imports in pkg/kernel
In each library where an import is removed, the library uses some elements
provided by the import, BUT there is another import which provides all of the
same elements, and at least one more which the library uses.

In this change, we remove the imports which can be simply removed in favor of
the other already present imports.

See https://github.com/dart-lang/sdk/issues/44569 for more information.

Change-Id: Ifebf11894fd62280b20230aa6d66de41cf6baae8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199462
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-05-14 20:18:18 +00:00
Mayank Patke 2d62f325a2 [dart2js] Add a flag to omit names for late cells.
Change-Id: I67125e35b5339697b97738dd0c5540fe7a773510
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199300
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-05-12 14:02:10 +00:00
Dmitry Stefantsov 9f750ca0d3 [cfe] Add flags field to Extension and use it for 'extension type'
TEST=Checked by existing tests.

Change-Id: I436c0322124165f52195ebef402d7ab9104bbb30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198763
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-05-11 10:15:43 +00:00
Alexander Markov df3bb63a13 [cfe] Use more precise types for FunctionInvocation and LocalFunctionInvocation in type checker
Issue: https://github.com/dart-lang/sdk/issues/45340
Change-Id: I963b3a3b1143a9fbd0eac700daa11488aa5b183a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198182
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-05-05 23:31:56 +00:00
Alexander Markov b00233f128 [vm] Support new kernel AST invocation nodes in the VM
TEST=Manual testing with new invocation nodes enabled.

Issue: https://github.com/dart-lang/sdk/issues/45340
Change-Id: I7eb5f03b9d9ac16c911812a5dbcd92ad43220278
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197585
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-05-05 20:39:12 +00:00
Lasse R.H. Nielsen 3e9cdc5644 Seal typed-data types.
Change-Id: Ic20b68fc258ddbf5c007f9d357366d8a41d1f1e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192186
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-05-05 18:04:05 +00:00
Jens Johansen 08faf7bddb [kernel] Fix speed regression introduced in readAnnotationList recently
In 3c83032c60
(https://dart-review.googlesource.com/c/sdk/+/195517)
a change inadvertently made it in that changed readAnnotationList from
always returning a constant empty list when the size was 0, to only
returning an (almost) constant list if the size was 0 and a non-default
setting was enabled.
In practise that meant that for normal runs we went from returning
a constant list when the size was 0 to returning a new empty list,
and the benchmarking system said
AstFromBinaryLazy (Intel Xeon): +33.2%
AstFromBinaryLazyP90 (Intel Core i5): +87.2%
AstFromBinaryLazyP90 (Intel Xeon): +117%
(i.e. generally much slower).

This CL restore the status quo and my local benchmarks says:
AstFromBinaryLazy(RunTimeRaw): -22.98% +/- 3.91%
AstFromBinaryLazyP50(RunTimeRaw): -6.20% +/- 5.03%
AstFromBinaryLazyP90(RunTimeRaw): -54.25% +/- 3.78%

Change-Id: Ia198cbbb0b2739f49a085435d98efb04740fa593
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198280
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-05-05 07:36:32 +00:00
Alexander Markov df80241899 [vm] Handle new AST invocation nodes in VM kernel transformations
This change extends VM-specific kernel transformations to handle
new AST invocation nodes. The transformations may still generate
old nodes, but they should accept and handle new nodes coming from
the front-end.

TEST=Manual testing with new invocation nodes enabled.

Issue: https://github.com/dart-lang/sdk/issues/45340
Change-Id: I2de9f0eb00fcf844ba62fdc93b15a907c2d6b69d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197443
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-05-04 18:15:01 +00:00
Jens Johansen da4343348e [kernel] Change constant references; remove need for map
Previously constants were referenced via there relative binary offset,
i.e. a constant reference saying 42 meant at byte offset 42 relative to
the start of the constant table in the binary. This was done to be able
to (on the VM side) read the needed constants lazily. It meant, though,
that constants had to be stored in a map, mapping from the byte position
to the constant.

This change adds a level of indirection when needing the lazy reading,
but lets the constant references reference the constant number instead
so that a constant reference saying 42 means constant number 42,
i.e. constants can be stored in a list instead of in a map.
This is done on the dart side, but the VM still stores it in a map.

The level of indirection is a tabel next to the constant table where
each entry has constant size (4 bytes) from which one can read the
relative byte offset into the constant table from the constant number,
thus still being able to read needed constants lazily.

This CL also cleans up a leftover where for instance double constants
had their textual representation saved as a string in the string indexer
(and thus the output dill) even though they were never referenced.

File size changes:
* Platform: increses 7,816 bytes.
* Compile of dart2js (including platform): decreases 71,424 bytes.

Speed changes:
* Adding `UserTag`s to the code and looking at observatories cpu profile
  on a `pkg/kernel/test/binary_bench.dart --golem AstFromBinaryLazy`
  run of a compile of dart2js reading the constant table has gone
  from ~10% to ~5%.
* Doing statistics on
  `pkg/kernel/test/binary_bench.dart --raw AstFromBinaryLazy` run of a
  compile of dart2js says -6.28169% +/- 4.97269%.
* Golem runs has nothing above the noise level.
  It does say "AstFromBinaryLazy (Intel Xeon) -4.006% (0.4 noise)" and
  "AstFromBinaryEagerP50 (Intel Core i5) -8.929% (0.6 noise)" though.

TEST=All tests running the VM tests this.

Change-Id: I07ead457527a4477de803ee55ba742f5557413d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196925
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-05-04 11:08:31 +00:00
Johnni Winther b8bc0dd751 [kernel,vm] Migrate first part of vm transformations
Since the VM package isn't opted in, the individual libraries have
been annotated with `@dart=2.12` to opt in to null safety.

TEST=existing

Change-Id: I0bfbcf69cb80d32bb6b80a171f7bdb62fde7ca65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195277
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-05-03 12:13:28 +00:00
Johnni Winther efe0ddccab [kernel] Reland: Migrate remaining bin/lib libraries in package:kernel
Change-Id: I5eacb92ea6ce00d83b3440a473cca8dad0892a87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197165
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-04-28 14:36:53 +00:00
Johnni Winther 3c83032c60 [kernel] Avoid using List.length= to grow lists in ast_from_binary
+ some additional changes needed for sound null safety

Change-Id: Icab02486109b38b6dec269a65d705126efa88622
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195517
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-04-28 09:59:23 +00:00
Dmitry Stefantsov cc621431f9 [cfe] Implement subtype relation for ExtensionType
Change-Id: I725c6abd4ad2ec7fe217e271fbe60d57af443f7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196933
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-04-27 13:03:38 +00:00
Johnni Winther 8f92864ca3 [kernel] Rename MapEntry to MapLiteralEntry
- to avoid collisions with MapEntry from dart:core

TEST=existing

Change-Id: I7b9592844345313e79ac18d18017c74de7c02106
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196930
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-04-27 10:36:38 +00:00
Dmitry Stefantsov 3eaeec5397 [cfe] Add Extensions to the parser in the CFE type tests
Change-Id: I796fcab752da42c77414170b661dfe5c42e30aec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196492
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-04-23 09:14:01 +00:00
Johnni Winther 41183d1641 [kernel] Make Location.file non-nullable
+ remove support for serializing null uris

Change-Id: I527eb5206f4999c717cb06d88bdbe6e02b7c8218
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196482
Reviewed-by: Jens Johansen <jensj@google.com>
2021-04-23 07:19:11 +00:00
Johnni Winther fdc765faad [cfe] Make TypeParameter.defaultType non-nullable
TEST=existing

Change-Id: I0a8fdf09f742b55357411f12dc6164d4050bb83c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196283
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-04-21 13:51:50 +00:00
Dmitry Stefantsov ad62d8bd7f [cfe] Add calls to isExtensionRelated to subtype implementation
Closes #45775.

Bug: https://github.com/dart-lang/sdk/issues/45775

Change-Id: Ibffdd24b1a691b2149323dbc984c0d3ae7134c25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196120
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-04-21 12:03:18 +00:00
Johnni Winther dd84fdb894 [kernel] Remove Name.name
Change-Id: Ida1a0f54061b114fa7b4c3c05aaf77908da5e858
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192305
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-04-20 13:06:37 +00:00
Johnni Winther 69d56fd82a [kernel] Make TypeParameter.bound non-nullable
Change-Id: I31e693a5b77db039c6a2f8ac8ea534ad663ae0ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195988
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-04-20 10:56:56 +00:00
Jens Johansen 44591f258d [kernel] Add --raw to binary bench
Change-Id: I5e52c006904b5403701719a490f3a26685eb6411
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195902
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-04-19 10:31:20 +00:00
Johnni Winther 3e44898e08 [kernel] Make FileUriNode.fileUri non-nullable
TEST=existing

Change-Id: I72583e500cb0b69d9352b040c3e2885f9e0450c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195681
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-04-19 08:03:30 +00:00
Mayank Patke 3b4e4f6f47 [dart2js] Cache Cell-specific kernel AST nodes on CoreTypes.
Change-Id: I82957eb405d7ab5c76ad1caf90ed510279ec8a7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195540
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-04-16 06:34:27 +00:00
Johnni Winther 7e6692b20c Revert "[kernel] Migrate remaining bin/lib libraries in package:..."
Revert submission 195268

Reason for revert: Implicitly triggers running bin/* in sound null safety, revealing an unsafe use of List.length=

Reverted Changes:
I026ace4fd:[cfe] Migrate front_end libraries from wave 3-4
I9ba1f809b:[kernel] Migrate remaining bin/lib libraries in pa...

Change-Id: I3535c45d6eaf970dc5a17b6d7274cd9d6aa16ae2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195507
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-04-15 14:55:37 +00:00
Johnni Winther 9feb5330b9 [kernel] Migrate remaining bin/lib libraries in package:kernel
Change-Id: I9ba1f809b0340b6d45471d856f2a31cff9534de8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195264
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-04-15 12:04:28 +00:00
Dmitry Stefantsov 91aecfcd5f [cfe] Use i2b at the end of function call inference
Closes #45598.

Bug: https://github.com/dart-lang/sdk/issues/45598
Change-Id: I37430faf057e3559ad6aefaa59d83d8a14320c54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194764
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-04-15 10:33:27 +00:00
Johnni Winther 71293ec389 [kernel] Migrate scanner and value_class
Change-Id: Id4ff972a9a56e878a991680f76f6264b55db27eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195240
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-04-14 13:35:44 +00:00
Johnni Winther d8f2b7cc44 [kernel] Make .function non-nullable on Procedure, Constructor, and LocalFunction
TEST=existing

Change-Id: I4d0ae16291414e58207b7de0466d989d27997619
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195074
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-04-14 08:17:28 +00:00
Dmitry Stefantsov 4658b9ee6b [cfe] Introduce ExtensionType into isSubtypeOf
Change-Id: Iea88e7355d7eee9d82c0c41247407fe1178ee049
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195068
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-04-13 13:05:57 +00:00
William Hesse 0cb6607cf1 [sdk] Bump version to 2.14
TEST=CI presubmit with added tryjobs

Change-Id: I6c4f7de9d3fbe6d1031f6f0161e8ffebcea822a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195062
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2021-04-13 12:47:27 +00:00
Johnni Winther 64460ec47f [kernel] Make Member.name non-nullable
Change-Id: Id2befd868e93985d6af463c2ccd410cd56b68187
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194721
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-04-12 13:48:46 +00:00
Franklin Yow 03101c0c2b Update LICENSE
Changes to comply to internal review

Closes https://github.com/dart-lang/sdk/pull/45568
https://github.com/dart-lang/sdk/pull/45568

TEST=CL contains no code changes.

No-Try: true
GitOrigin-RevId: 65796784e5fdfddaa021b5c55ad435b1db419700
Change-Id: I085a948f16dc9a0de128ed0bd456ae69adf6c124
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193888
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2021-04-07 10:28:38 +00:00
Johnni Winther 9d80c4db57 [kernel,vm] Migrate vm transformations in package:kernel
TEST=existing

Change-Id: I86dfda23fa32ecb924fa6c202e7142cb8a258dc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192145
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-04-07 08:30:47 +00:00
Johnni Winther a26a140d88 [kernel,vm] Change async transformer to extend RemovingTransformer
Since some of the async transformers return `null`, signaling that they
remove nodes, they must extend the RemovingTransformer in order to
migrate to null safety where arbitrary node removal is not possible.

Change-Id: I8e20e2c61ce23699fe32c7450aacdd15467da5f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191923
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-04-07 08:30:47 +00:00
Dmitry Stefantsov 19297a9a42 [cfe] Implement missing bound checks for nonfunction type aliases
Closes #45519.

Bug: https://github.com/dart-lang/sdk/issues/45519
Change-Id: I0492e83ebf605eaa1355d7e472bc28050dc5588c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193500
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-03-31 19:21:42 +00:00
Alexander Markov 303f1eda70 [vm/aot] Avoid reusing Reference when replacing Field with getter in tree shaker
TEST=existing tests
Change-Id: I0a661e8d1b0be418080dadfe4ffe1eabd49a16aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191640
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-03-31 15:57:59 +00:00
Alexander Markov 6239c434fb [vm,cfe] Avoid elimination of 'x as Function' type casts
Elimination of redundant type cast 'x as Function' where x is
a function type (such as 'void Function(int)') is not correct because
it changes semantics of a function call if such expression is
used as a receiver.

"Function" static type of receiver allows arbitrary function calls,
while known function type of the receiver means the call doesn't
need to check parameter types. Static type of receiver is currently
not stored in kernel AST but calculated from the receiver node,
so replacing 'x as Function' with 'x' changes static type of
the receiver from "Function" to function type.

TEST=tests/language/regress/regress45428_test.dart
Fixes https://github.com/dart-lang/sdk/issues/45428

Change-Id: If7148450526703daa63a442adf67a9e7a2dcea54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193524
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-03-31 15:57:29 +00:00
Johnni Winther 9ca19cac6f [kernel] Change encoding of types in constants to not be offset by the context
Function type parameters in occurring in constants were using an offset
based on the context in which the constant first occurred. This meant
that function type parameters occurring in a generic context would have
a different offset that those occurring in a non-generic context.

The loading of .dill in ast_from_binary would read all constants outside
the context and would therefore get the indices wrong on generic
function types.

This CL changes the encoding of these type parameters to always use
a fresh context.

Closes #45415

TEST=pkg/front_end/testcases/generic_metadata/from_dill/main.dart

Change-Id: Ifdaedb4581f1e022c908fc58a58ceac3d7b0900e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193481
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-03-31 12:31:43 +00:00
Johnni Winther 13556d623f [cfe] Add DartType.toNonNull
Add helper on DartType to compute the `NonNull` of a type and use this
instead of `withDeclaredNullability(Nullability.nonNullable).

Includes a fix in the computation of NonNull of FutureOr.

TEST=existing

Change-Id: I3399cbf89c7d3f3e90f1315b01f40957e798a1b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193400
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-30 10:25:28 +00:00
Johnni Winther 92e237c835 [cfe,dartdevc,dart2js] Use InstanceGetterInvocation for getter/field invocation
The web compilers don't support getter/field invocation encoded as a
FunctionInvocation on an InstanceGet because it doesn't work for
getter/field invocation of js-interop properties, since the InstanceGet
wouldn't result in a Dart function but just JavaScript function.

To support this in the new method invocation encoding, a special
expression, InstanceGetterInvocation, is used to encode getter/field
invocations in dart2js and ddc.

Change-Id: I21da8e8686f66ae4ce4d44245073b9e424f975b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192181
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-03-23 09:49:06 +00:00
Johnni Winther 9ad76fe7bd [cfe] Support annotations on function type parameters
The fix includes processing of type parameters elsewhere and also
adding support for annotations on extensions.

Closes #28981

TEST=existing

Change-Id: I71ab5640bd3a16f4a024b6edd047a525eed1c399
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191404
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-19 11:52:57 +00:00
Johnni Winther d59c8bc4fd [cfe,dart2js] Handle LocalFunctionInvocation in ListFactorySpecializer
The CloneVisitorNotMembers contains a mapping from variables to their
corresponding clones. The ListFactorySpecializer special cased access
to this mapping to support conditional cloning. When dart2js switchted
to used the new method invocation encoding, this left the
LocalFunctionInvocation unhandled, leading to null check error when
local functions where invoked in the closure passed to List.generate.

This CL makes this mapping private and adds getter/setter methods for
lookup and registration. The ListFactorySpecializer now instead overrides
the getter to support conditional cloning instead of handling each use
case.

Bug: b/183083319
Change-Id: I2fd3b79137c51a424f17127b502e6a945c6796a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191901
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-03-18 14:34:33 +00:00
Johnni Winther 9e23810b77 [kernel] Migrate more libraries in package:kernel
Change-Id: I249c9fa9f2727544f940b3d954ce49bf38ee4918
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191402
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-03-18 11:06:18 +00:00
Aske Simon Christensen c49ec127fd [kernel] Implement visitExtensionReference in VisitorThrowingMixin
Change-Id: I472aaae83b360c31edfc29e8c47e9885a72779f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191405
Auto-Submit: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-03-16 17:13:03 +00:00
Dmitry Stefantsov d6b79dab6c [cfe] Correct argument count in extension member errors
Closes #45204.

Bug: https://github.com/dart-lang/sdk/issues/45204
Change-Id: I5295704a8d470e639fe346dbbbf80ad28ff614a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190520
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-03-15 10:46:00 +00:00
Dmitry Stefantsov 8ddc7465a8 [cfe] Move ExtensionType into pkg/kernel/lib/ast.dart
Change-Id: I2e8231dad00accafb09d1ec88416242d3d5815a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190483
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-03-12 19:02:27 +00:00
Johnni Winther 1aa6f00107 [kernel] Refactor CanonicalName/Reference integration
The CL is a step towards have a more restricted and wellstructured
handled of references and canonical names.

The CL moves Reference to canonical_name.dart and makes
CanonicalName.reference private, and replaces CanonicalName.getReference
with a 'reference' getter.

It also removes NamedNode.canonicalName, Field.getterCanonicalName and
Field.setterCanonicalName so that these can only be accessed through the
corresponding reference. This is to reduce the reliance on the
canonical names which, ideally, should only be part of serialization and
deserialization.

TEST=existing

Change-Id: I955fb7d52d4e112d8741f7c12dcf38b74ae0c91a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190442
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-03-10 15:39:28 +00:00
Johnni Winther 03ac05b146 [kernel] Migrate package:kernel/text_serializer.dart
Change-Id: I0b084911fa4ba35593a70ba8c214e818dbf7c219
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190440
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-03-10 13:26:58 +00:00
Johnni Winther 7d64d528ce [kernel] Migrate ast_to_binary.dart
TEST=existing

Change-Id: If080190b80776a7613f983b28c2e800727599328
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189201
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-03-09 09:29:56 +00:00
Johnni Winther 2d63f26ef5 Reland "[cfe] Encode field references as @getters and @setters"
This removes the @fields and @=fields canonical name
encodings that allowed for encoding of conflicting members
and didn't support field<->getter/setter conversion
between dills or between outline and full dill.

TEST=existing tests+add aot expectation tests

Change-Id: I119b0c95f90e456356146cdc2d9241de4c1b4fff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186680
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-03-09 05:47:16 +00:00
Johnni Winther 01b0947a6d [kernel] Update kernel encodings
* Add InstanceGetterInvocation for getter/field invocation in web
  backends
* Add localFunction getter to LocalFunctionInvocation
* Remove isNot from EqualsCall and EqualsNull - the encoding didn't
  carry its weight.
* Remove uses of Name.name
* Remove BottomType code from VM

TEST=existing

Change-Id: I99d05d35b9ef193d092cc151c99ad472dbd60834
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188725
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-08 11:29:51 +00:00
Dmitry Stefantsov c83d8792a2 [cfe] Allow generic types in arguments and bounds under a flag
The flag that enables the feature is the 'generic-metadata' experiment
flag.

Bug: https://github.com/dart-lang/sdk/issues/44916
Change-Id: I2770c672280831bf5af6643fde9cb0f1be3083b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188701
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-03-04 14:09:46 +00:00
Johnni Winther 50cda7c5e3 [cfe] Support text serialization of new method invocation encodings
Change-Id: Ie106341331f685650ac886f4b00218b806644ed5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188722
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-04 11:06:46 +00:00
Johnni Winther dd1c3a3233 [vm] Make async transform resilient in context of invalid type and never type of iterables
The CFE can invoke transformations despite having compile-time errors.
The async transform was crashing the compiler if it hits for-in
iterables that have an invalid type or never type.

In case of an invalid type, the program has a compile-time error and
won't be able to run propertly. So we'll replace the entire for-in with
an invalid expression statement if the iterable is an invalid
expression.

In case of a never type, the program should compile fine, which this CL
also fixes.

This makes the newly added tests no longer result in DartkCrash but
rather in a compile-time error (invalid expression) or runtime-error
(never type).

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

Change-Id: Ic50f68400b67b57dd4a2c0a125b08f0f3e0d8dd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188463
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-03-03 11:58:08 +00:00
Aske Simon Christensen 76d77603e9 [kernel] Fix typos in interfaceTarget setters
Change-Id: I93d8fb682b7538a048e862db765c0e3d907b1130
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188522
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2021-03-03 09:23:48 +00:00
Johnni Winther af4757dd0b [kernel] Migrate ast_from_binary.dart
TEST=existing tests

Change-Id: Ie6b3baa9233e2f02179d0eaf31224e628436495e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188282
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-03-02 12:11:12 +00:00
Johnni Winther 7cbdc2f3a2 [kernel] Merge to InvalidType when either input is invalid
Change-Id: I9c41988b725cba5f3b8a0cef21132e409dd7e261
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188289
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-02 12:11:12 +00:00
Dmitry Stefantsov be8196b312 [cfe] Add method resolution for extension types
Change-Id: I23577cf2083ccf03c56e4d1130039afbce8d5f27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188020
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-03-01 13:43:09 +00:00
Jens Johansen 741336e40b [kernel] readAndPushTypeParameterList takes useGrowableLists into account
This means that when useGrowableLists is false all empty TypeParameter
lists are the same (unmodifiable) empty list.

When running dart2js in its "linker scenario" on a large internal app
this saves something along the lines of 30MB of memory.

Change-Id: Iee31016d238650de19db584a5617ca4a16889fe7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186940
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-25 12:02:16 +00:00
Aske Simon Christensen ead5e5c683 [kernel] Non-nullable enclosingClass for Constructor members
Change-Id: I2a31e4272f9119c229e1eea8a75114f5c2bf82b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186281
Auto-Submit: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-25 10:40:46 +00:00
Stephen Adams 25ca4c490f [dart2js] Use StringInterner to share strings from binary files
Reduces heap in large link scenario by 850MB.

Change-Id: I9dd8c82868b4cc45e6389007348d8b6086c28ee1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186745
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-24 20:48:34 +00:00
Dmitry Stefantsov c191551fac [cfe] Remove BottomType
TEST=Covered by existing tests.

Change-Id: Ied8be1874164e68e0a3a48e1b2f9a33310071381
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183009
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-24 13:21:55 +00:00
Dmitry Stefantsov 3c259a0ab0 [cfe] Add ExtensionType as an internal Kernel AST node
Change-Id: I14bfb014489b3ccec34c079d951fc875ec814ebe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186288
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-24 11:56:15 +00:00
Jens Johansen 0ef929917a [kernel] Don't use const as that might introduce polymorphism
In https://dart-review.googlesource.com/c/sdk/+/185828 @vegorov explains
how using `const []` where there before was a non-const list can
introduce polymorphism.
This CL applies the same trick in kernel as suggested there, on the
instances of `const []` recently introduced.

Change-Id: I47033cd7487d56bfde1ed9088fef027466f26875
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186580
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-24 10:58:15 +00:00
Johnni Winther 4e1c79d86b [cfe] Don't clone synthetic members into mixin applications
Change-Id: I8e92b95ae29f8cec16f69f59cc52c203bba5ea6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186140
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-22 16:17:29 +00:00
Johnni Winther 8f0d5ef076 [kernel] Change InstanceInvocation.interfaceTarget to Procedure
Change-Id: Id45bc682dfcd48f8b40192bfc519272ea0c440f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186141
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-22 15:21:19 +00:00
Johnni Winther 79de274398 Revert "[cfe] Encode field references as @getters and @setters"
This reverts commit 3892e95547.

Reason for revert: Breaks Flutter web

Original change's description:
> [cfe] Encode field references as @getters and @setters
>
> This removes the @fields and @=fields canonical name
> encodings that allowed for encoding of conflicting members
> and didn't support field<->getter/setter conversion
> between dills or between outline and full dill.
>
> TEST=existing tests
>
> Change-Id: Id15e58ad4d1847d2c98a688705e5945196146c6d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184783
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

Change-Id: I744e284b16e097fa0833c5bdf1bc7653f13bdf63
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186147
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-22 12:56:43 +00:00
Jens Johansen 460df98213 [kernel] Use const lists for empty lists when not using growable lists anyway
When running dart2js in its "linker scenario" on a large internal app
this saves something along the lines of 140MB of memory.

Change-Id: I348f5c46ec430c5a486591897557bfef95d3b435
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185827
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-02-22 10:36:38 +00:00
Johnni Winther 9a74bcef97 [dart2js] Support new method invocation encoding in static type visitor
This is the first part of using the new encodings of MethodInvocation,
PropertyGet and PropertySet in dart2js. In this CL the new visitors
are implemented in static_type.dart. This change is done by refactoring
the existing implementation into helpers and new registration methods
that can be used by both the old and the new encoding but lends itself
to take advance of the new encoding. The new encoding is not enabled
until all of dart2js has been migrated to the new encoding. The
refactoring is intentionally not changing the outcome of the
static_type.dart to make it easier to detect accidental regressions
introduced by the migration.

Change-Id: I93d2033969c33d4c7a5957ad7a6c0b1cdf47fe6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184220
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-02-22 10:12:08 +00:00
Johnni Winther 3892e95547 [cfe] Encode field references as @getters and @setters
This removes the @fields and @=fields canonical name
encodings that allowed for encoding of conflicting members
and didn't support field<->getter/setter conversion
between dills or between outline and full dill.

TEST=existing tests

Change-Id: Id15e58ad4d1847d2c98a688705e5945196146c6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184783
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-02-22 09:46:18 +00:00
Jens Johansen 433d59b917 [kernel] Add option to dill loader for not using growable lists; use in dart2js
Most lists created when loading a dill file are growable.
That's not always needed, though, and a non-growable list is more compact than
a growable one.

When running dart2js in its "linker scenario" on a large internal app
this saves something along the lines of 90MB of memory.

Change-Id: I113a73ed150efb56a5172ac7e1daf1d28f4bc188
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185825
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-02-22 09:31:08 +00:00
Johnni Winther a8297fd7ed [kernel] Make InterfaceType.className final
TEST=pkg/vm/lib/transformations/mixin_deduplication.dart

Change-Id: I95adf2fbe31e3cabd9b1a52a0f4545b5281e6775
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185546
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-21 09:55:17 +00:00
Johnni Winther c6e068aff0 [kernel,front_end] Part 1 of migration wave 2
Change-Id: I4c6413c2011da55ad1d82739130be750cc2b8b37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185380
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-02-18 20:04:40 +00:00
Johnni Winther cea1e14c68 [kernel] Make various AST fields non-nullable
Make Extension.name non-nullable
Make Class.name non-nullable
Make Extension.onType late non-nullable
Make LabeledStatement.body late non-nullable
Make SwitchCase.body late non-nullable

Change-Id: Iccf21fc800faa620c5d4b7bea68f74eec8bf62e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185083
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-18 17:52:27 +00:00
Johnni Winther 8467186ca0 [kernel] Initial migration of package kernel wave 1
This CL completes the migration of the first wave of
interdependent libraries in package:kernel, including ast.dart.

In order to ensure non-nullability on AST properties, the Transformer
has been split in 2 variants: Transformer which doesn't support
removal of nodes and RemovingTransformer which supports removal where
allowed by the context using 'removal sentinels'.

Start reviewing Transformer and RemovingTransformer in visitors.dart
since many of the changes are caused by the changes here.

Included in the migration are the mixin_deduplication.dart and
unreachable_code_elimination.dart since these needed porting to
the RemovingTransformer which was aided by opting in the libraries
which only depended on ast.dart.

TEST=existing

Change-Id: I9e63b985bd24896c25edd4ee51e37770187bcc17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184786
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-18 16:01:17 +00:00
Johnni Winther 07ddd00e1b [cfe] Remove unneeded hide combinators
The front end previously enforced a stricter-than-spec requirement on
conflicting imports on its own code. The check was included of the
kernel snapshot and therefore always enforced, even in published sdks.

The extra check was removed a month ago and now tools/sdks/ have been
updated to use a later version of the sdk, so the unneeded hide
combinators can now be removed from the source code.

Closes #44667

TEST=existing

Change-Id: I1d1053b1ef9a40b6a918eef515a02d7b404906c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185084
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-18 14:23:10 +00:00
Johnni Winther 02f0f53ddf [cfe] Don't block nnbd top merge on typedef types
The MergeVisitor was trying to merge FunctionType.typedefType in order
to merge function types, thus preventing nnbd top merge of two
compatible types that were just introduced through different typedefs
or function type syntax.

Change-Id: Icea75598168c86ed33314db22ebeec3e666c3675
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184785
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-02-16 11:30:21 +00:00
Johnni Winther 78db953aa3 [kernel] Don't use increasing .length = in class_hierarchy.dart
Closes #45013

Change-Id: I1b51818f447faea50fdc34ed7504cba02d65bc34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184789
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-16 10:15:11 +00:00
Johnni Winther 0578c66a98 [kernel] Remove TreeNode.remove
+ restrict replaceWith and replaceChild to only support replacement and
not removal.

TEST=existing

Change-Id: I5381b4907725dd0ea7cf544e133bdb296df48ee0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184469
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-16 08:18:51 +00:00
Johnni Winther af0c951d9f [kernel] Partial migration of package:kernel wave 1 (part 3)
Change-Id: Ib4dcc0bc32cba392352adbc3f73861353333e37c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184420
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-02-12 13:52:20 +00:00
Johnni Winther 6c1e985e76 [kernel] Partial migration of package:kernel wave 1 (part 2)
Change-Id: Ib1093ab9414a80f97f51d54589653f62ec34e30a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184267
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-12 13:52:20 +00:00
Johnni Winther b38c72bc1f [kernel] Partial migration of package:kernel wave 1
Change-Id: Icb42c4cd870bf1830c7399d0f38501348c128028
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184240
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-10 15:55:53 +00:00
Johnni Winther ee0c0bcd57 Reland "[kernel] Ensure that visitors don't implicitly returns null"
This is in preparation to migrate package:kernel to null safety.
For the visitor interfaces to support non-nullable return types, the
implementations must avoid using `null` as return value in its base case.

TEST=Refactoring

Change-Id: Ie8fa5d41b99850d9e4abb59634c72920c64128d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183691
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-10 07:51:52 +00:00
Johnni Winther 9bd9b3ccd6 [kernel] Use List.generate instead of List.filled in ast_from_binary.dart
In preparation for null safety migration, List.filled is replaced
with List.generate in ast_from_binary.dart where the element can be
created by a simple function expression.

Change-Id: I17bc68edebb8dc7d8918d87e9cdc38a9a8711682
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179761
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-09 13:58:03 +00:00
Johnni Winther b60e0aa5a1 Revert "[kernel] Ensure that visitors don't implicitly returns null"
This reverts commit ce81216885.

Reason for revert: Flutter dependency

Original change's description:
> [kernel] Ensure that visitors don't implicitly returns `null`
>
> This is in preparation to migrate package:kernel to null safety.
> For the visitor interfaces to support non-nullable return types, the
> implementations must avoid using `null` as return value in its base case.
>
> TEST=Refactoring
>
> Change-Id: Ie5e4153f8d3779d94957bb13b3d2d2a942040ff2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179760
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>

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

Change-Id: I61b838d3371e6b1de2427716d056324c120be499
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183689
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-09 12:41:12 +00:00
Johnni Winther ce81216885 [kernel] Ensure that visitors don't implicitly returns null
This is in preparation to migrate package:kernel to null safety.
For the visitor interfaces to support non-nullable return types, the
implementations must avoid using `null` as return value in its base case.

TEST=Refactoring

Change-Id: Ie5e4153f8d3779d94957bb13b3d2d2a942040ff2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179760
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-09 09:46:46 +00:00
Dmitry Stefantsov c6bd2afc10 [cfe] Remove a side effect from computeConstCanonicalType
Closes #44857.

Bug: https://github.com/dart-lang/sdk/issues/44857
Change-Id: I1082fded9a0b06cbcf30c484975b0cf464db75a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182781
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-02-08 13:22:13 +00:00
Dmitry Stefantsov 63737581f8 [cfe] Encourage the use of the const NeverType objects
TEST=Covered by existing test base.
Change-Id: Ie858bd5a765d71fa4095eab3373a6ecdb063b260
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183006
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-08 10:36:40 +00:00
Johnni Winther 6ce8d74761 [cfe] Add Function.futureValueType and serialize Let.fileOffset
Serializing Let.fileOffset supports positions in stacktraces resulting
from null aware expressions, like `if (o?.foo) ...` when `o` is `null`.

Adding Function.futureValueType supports the proper backend
implementation for the fix in
https://dart-review.googlesource.com/c/sdk/+/181303

Closes #44654

TEST=existing

Change-Id: Ie5939a248d3d8bf41388e8f435e4ba4195afeabd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182269
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-04 14:06:47 +00:00
Alexander Thomas c88171c8af [sdk] Bump version to 2.13
TEST=Presubmit tests and local builds
Change-Id: I1b15d60eced0cf3f422548eda75706609f6640cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182624
Commit-Queue: Alexander Thomas <athom@google.com>
Auto-Submit: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-04 12:10:17 +00:00
Dmitry Stefantsov 425e4dbe09 [cfe] Sort type variables topologically before building the bounds
Closes #44455.
Closes #34803.
Closes #42434.

Bug: https://github.com/dart-lang/sdk/issues/44455
Bug: https://github.com/dart-lang/sdk/issues/34803
Bug: https://github.com/dart-lang/sdk/issues/42434
Change-Id: I3be93b0d4a251de79c3bfe9829143f0fbec201ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181402
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-01 18:46:29 +00:00
Johnni Winther 019ce33409 [cfe] Don't handle synthesized as if they are declared in mixins
Members declared in mixins are treated as if these were declared in
the class where they are mixed in. This means that use their types as
declared types, instead of including them in a combined member signature.

This failed in the case where a member was synthetically added to the
mixin class, because the types of these we wrongfully be handled as
declared types.

We now skip all synthetic members when reasoning about mixed in members
as declared members.

Change-Id: I9c2311b4472fe16162fcdc4c56fce8db2d946f4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181201
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-28 09:39:50 +00:00
Johnni Winther 2761782d60 [kernel] Move switch cases to helpers in ast_from_binary
Change-Id: If3e2854cd6f7118179766e179348fb02227f9798
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181384
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-27 18:56:59 +00:00