Commit Graph

12428 Commits

Author SHA1 Message Date
Konstantin Shcheglov 00a3cdff40 Elements. Remove FragmentDeclaration, add 'declaredFragment' to Declaration.
Change-Id: I33398358d1241114b04995767d63188bb314fd6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394565
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-11 23:39:29 +00:00
Konstantin Shcheglov 0df705aafb Elements. Don't store 'InstanceElementImpl2.methods', build from 'methods2'.
Change-Id: I5804fe3f0b246bf8184c06d6ca05763c751e6139
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394563
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-11 23:10:48 +00:00
Konstantin Shcheglov 8a5862ae66 Elements. Remove FragmentedElement.
Change-Id: If73caa44e64f469a16646794f96be044ad25d33f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394561
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-11 20:58:49 +00:00
Konstantin Shcheglov f33de62674 Elements. Build more Element2 objects.
Change-Id: I1856610e12c19c2e0fb502fbc324b562cbbe0006
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-11 20:53:14 +00:00
Danny Tuppeny 613bfa673f [analysis_server] Add a custom LSP handler to fetch editable arguments for the invocation at a position
This currently only supports int, double, boolean, string.

Change-Id: I236db8594907d28dc5901a384fbafdb34f243528
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394160
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
2024-11-11 15:38:42 +00:00
Johnni Winther 4177d28464 [_fe_analyzer_shared] Support deferencing of StaticGet
This adds support for replacement a [StaticGet] with the constant
initializer of the referenced constant during evaluation of macro
metadata. Currently constants defined in the same library or
compilation is supported. For full support the constant initializers
need to be included in the outlines/summaries.

Change-Id: I219f85dded63342d4e3f957f0b7321badbe376a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392907
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2024-11-11 07:04:20 +00:00
Konstantin Shcheglov a9ceaf4d6c Elements. Use more 'asElement2' in InheritanceManager3.
Use '.asElement' to map InterfaceElement2 into 'InterfaceElement'.

Add and use `mapValue` extension method.

Change-Id: I63eb5401d33a696c688a522b463434ef5f3f8ed9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394322
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-11-08 23:20:38 +00:00
Konstantin Shcheglov e7aaba1254 Elements. Migrate OverrideHelper.
Change-Id: I645d901fd0655c33c0c147c2b08a67b4791e6186
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394360
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-08 23:05:39 +00:00
Brian Wilkerson 15cdbc5eab Migrate five correction producers
Change-Id: I3289e0862797947fadf76d78a2ce27c0cf249dd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394321
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-11-08 21:08:18 +00:00
pq 25f8cc52a6 [element model] migrate unreachable_from_main
Bug: https://github.com/dart-lang/linter/issues/5099
Change-Id: I31ee1aff4cbca63b8b66d6fe31a6e901d104fa71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394005
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-11-08 21:04:49 +00:00
Danny Tuppeny 7b8de02eda [analysis_server] Update "Go to Imports" to support enhanced parts
Instead of looking in a single root unit, we now look in each unit up the tree.

Change-Id: I59b0692438dd73fce7be7790ddc24240761d72c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394200
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-11-08 20:02:14 +00:00
Konstantin Shcheglov 73e13d7c79 Elements. Store classes / enums / etc directly in LibraryElementImpl.
Add them when building or reading.

Change-Id: I11b57f28c4803f7e60d280d6fd4a925b0c46fb60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393908
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-08 19:19:49 +00:00
pq c38244e7b6 [element model] migrate void_checks
Blocked until `ExpressionImpl.correspondingParameter` properly handles members.

Bug: https://github.com/dart-lang/linter/issues/5099
Change-Id: Ia97283f8fcf9873a9a8e2e4dc319c1c5c89ffc4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392982
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-11-08 19:04:25 +00:00
Konstantin Shcheglov 39e5e0fdac Elements. Add DynamicElementImpl2, make DynamicElementImpl its fragment.
Change-Id: I1d88f84f59d2ebdf7e0a5bc3b54d2145b0cb42b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394241
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-08 17:31:26 +00:00
Chloe Stefantsova 41db3ab735 [analyzer][cfe] Share constraint generation for record types
Part of https://github.com/dart-lang/sdk/issues/54902

Change-Id: I90ac37472e14f9d00ef5e7d20a41f2878fb2b8f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393100
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2024-11-08 13:12:55 +00:00
Brian Wilkerson 365941b268 Document some lint diagnostics
Change-Id: I38ba6f77a7d25e3f4716c2b2432b790c973c5650
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390303
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-11-08 00:49:18 +00:00
Konstantin Shcheglov f35cbc95e3 Elements. Add NeverElementImpl2, make NeverElementImpl its fragment.
Change-Id: I3ef636dec6a678e30c44f0551276a8b3557a7641
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394240
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-11-07 22:58:46 +00:00
Konstantin Shcheglov 0b22187189 Issue 57043. Fix infinite FileKind recursion when part references itself.
Bug: https://github.com/dart-lang/sdk/issues/57043
Change-Id: I8bde1d5f6b1d2eb9bd3e42ec74261d492e9303e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393906
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-07 22:08:39 +00:00
Konstantin Shcheglov ea86e0fe39 Elements. Return nullable 'LibraryFragment?' from 'get libraryFragment'.
We can have synthetic 'FormalParameterFragment' and 'TypeParameterFragment'
that don't have any enclosing 'LibraryFragment'.

Change-Id: Icc1a47c308e55b93ed6a2aad70788058e26ee803
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-07 21:59:29 +00:00
Konstantin Shcheglov 3e6e13dee8 Element. Implement MultiplyDefinedElement2 and MultiplyDefinedFragment.
Bug: https://github.com/dart-lang/sdk/issues/57041
Change-Id: I4272137f6b48dfa784d23d0f9fc206b3bad12819
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-07 20:54:49 +00:00
Konstantin Shcheglov 895d0b1377 Elements. Write LibraryFragment.enclosingFragment, fix it.
Change-Id: If25d812e3e0bb279bb6baabb126fe1c0339283d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394007
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-07 20:54:38 +00:00
Kallen Tu 8b3c5aa8f5 Add experiment flag for enum shorthands.
This CL adds an experiment flag named `enum-shorthands`. We can start prototyping the work needed for the feature under the flag.

Bug: https://github.com/dart-lang/sdk/issues/57037
Change-Id: I5d5e679b20f993e0af59ce5b2d28e47269ecaedb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393521
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2024-11-07 20:42:41 +00:00
Sam Rawlins 082c71062b analyzer: Move enableTiming out of AnalysisOptionsImpl to AnalysisDriver.
It has seemed disingenuous to me that `enableTiming` has been a
property of AnalysisOptionsImpl, when it cannot be specified in an
analysis options file. Additionally, it is used in exactly _one_
place: the linter package's `benchmark.dart` script.

Instead, it makes more sense to think of this "flag" as a process-wide
flag. It is not something that may be set one way for some files, and
another for another set of files. And it is not something that can be
set to one value early during an analysis process, and then change; it
never changes.

So instead this change makes it a _final_, _private_ field on
AnalysisDriver, and on LibraryAnalyzer. LibraryAnalyzer gets its value
from AnalysisDriver, and AnalysisDriver gets its value from the
AnalysisContextCollectionImpl constructor.

Change-Id: I347605775680a8ea1c1237f0ee20bd4bbe2c6216
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393961
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-11-07 18:49:01 +00:00
Sam Rawlins e7c0452249 analyzer: Privatize YAML validation classes
Change-Id: I2703c01736f3b3ae74a33474551d6ebfe282cf13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393942
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-11-07 18:44:29 +00:00
Konstantin Shcheglov 2726227a34 Elements. Add ConstructorFragment.typeName and typeNameOffset.
Change-Id: I62f82e96fc14cfd601ed87fefd932d84412186c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394002
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-11-07 18:36:18 +00:00
Sam Rawlins b082a8e1d6 analyzer: ContextBuilderImpl.createContext sdkPath is required
Change-Id: Ie510b5af0e26ce407dfab590c01cc31ee73a341c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393962
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
2024-11-06 20:57:19 +00:00
Konstantin Shcheglov 09550b33fc Issue 57035. Fix for exception when asking class alias constructors.
Bug: https://github.com/dart-lang/sdk/issues/57035
Change-Id: I48aa20815b56c49f08e22509126f74891e694644
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393960
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-06 20:24:39 +00:00
Sam Rawlins e66a8a4fa3 analyzer plugins: parse version and path keys in YAML
This enables plugin sources to be specified in one of three ways:

* as a YamlScalar, like `plugin_name: ^1.2.3`
* with a 'version' key, like `plugin_name:\n  version: ^1.2.3`, which
  allows diagnostic configurations to be alongside.
* with a 'path' key, like `plugin_name:\n  path: foo/bar`, which
  allows diagnostic configurations to be alongside.

We introduce a PluginSource with a `toYaml` method to convert the
values back into YAML for the generates pubspec. We update
PluginPackageGenerator to use PluginSource.toYaml.

Change-Id: Ic5f372f0339edd6aa638dd9b568a83f41a023b08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393900
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-06 19:41:00 +00:00
Robert Nystrom 732b07a42b Roll dart_style into the SDK.
I'm still chasing down a couple of google3 failures, but this is ready for review so that I can get it approved and land it once the last couple of failures are fixed. Here is who I think should review what:

athom@ for:

- DEPS

johnniwinther@ for:

- pkg/_fe_analyzer_shared
- pkg/front_end
- pkg/kernel

brianwilkerson@ for:

- pkg/analysis_server
- pkg/analyzer_plugin
- pkg/analyzer_utilities

kenzieschmoll@ for:

- pkg/dartdev

pquitslund@ for:

- pkg/linter/lib/src/lint_codes.g.dart

If you're not the right person, feel free to summon someone else.

Most of the changes here are re-running code generators that auto-format the code they generate. The changes are:

Roll in the latest dart_style commit:

- DEPS

Manually updated these test expectations to expect the new style:

- pkg/analysis_server/test/lsp/format_test.dart
- pkg/analysis_server/test/services/refactoring/agnostic/change_method_signature_test.dart
- pkg/analysis_server/test/src/domains/flutter/set_property_value_test.dart
- pkg/analysis_server/test/src/services/flutter/container_properties_test.dart
- pkg/analysis_server/test/src/services/flutter/widget_descriptions_test.dart
- pkg/analysis_server/test/src/services/refactoring/convert_selected_formal_parameters_to_named_test.dart
- pkg/analysis_server/test/src/services/refactoring/move_selected_formal_parameters_left_test.dart

This was auto-generated by something, but I'm not sure why it thinks there is a diff:

- pkg/analyzer_plugin/doc/api.html

Updated to require a version of dart_style that accepts a language version in DartFormatter():

- pkg/analyzer_plugin/pubspec.yaml

Updated to always use the latest language version (and thus new style) when invoking the formatter:

- pkg/analyzer_utilities/lib/tools.dart

Manually updated the formatting in the code templates so that they matched the formatting expected by the tests, which implicitly format using the latest language version:

- pkg/dartdev/lib/src/templates/...

The rest are all generated files that are formatted so re-generated using the new style:

- pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart
- pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
- pkg/analysis_server_client/lib/handler/notification_handler.dart
- pkg/analysis_server_client/lib/src/protocol/...
- pkg/analysis_server/lib/protocol/protocol_generated.dart
- pkg/analysis_server/test/integration/support/integration_test_methods.dart
- pkg/analysis_server/test/integration/support/protocol_matchers.dart
- pkg/analyzer_plugin/lib/protocol/...
- pkg/analyzer_plugin/test/integration/support/integration_test_methods.dart
- pkg/analyzer_plugin/test/integration/support/protocol_matchers.dart
- pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart
- pkg/analyzer/lib/src/dart/error/...
- pkg/analyzer/lib/src/error/codes.g.dart
- pkg/analyzer/lib/src/manifest/manifest_warning_code.g.dart
- pkg/analyzer/lib/src/pubspec/pubspec_warning_code.g.dart
- pkg/analyzer/lib/src/summary/format.dart
- pkg/analyzer/lib/src/wolf/ir/ir.g.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/less_simple/lib_000_1.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/less_simple/lib_001_0.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/less_simple/lib_010_0.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/less_simple/lib_100_0.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/simple/...
- pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
- pkg/front_end/lib/src/codes/cfe_codes_generated.dart
- pkg/front_end/lib/src/util/parser_ast_helper.dart
- pkg/front_end/test/parser_test_listener.dart
- pkg/front_end/test/parser_test_parser.dart
- pkg/front_end/testcases/...
- pkg/kernel/lib/src/coverage.dart generated
- pkg/kernel/lib/src/equivalence.dart generated
- pkg/linter/lib/src/lint_codes.g.dart

Change-Id: Ice0141b763e63b84f54692cd19a442a0719673c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391263
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-11-06 18:42:25 +00:00
Konstantin Shcheglov 03ad365274 Elements. Use firstFragment in TypeParameterElementImpl2 instead of wrappedElement.
Change-Id: Idf049d7f76d2c197bb6a98063bb7dd2a13c806aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393763
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-06 17:04:39 +00:00
Konstantin Shcheglov 4f20171f69 Elements. Use more impl in impl and tests.
Change-Id: Ibef3504c701fa3f37eb9078058113d8e44f05f04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393585
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-06 16:51:02 +00:00
Sam Rawlins 1d947cedd2 Add new plugins to analysis options signature
Change-Id: Ia8600dfb33e8c65573d92b8643398488037ea63a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393602
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-11-05 21:02:59 +00:00
Konstantin Shcheglov 53bf3ff846 Elements. Rename to ClassElementImpl2, etc.
Change-Id: I94119f60b5bf01e52cf348a7c67f2b4a5ba62900
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393583
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-05 18:42:21 +00:00
FMorschel 9d340db3e6 Fixes import prefix hover text as code
R=srawlins@google.com

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

Change-Id: I37fa39f385dd26dfcf55c024b9ca331ec83381f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393382
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-11-05 18:10:19 +00:00
FMorschel 6eda5e2019 [DAS] Fixes add const for final variables and lint
R=srawlins@google.com

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

Change-Id: I75dd2c0063ea5d3a6ebbf4afb734d2cb5d98c1d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392860
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-11-05 15:48:00 +00:00
Konstantin Shcheglov 19cac1c907 Elements. Remove 'normalParameterNames' and 'optionalParameterNames' from FunctionType.
Change-Id: I934dca9f635411b71add032a3fc607dddf7de11a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393362
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-04 23:58:32 +00:00
Sam Rawlins 0ed2082654 analyzer plugins: change rules options key to diagnostics
Also allow warning diagnostics to be disabled.

In many places, the RuleConfig is unchanged because currently the
`linter/rules` section parsing is shared with the `plugin/<plugin-name>/diagnostics` section parsing.

They will probably diverge at some point, but as long as they are the
same, we can use the same Registry class to identify enabled and
disabled rules/diagnostics.

Change-Id: I9c00770af14d3b753532bcf1bc6bff62624d99ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393460
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-11-04 23:50:29 +00:00
Konstantin Shcheglov 4f6b07c25e CQ. Remove available declarations.
Bug: https://github.com/dart-lang/sdk/issues/55281
Change-Id: Ie8d2a7f3d5ea9408320312d49eb67561ca463289
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393480
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-04 21:30:08 +00:00
Konstantin Shcheglov c054056146 Elements. Lint. Disallow 'declaredElement' from src/dart/element/element.dart
Also enable the lint for analyzer/.

Change-Id: I2c9e61c6427f5e59b936f1ee7f5f94d4584f2988
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392851
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-11-04 20:59:51 +00:00
Paul Berry 6ef2dbcb71 Introduce ExtensionResolutionResult for use by ExtensionMemberResolver.
Previously, `ExtensionMemberResolver` used `ResolutionResult` to
return its results. This created unnecessary complexity, because
`ResolutionResult` needs to be able to represent a lot of resolution
results that aren't possible when resolving extensions (references to
`Function.call`, references to record fields, and various complex
error reporting scenarios). Conversely, `ExtensionResolutionResult`
needs to be able to represent some scenarios that arent relevant when
doing non-extension resolution (extension lookup resulting in no
result or an ambiguous result).

Splitting into two classes makes both classes simpler.

In a few cases, code needs to be able to handle either a
`ResolutionResult` or an `ExtensionResolutionResult`; for these cases,
I've added a common base class `SimpleResolutionResult`.

This change paves the way for some clean-up work I'm doing on
`TypePropertyResolver` (which uses `ResolutionResult`).

Change-Id: I205251e43d7263cd2df7c729d1550dbb55980f62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393442
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2024-11-04 19:49:23 +00:00
pq 6523606849 [element model] fix unsafe member to ExecutableFragment cast
Fixes: https://github.com/dart-lang/sdk/issues/57022

Bug: https://github.com/dart-lang/sdk/issues/57022
Change-Id: Icb00f89089565679109b749d1a43d95f4c8b09b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393401
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-11-04 18:47:40 +00:00
Konstantin Shcheglov 4096db4d51 Elements. Create loadLibrary() function with reference, lazily.
Related to https://dart-review.googlesource.com/c/sdk/+/393164

Change-Id: Ia448ff42c9de538be9a8f6f2101dff0c949671d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393260
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-11-04 17:19:46 +00:00
Konstantin Shcheglov 1a0273672a Elements. Build TopLevelFunctionElementImpl during building elements.
Give it a reference.

Change-Id: Ie1189a18e9d2794d37e530cbbb01ddd86b78a16e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393164
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-01 22:21:00 +00:00
Konstantin Shcheglov caf3c82f59 Elements. Put element into builders.
Change-Id: Ieb8dbd09783a805e2b67d1bfcb3ace580825f5e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393180
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-01 20:10:42 +00:00
Konstantin Shcheglov a868303290 Elements. Remove FragmentName, inline as name2 / nameOffset2.
Change-Id: If238cd71867501a39e243261228d137f925db1dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392741
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-01 18:56:26 +00:00
Brian Wilkerson 06207a74fa Make ParameterMember implement FormalParameterElement
Change-Id: Ibaa74894099e0c8f9e71409f19b8372362c5d728
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393045
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-11-01 18:45:22 +00:00
Sam Rawlins 784af8f704 DAS plugins: track lint rule configuration by name
* PluginConfiguration.ruleConfigs is now a Map instead of a List,
  mapping analysis rule names to each RuleConfig. This makes it more
  straightforward (and theoretically more performant) for the Registry
  to determine the set of enabled analysis rules. The primary parsing
  code, `parseLinterSection`, also returns a mapping now.
* This merges seamlessly into `AnalysisOptionsImpl`'s call to
  `parseLinterSection`.

This is most of the refactoring work found in
https://dart-review.googlesource.com/c/sdk/+/392981, but without the
change to allow warnings to be disabled.

Change-Id: I4d1e6791da83ad370c18a15e9e3bb85b1daed58d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-11-01 16:28:30 +00:00
Konstantin Shcheglov c17dd356c1 CQ. Remove most of DeclarationsTracker.
Keep only enough to support DartdocDirectiveInfo.

Change-Id: I228d771b866bd7f0a903b62064f058c9edd04bee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393020
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-01 15:07:48 +00:00
Konstantin Shcheglov 2d0eedc100 Elements. Keep only AugmentedInstanceElementImpl and subclasses.
Having single implementation of `ClassElement2` (and other elements like it) makes the implementation easier now, and simplifies future changes.

Change-Id: Ifd38a8738fff99b7ac0b387140fdd623be18be01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-01 14:58:14 +00:00
FMorschel 5e6a681445 Fix hover import prefix
Fixes https://github.com/dart-lang/sdk/issues/32735

Change-Id: I6830b61fe554065f9ec6e87f2ac24dfaffd67f35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390960
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
2024-11-01 14:16:58 +00:00