commit | bb524468ef8fada39f547b0353925c7a5a595ee3 | [log] [tgz] |
---|---|---|
author | Paul Berry <paulberry@google.com> | Thu Sep 28 03:37:01 2023 +0000 |
committer | Commit Queue <dart-scoped@luci-project-accounts.iam.gserviceaccount.com> | Thu Sep 28 03:37:01 2023 +0000 |
tree | 4d426430f0d3537925919e2429f80d8c096abcdd | |
parent | d95c6f4de6b43d1fd235a52f457bd6c200d1c967 [diff] |
Wire up "why not promoted" messages for failed field promotion due to conflict. Previously, when field promotion failed due to a conflict with another declaration in the same library, the client (analyzer or front_end) was responsible for returning a value of `PropertyNonPromotabilityReason.isInterferedWith` from `Operations.whyIsPropertyNotPromotable`. Flow analysis would propagate this value into a `PropertyNotPromoted` object whose `documentationLink` getter returned `null`. The client was then responsible for tracking down all the conflicting fields and getters and creating the appropriate context messages for them (but this functionality wasn't implemented yet). With this change, the `PropertyNotPromoted` is now abstract, with two subclasses to represent the two cases the client has to handle: - `PropertyNotPromotedForInherentReason` to cover the case where a property cannot be promoted due to the fact that it is inherently not promotable (i.e. it's not final, it's public, it's external, it's not a field, or it's in a library where field promotion isn't enabled). In this case the client simply has to generate the appropriate context message and attach it to the site where the property is declared, and it can rely on having access to a non-null `documentationLink` to include in the context message. - `PropertyNotPromotedDueToConflict` to cover the case where the property cannot be promoted due to a conflict with some other property in the same library. In this case the client has to generate multiple context messages, one for each conflicting declaration, and it has to associate each one with the appropriate documentation link from the `NonPromotionDocumentationLink` enum. The `NonPromotionReasonVisitor` base class has been updated to reflect this split, so that the logic for handling these two cases is in separate methods in the client. The front_end logic for handling non-promotion due to conflict is now fully implemented. The analyzer logic will be addressed in a follow-up CL, since it's more complex (it requires plumbing additional data through the summary file format). Finally, the nomenclature in the `FieldNameNonPromotabilityInfo` is adjusted to match the new context messages. Change-Id: Ieed70d1a3572abbc726ae34584d85c7a8aee0732 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327712 Reviewed-by: Johnni Winther <johnniwinther@google.com> Reviewed-by: Phil Quitslund <pquitslund@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
Dart is:
Optimized for UI: Develop with a programming language specialized around the needs of user interface creation.
Productive: Make changes iteratively: use hot reload to see the result instantly in your running app.
Fast on all platforms: Compile to ARM & x64 machine code for mobile, desktop, and backend. Or compile to JavaScript for the web.
Dart's flexible compiler technology lets you run Dart code in different ways, depending on your target platform and goals:
Dart Native: For programs targeting devices (mobile, desktop, server, and more), Dart Native includes both a Dart VM with JIT (just-in-time) compilation and an AOT (ahead-of-time) compiler for producing machine code.
Dart Web: For programs targeting the web, Dart Web includes both a development time compiler (dartdevc) and a production time compiler (dart2js).
Dart is free and open source.
See LICENSE and PATENT_GRANT.
Visit dart.dev to learn more about the language, tools, and to find codelabs.
Browse pub.dev for more packages and libraries contributed by the community and the Dart team.
Our API reference documentation is published at api.dart.dev, based on the stable release. (We also publish docs from our beta and dev channels, as well as from the primary development branch).
If you want to build Dart yourself, here is a guide to getting the source, preparing your machine to build the SDK, and building.
There are more documents on our wiki.
The easiest way to contribute to Dart is to file issues.
You can also contribute patches, as described in Contributing.