Commit Graph

31 Commits

Author SHA1 Message Date
Johnni Winther 8ba4a714a5 [cfe] Replace Scope.forEach with iterators
Scope.forEach iterates through the builder immediately mapped in the
scope. For duplicate declarations, this means that it'll give direct access to the last defined declaration and not to the first defined
declaration, which is inconsistent with how we generally handle
duplications. It also doesn't skip builders that are not "owned" by
the scope but merely accessible, which means that we easily have
duplicate handling of patches and augmentations which are part of
both the scope in which the were declared and the scope of the origin.

To normalize the handle of scope, this CL removes Scope.forEach
with iterators that explicit filter what subset of the builder
that we want to have access to. This prepares for the more complex
scope introduced by the augmentation libraries in which all
scopes have access to all declarations from the origin library as
well as other augmentation libraries.

Change-Id: I88bdfb1068fbb4eb9dd6fa3881b86a61104e50e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255240
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-08-17 12:21:03 +00:00
Johnni Winther 05b4a4e0a8 [cfe] Support sequential application of Phase 2 macros
This CL add support for introspecting members added in Phase 2 from
one macro application to the next.

Included is a refactoring of the class/member patching where the
origin now owns the patches similar to how library patching now
works.

Change-Id: Ifdf03461d66be3f5a5df4b5bdb1e3da9f4cfd688
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233462
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-18 12:11:51 +00:00
Johnni Winther b2a4ca9d20 [cfe] Move members from ClassBuilder to SourceClassBuilder
Several ClassBuilder members where only used on SourceClassBuilder.
These have now been moved.

Change-Id: Idc22b95b3c1ca095b33dd4929238f7712f90c24a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227740
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-01-12 13:33:23 +00:00
Johnni Winther 3e2f98d652 [cfe] Add support for custom data in id testing
This allows for using data created in the TestConfig in the computation
of test results.

Change-Id: Ia4820d0b739b01272f10d2c2561fcf77ae007031
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225731
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-12-31 15:12:32 +00:00
Johnni Winther b8e5842a2c [cfe] Move Source*Builder to source/ folder
Change-Id: I4049ab053345b85f187f7aa1a2ceb1c3011f6be1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225728
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2021-12-30 12:52:25 +00:00
Johnni Winther b768909744 [cfe] Add SourceMemberBuilderImpl
This change adds a SourceMemberBuilderImpl subclass to MemberBuilderImpl
that use common only to SourceMemberBuilders. This allows moving methods
to the SourceMemberBuilder interface and let the
SyntheticConstructorBuilder, and the newly added
_RedirectingConstructorsFieldBuilder implements SourceMemberBuilder.

Change-Id: I1c98a61482bda3bea5be95124f34b9c4501e9333
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225726
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2021-12-29 14:54:19 +00:00
Johnni Winther 5f32f4d7b6 [cfe] Separate patch from regular libraries
+ handle them through the origin library.

This prepares for supporting multiple patch libraries for the same
library.

Change-Id: Ib4934fd2f2c7f743fa342dae86002ac72d57f9a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/222304
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2021-12-10 22:11:29 +00:00
Johnni Winther 450ff2976d [cfe] Migrate (more) CFE tests (part 11)
Change-Id: I905adcd2125ce66d6ba9923d996354657b679cec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220965
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-11-24 11:15:41 +00:00
Jens Johansen 1197e15a7e [CFE] Enable avoid_void_async lint
This CL enables the avoid_void_async lint in the CFE, makes the needed
changes and adds the missing `await` (because the lint
`unawaited_futures` doesn't react to void async methods).

Change-Id: Iffc1f173badd3c2d48356ee02e81a9aed492ce5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213481
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-23 11:58:18 +00:00
Johnni Winther a6cc772b67 [cfe] Add always_declare_return_types lint
Change-Id: I206a7a8132b5ea79dc019acf5c2e0cd800307bcf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212161
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-09-02 08:07:23 +00:00
Sam Rawlins 245705e23c Remove unnecessary imports in pkg/front_end
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: Iea21ddba3f26637a244437911730253e4c6f22dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199460
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-05-13 23:47:28 +00:00
Johnni Winther 34fb48bb8a [kernel,front_end] Migrate first wave of pkg/kernel and pkg/front_end
Migrates libraries dependent only on already migrated libraries.

Change-Id: I0e85ee8dbc2afce031b92e0009e71c206a55af28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179502
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-18 15:40:21 +00:00
Johnni Winther b42f954364 [cfe] Use experiment release version when non-nullable is enabled explicitly
Even when non-nullable is enabled by default, enabling the experiment
explicitly should result in the experiment release version (and not
the experiment enabled version) to be used for opting in.

For this change, the semantics of parseExperimentalFlags was change
to _not_ normalize the flags to a full mapping including default values.
For this reason all uses of such maps are renamed to
'explicitExperimentalFlags'.

Closes #43879

Change-Id: I0d0262e68ec1403549abcfd305ae3a4404fe93e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168654
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-22 06:17:39 +00:00
Johnni Winther 137c7b6c84 [cfe] Explicitly run front_end unittest without non-nullable
This prepares front_end unittests for turning on non-nullable by default.

Change-Id: I9588a2d026ab9f5b1dcf08a140d25bd5dca3d5bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168346
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-20 13:13:33 +00:00
Johnni Winther f4501b6e83 Reland "[kernel] Rename Name.name to Name.text"
Including a deprecated getter to avoid breaking dependent code outside
the Dart repo.

Change-Id: I365957b7c2da6e0cb5c71eb8d2906b0dc6ff18ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163062
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-17 06:10:49 +00:00
Johnni Winther 644df9b9fb Revert "Reland: [kernel] Rename Name.name to Name.text"
This reverts commit c430a0ac0b.

Reason for revert: Will break flutter_frontend_server when rolled into google3

Original change's description:
> Reland: [kernel] Rename Name.name to Name.text
> 
> Change-Id: I5240b0ff09faf35184998920202d7600dc97766d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162746
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Commit-Queue: Johnni Winther <johnniwinther@google.com>

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

Change-Id: Ib6961f49dd416171c5d5935c490d79d6f7be779e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162748
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-16 08:22:55 +00:00
Johnni Winther c430a0ac0b Reland: [kernel] Rename Name.name to Name.text
Change-Id: I5240b0ff09faf35184998920202d7600dc97766d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162746
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-16 07:42:42 +00:00
Daco Harkes 7302e01a79 Revert "[kernel] Rename Name.name to Name.text"
This reverts commit 3ff8dd2f51.

Reason for revert: Fails all CI builders. Possibly something landed
in the mean time.

Original change's description:
> [kernel] Rename Name.name to Name.text
> 
> Change-Id: I93162fb387ba123b949e19a7829bd5614845b15d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162722
> Reviewed-by: Jens Johansen <jensj@google.com>
> Commit-Queue: Johnni Winther <johnniwinther@google.com>

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

Change-Id: I2ffe526dabf37ae09d5e4ab1fbe514925f6e8768
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162744
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2020-09-15 15:21:35 +00:00
Johnni Winther 3ff8dd2f51 [kernel] Rename Name.name to Name.text
Change-Id: I93162fb387ba123b949e19a7829bd5614845b15d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162722
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-15 14:27:22 +00:00
Johnni Winther 23d70f6f23 Reland: [cfe] Embed and use allowed experiments in CFE
This CL embeds the sdk_nnbd/lib/_internal/allowed_experiments.json
into the CFE and uses this to allow experiments enabled on a
per library basis. The file is embedded through generated code to
avoid reliance on access to the file itself.

A presubmit check is also added to ensure that the json file and
the generated code are in sync.

This work is in preparation for https://github.com/dart-lang/sdk/issues/41538

This was reverted in https://dart-review.googlesource.com/c/sdk/+/149620
because flutter wasn't prepared for auto-enabling nnbd in dart:* libraries.
This has now been fixed in https://github.com/flutter/engine/pull/18714

Closes #42162

Change-Id: I686ed6feaef8ee066b426068fe2a0f5080bf1713
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149588
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-06-03 08:15:49 +00:00
Johnni Winther aec6a3529e Revert "[cfe] Embed and use allowed experiments in CFE"
This reverts commit a936f3019e as it broke
flutter hhh fuchsia build: https://ci.chromium.org/p/dart/builders/ci.sandbox/flutter-engine-linux/10876

Change-Id: I0a83e5edf8d53fc648a4f548529e456a5e6bcfc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149620
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-06-02 08:48:51 +00:00
Johnni Winther a936f3019e [cfe] Embed and use allowed experiments in CFE
This CL embeds the sdk_nnbd/lib/_internal/allowed_experiments.json
into the CFE and uses this to allow experiments enabled on a
per library basis. The file is embedded through generated code to
avoid reliance on access to the file itself.

A presubmit check is also added to ensure that the json file and
the generated code are in sync.

This work is in preparation for https://github.com/dart-lang/sdk/issues/41538


Change-Id: Ic03c0fc69684d124c685f2fe6e80423a7e751530
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149064
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-05-30 09:47:02 +00:00
Johnni Winther 6540f603d8 [cfe] Don't include member signature in id testing by default.
This prepares id testing for the unforked sdk where all Object
members add a member signature in the immediate opt-out subclasses
of Object.

Change-Id: Ife443582c4f88b6c8673aa560a700dbb88475c3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141600
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-03-30 08:42:25 +00:00
Jens Johansen a55fed2e5f [CFE] Get in line with update on which package description file to use
Fixes #40864

Change-Id: I681186660162c55e66c1deee68a4052de4cfcfe9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139201
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-03-12 11:33:52 +00:00
Jens Johansen a8c7757589 [CFE] Don't hard-code uncertain version numbers in messages or tests
Instead don't mention them (until they are certain), and make them
certain in tests, by setting a specific version (2.9999 in this case).

Change-Id: I1a375b4908c9d06f0241a6cda0746172d6b46c15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138285
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-03-04 14:35:05 +00:00
Johnni Winther 5829fc7829 [analyzer,cfe,dart2js] Add marker.options files to automate running id tests on all configurations
Change-Id: Ib5eb7f3967634721047f8dcc57b9e6c350b91a41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136226
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-21 08:34:26 +00:00
Johnni Winther 5e389080a4 [cfe] Test supertypes computed from ClassHierarchyBuilder
Change-Id: Ia079754bd8272d7b5689a3bdab1e69d5188082be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132342
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-22 07:08:36 +00:00
Johnni Winther 862d5012ae [cfe] Handle explicit opt-out in nnbd-not-enabled message
Closes #39835

Change-Id: I4ffa3377289f45b7ea909b5477ba53508040b9d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131076
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-01-15 10:30:43 +00:00
Johnni Winther e3a20bf361 [analyzer,cfe,dart2js] Support annotated code generation
Add support for generating annotations from actual data using
option -g

Change-Id: I88d9cdb62a38d579234b15097c9e9bb3d81ebe8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129708
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-03 13:57:39 +00:00
Paul Berry c4b6df5009 Move ID testing infrastructure into _fe_analyzer_shared.
Change-Id: I9f2692dbe750f3c31f8c86e86fe732f34e166517
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123860
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-11-01 12:39:00 +00:00
Vyacheslav Egorov 39e7da9ca4 [cfe] Fix ConstructorBuilder.prepareInitializers to refer to actual constructor.
Instead of referring to target constructor that is going to be patched.

Change-Id: Ic98146b69c9e5fbdcc13df86f3293f3d9d4462f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121328
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-11 18:44:18 +00:00