Commit Graph

159 Commits

Author SHA1 Message Date
Brian Wilkerson 587cbed231 Convert the completion metrics tool to use candidate suggestions
The tool was previously using the old implementation, which is now only
used by the Cider support. As a result, it wasn't providing valid timing
measurements for the new implementation. That's been fixed.

The map/reduce functionality is not yet supported, but it's also rarely
used. There's some information missing, but most of the functionality
works as expected, and I'd like to tackle the rest in a separate CL
(though I don't know exactly when I'll get to it).

Change-Id: I98150c1d5273a8ffaccf7858f9588e52e11636c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444183
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-08-07 09:03:20 -07:00
Fedor Shcheglov 1a88edceb7 Deprecate redirectedConstructor2, superConstructor2, children2, displayString2, getExtendedDisplayName2, isAccessibleIn2, thisOrAncestorMatching2, thisOrAncestorOfType2, constants2, field2, typeParameters2, children3, asInstanceOf2, instantiateInterfaceToBounds2, and instantiateTypeAliasToBounds2.
Change-Id: I82004d5d1c758aae51ec8c97645aa53ed8cc52bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439383
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-07-09 07:13:51 -07:00
Fedor Shcheglov 247ae2364f Deprecate Element.name3, use name instead.
Change-Id: I24a5e4a519b9f3bf755912f21a5c192edd1dd4ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439381
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-07-08 14:13:49 -07:00
Fedor Shcheglov ab49c6e912 Deprecate getters and methods within analyzer/lib/src/dart/ast
Change-Id: I100b713897275e0a76bca5e669f73786a2a94ab5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437641
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-06-30 14:28:51 -07:00
Fedor Shcheglov 1400bd0a04 Deprecate type_provider's getters ending in 2, and rename TypeProviderImpl.functionElement2 to functionElement.
Change-Id: Iac9659aaed0dcd92e4cf13f9859dea2bf7b47f47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437582
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-06-27 17:53:00 -07:00
Fedor Shcheglov ade10f4afb Deprecate 'Element.library2', use 'library' instead.
Deprecate `LibraryElement.loadLibraryFunction2`, use `loadLibraryFunction` instead.


Change-Id: I117fb182e6bb62c1a76b3d578c0a6d4b6f32b9c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435920
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-24 17:23:11 -07:00
Fedor Shcheglov 318aeb322b Deprecate DartType.element3, use element instead.
Change-Id: Idef9da09c565a05fa84869f7433df3c24c6fbb5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435521
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-06-24 07:23:11 -07:00
Sam Rawlins 5c7cb4fdbd analyzer: Deduplicate some code around lists of diagnostics into shared helpers
Change-Id: I233977c08c071c6280b2eefc086f3f6fb2964a54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433640
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-10 09:47:42 -07:00
Sam Rawlins 7b42aae99f analyzer: Deprecate AnalysisResultWithErrors.errors in favor of .diagnostics
Also rename UnitAnalysisResult.errors (package-private API) to .diagnostics

Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: I0bdd7c9c19cff3bff9ee61fe4689564a7b5b727b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433581
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-09 15:51:01 -07:00
Sam Rawlins b2beba242d analyzer: Convert callers of InheritanceManager3 to use InterfaceElement API
This includes all callers in analysis_server and analyzer_plugin. And
callers of `getOverridden4`.

Change-Id: Ia744f6c7260b445c6b1e02d3cf5515aaa9c7feeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432962
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-04 16:30:22 -07:00
Konstantin Shcheglov 05da3e1f22 Elements. Deprecate Element.enclosingElement2, use enclosingElement.
Change-Id: I055b1f9dd1c00605d813effcbbadb9cea874129a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-05-15 13:47:32 -07:00
Konstantin Shcheglov 7eea262f06 Deprecate NamedType.name2, use 'name' instead.
Change-Id: I27725e1530c60a6aa2e197b97e027de1238c964a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427980
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-12 08:35:59 -07:00
Sam Rawlins eb03a1673d DAS: Use Diagnostic in place of deprecated AnalysisError
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: I0107a65580bc41d769c2a384319225b256df2fbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426420
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-05 09:35:18 -07:00
Sam Rawlins 4ef2725654 Add an analyzer_testing package
We intend to publish and maintain this as a set of testing-related
utilities for the analyzer packages and for analyzer plugins.

Work towards https://github.com/dart-lang/sdk/issues/55660

See the doc: https://docs.google.com/document/d/1jRtd8B1ijPAP6Pz89HRnyIZXw2VMjaZx0vRZTpoNO84/edit?tab=t.0#heading=h.2sz41a544qhi

Change-Id: I2764b1357a932fa955060b26d78038997eaa9536
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425080
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-05-02 06:58:49 -07:00
Konstantin Shcheglov b2fdd8a345 Elements. Rename XyzElement2 into XyzElement.
The CL was done with rename + adding typedef for each class.

Change-Id: Ia25cc581d2e42cf7d12a85a3579af952d5c232ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424687
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-04-25 13:27:18 -07:00
Konstantin Shcheglov 49599e06cc Elements. Deprecated element2.dart library.
Change-Id: I2be38df49e6f242d9fe59f34164549da4a0f41b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424683
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-04-25 11:23:18 -07:00
Danny Tuppeny 216eb0bef0 [analysis_server] Migrate some tests from indexOf() to TestCode.parse()
See https://github.com/dart-lang/sdk/issues/60234

Change-Id: Ia5c110b40088982368512688195d70c2b51a2d50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421121
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-04-08 09:59:44 -07:00
Sam Rawlins 5d1f4876ee DAS: Fix many non_constant_identifier_names violations
This lint rule is a core lint rule; we have suppressed it only for
pre-existing code reasons.

There are a few individual files which simply have a consistent pattern
of including underscores in some names, so I add inline ignores there.

Change-Id: I89e6010203868fc10fda12b15353de41881d9b15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416900
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-03-20 09:00:06 -07:00
Brian Wilkerson 5454e70ce2 [migration] Rename utilities in protocol_dart.dart
Change-Id: I90c06dffcac98bc8ec6bb2a982a6825157eda56d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407620
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-02-03 16:32:40 -08:00
Konstantin Shcheglov 8eb24f0724 Elements. Make 'get library2' non-nullable in more places.
Change-Id: I0f9a27ce61367826fb1a1af3969cef0014639a31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398740
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-12-04 20:13:12 +00:00
Keerti Parthasarathy 44a8f14932 [Elements.migrate] Migrate FeatureComputer
Change-Id: Iff5c9cffd676464454460ca2a51cdd7cd0e1d507
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397040
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-22 22:21:29 +00:00
Konstantin Shcheglov 359aa743ff Elements. Add LibraryElement2.uri
We used it often enough, and the question "what is the URI of the library" makes sense.

Change-Id: I58baebd7b32154ae7a2f90770e4edcade8a49a63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-15 21:52:00 +00:00
Sam Rawlins 73443c8603 DAS: Generated protocol 'enums' can be real enums
File sizes are reduced:

```
analysis_server_client's protocol_common.dart    - 132k -> 102k (-23%)
analysis_server_client's protocol_generated.dart - 453k -> 433k (- 4%)
analysis_server's        protocol_generated.dart - 528k -> 509k (- 3%)
analyzer_plugin's        protocol_common.dart    - 139k -> 108k (-22%)
```

Change-Id: I8018f1d09e053c9d3df340ba31cdb07cbd29acf7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392842
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-11-07 17:27:18 +00:00
Sam Rawlins fbf331e0dd DAS: reformat source code with tall-style
Change-Id: I42b4a44fd6a2197e499e8623274b3cd1a4b5556f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394003
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-06 23:04:00 +00:00
Konstantin Shcheglov 3af9430ebf Elements. Separate Element2.name from Element.name by renaming to 'name3'.
They were intersecting at ElementImpl and Member(s).

This will unblock updating implementations to make them nullable.

Change-Id: Ic9907eaa0ef08c096839f212668fa1e3d92bbf3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391540
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-23 15:53:40 +00:00
Konstantin Shcheglov 15ab56922e Elements. Make more Element2.name nullable.
For example `MethodElement2.name`, for code:

```
class A {
  () {}
}
```

Change-Id: Id023d6641d2d3685bf8e2d381aab055365e687d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391207
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-22 17:16:29 +00:00
Brian Wilkerson 83dc895d18 Migrate the remaining files in server's tools directory
Change-Id: I8388cde7fc9f7904324b41a3fff31cec88e42a6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390804
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-18 17:03:00 +00:00
pq fe66b2d525 [cq] move flutter extension to analyzer
Making this available in analyzer will allow me to de-dup a bunch of similar logic in the linter...

Change-Id: Id9991eb3b3a11fed4eff596302beffb814ba86bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-16 17:24:56 +00:00
Konstantin Shcheglov 8de1422a0e Parts. Deprecate Element.enclosingElement, use enclosingElement3.
Change-Id: Iadc4ed02d4bda3b882e65dc6f4d263a6a938e0fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382920
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-01 18:50:29 +00:00
Danny Tuppeny 916272331b [analysis_server] Remove the singleton uriConverter and pass explicitly to all toJson/fromJson methods
This avoids accidentally using the converter when talking to plugins, (at least for now) URIs are never expected, and file paths should always be used regardless of which mode the server is in.

This unfortunately touches a _lot_ of code, so I've pushed in many separate patch sets to Gerrit.

Fixes https://github.com/Dart-Code/Dart-Code/issues/5156

Change-Id: I312c3e2cbc35a05a078aaa0138aec7288b3c7dd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373745
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-07-02 14:15:11 +00:00
Brian Wilkerson b0dabf03da Fix a bug in the completion metrics tool
Change-Id: I890fbc5ca722f839b7e375ba4fbc41700c629566
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372521
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2024-06-20 18:10:59 +00:00
Brian Wilkerson 45835b0933 Use the max number of suggestions to limit the number of candidate suggestions being retained
Change-Id: I4a60569fb4efe4af576b9adbb375c6e2e0b1727c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370720
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2024-06-11 17:03:05 +00:00
Konstantin Shcheglov 017bed7b9a CQ. Enable unnecessary_final in analysis_server/
Change-Id: Ieb62a1c774a5e8f5a22deaa8e8e5fff6f9f849dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366960
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-05-16 21:20:28 +00:00
Konstantin Shcheglov 5c07c89a35 Enable 'unnecessary_final' in analysis_server/.
Change-Id: I71ee934b915d4aff924cf5925f87bcc9adc6c015
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362901
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-16 20:04:15 +00:00
Sam Rawlins cda4f034ed DAS: Extract static code from static class Flutter.
Most methods are refactored as extension methods. Some unused ones are deleted.
Some are inlined into their call sites.

Change-Id: I47826fd3241db86526efa2ee410990a0fc7be702
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362300
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-04-12 19:28:54 +00:00
Konstantin Shcheglov 5543d88289 AE. Deprecate OnClause, use MixinOnClause instead.
Change-Id: I938a1ff4046851c46c6ae4cebdff25e05e88300f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360741
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-02 23:02:22 +00:00
Konstantin Shcheglov c5f876b7aa Augment. Use ExtensionOnClause in ExtensionDeclaration, make it optional.
Change-Id: I696ffd0b8e8f3bf9017b583d480313ec7c7753f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360561
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-02 16:12:00 +00:00
Konstantin Shcheglov 22873be577 Completion. Benchmark for continuously asking completions.
Useful to focus on measuring performance of computing suggestions
only, without any overhead of resolution, protocol conversion, etc.

To be run as is, or with `--observe:xxxx` to see what to optimize.

You need to supply your own Flutter checkout.

Change-Id: Ie143b4ec9c24e05a0de2a14c1b8f0e1c20ef3a8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358222
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-18 22:56:10 +00:00
Konstantin Shcheglov d918ac16b3 Completion. Cache 'inConstantContext' value.
For package:collection, computing measures.

Before: 0:01:00.236000
After:  0:00:55.977000

So, about 7% faster.
I think this translates into actual completion speed up.

Change-Id: I45f0c0186d5988e6e1b043d465030668cd61335b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357982
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-15 20:38:36 +00:00
Konstantin Shcheglov 94abcc81ab Completion. Use CompletionSuggestionBuilder in completion metrics, faster.
For sdk/pkg/analyzer_cli

Before: 0:01:32.542000
After:  0:00:33.254000

So, about 3 times faster.

Change-Id: I8eae44eeefd5624f88a42fe37b8ae1c29427ee49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356310
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-15 19:08:23 +00:00
Konstantin Shcheglov 8705a06e21 Completion. Remove localVariableDistance(), and usage in RelevanceDataCollector.
Change-Id: I4ad00d1820fa996dac0abdb13649418a2fa97ed4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356121
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-07 22:04:18 +00:00
Konstantin Shcheglov 8968e5500a CQ. Enable avoid_redundant_argument_values in analysis_server/
Change-Id: If9c09f81bdbac890553573a8491ca27cb4f22dd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353805
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-26 19:51:41 +00:00
Konstantin Shcheglov 14a1045f16 Legacy. Deprecate 'withNullability' in getDisplayString() methods.
Change-Id: I688f230f4189cd1fc600e4d34f07f339111c382d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350645
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-07 01:25:38 +00:00
Sam Rawlins aad9e57674 Revert "Revert "[analyzer] new warning for nullable '==' parameter type""
This reverts commit 885457e1d3.

[analyzer] new warning for nullable '==' parameter type

This rule checks that a parameter to an `operator ==` implementation has
a non-nullable type.

I intentionally did not enforce, in this rule, that the parameter is
exactly `Object`. It is legal to narrow the parameter type to a
different non-nullable type, like `int`. I can't imagine doing it, but
it seems to be unrelated to whether the type should be nullable or not.

Fixes https://github.com/dart-lang/linter/issues/3441

Replaces https://github.com/dart-lang/linter/pull/3923

Change-Id: Ic0be2bfebaf59b0336e9a3a58e5b7f5359eb8646
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291042
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-12-14 23:58:12 +00:00
Sam Rawlins eeb3ecb599 analyzer: Convert Flutter (utilities) into a static class.
This was a utility class with absolutely zero state. It almost protected
against unnecessary instantiation by providing a static `instance`
member, but the constructor was still public. Also, the instance was
passed around various objects as an instance field, even allowing for
the static instance to be nullable in a few cases. All of this can be
prevented by making the class `abstract final`, with all of its members
static.

(An argument can be made that all of the code in here could be made
top-level functions, but I'll leave that for a later refactoring, if it
is desired. Also the functions could be made into extension methods, but
many of them rely on promotion of a parameter, so until we get `this`
promotion in extensions, I won't advocate for that change.)

The main reason I was looking at this was to get Flutter out of `_AbstractCorrectionProducer`, so that we don't have to drag the flutter utils into analyzer_plugin (we still can if we want to, but we won't _have_ to).

I also modernized the code, following Effective Dart:

* https://dart.dev/effective-dart/documentation#do-start-doc-comments-with-a-single-sentence-summary
* https://dart.dev/effective-dart/documentation#do-separate-the-first-sentence-of-a-doc-comment-into-its-own-paragraph
* https://dart.dev/effective-dart/documentation#prefer-starting-function-or-method-comments-with-third-person-verbs
* https://dart.dev/effective-dart/documentation#prefer-starting-a-boolean-variable-or-property-comment-with-whether-followed-by-a-noun-or-gerund-phrase

Change-Id: I0d1896ae2d45a31e00f8a824e92d173469cc7eea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340301
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-12-07 02:03:26 +00:00
pq 440ea59ee0 enable flutter_style_todos in server
Change-Id: I4921d538e1498e66c8cab2d84dfcad21d1a7b555
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335952
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-11-14 21:08:12 +00:00
Brian Wilkerson 4963955276 Finish converting the KeywordContributor
Change-Id: Ifa5100c6458f1a91f492223b261bcd53f23e847f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327560
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-09-25 22:07:56 +00:00
Danny Tuppeny ec0dc8fe55 [analysis_server] Handle annotations + default to new protocol for completion metrics tool
Change-Id: I57c8f077ccc853ae7ece44c776e16e0f30401a66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325820
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-09-13 17:47:35 +00:00
Konstantin Shcheglov 508a293029 Revert a few not published API changes.
Change-Id: I093c3d3f6e221cfe874e82b598f52087670ce24e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318020
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-04 19:21:58 +00:00
Konstantin Shcheglov 8828fee865 Deprecate ExecutableElement.returnType, use returnType2 instead.
Change-Id: Ibd29c3fbec0439236c2cf45c57f820c45427df9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311932
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-29 23:16:59 +00:00