Many fields in this class are initialized in the class body, which is
unfortunate but seems necessary. However, such fields can often be
marked final, which makes the life cycle of such fields more clear:
contextManager, analysisDriverScheduler, pubPackageService.
Also, searchEngine can be a late final field wtih an initializer.
The analysisPerformanceLogger field is unused outside of the
constructor body in which it is declared; can be deleted.
isFirstAnalysisSinceContextsBuilt can be made private.
`_getByteStorePath` is also moved out to be an extension getter; it was
an instance method, but only uses the one OverlayResourceProvider.
Logically the function is just extracting a value from an
OverlayResourceProvider.
Change-Id: Ib08693ef16221560a1f14279725d9d44f9f5f99c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Usually when adding arguments, we'd always put them at the end. However there is convention (and a lint) for putting child/children last - so if the arguments in the last position are child/children, we should insert before them.
Change-Id: Ia0e0cd6b10f16cef30aa0cfe4fdedecc223f08c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403584
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Originally we put those with arguments first so that in the property editor they'd be at the top. However the results in the order changing if you add/remove them, and across widget instances.
Returning them in source order keeps the consistent (and allows the "more important" ones to be at the top), though nothing prevents having a different sort (or an option to change it) on the client side.
Change-Id: I4808f0cb2ae5fcbb6d5496aa736528e60ac7c935
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403582
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
The original code tried to predict the "best" kind of quotes based on the string value (for example changing to double quotes when the string contained a single quote).
Since, we decided it would be better to try to preserve the existing quotes the user picked (this results in less of the string changing, and preserves user preferences/lints).
In some cases we can't preserve the exact delimeters, because if the string is a raw string but the new value contains the delimeter, we can't escape it, so we drop the `r` and escape anything that requires it.
Change-Id: I9a224ade5edd5bd558310b78be132fc9addd3ed3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398885
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
The completion code was no longer using this (we use `ElementLocation2` directly in the completion handler now), and the navigation check was just to ensure we didn't include MultiplyDefinedElements in navigation results.
Change-Id: I8412ec60d3d56386a7ced3d78c3a7428313df5d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402101
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
* If there are no return statements, suggest a `void` or `Future<void>`
return type.
* Visit yield statements as well, to suggest proper return types in
generators.
* Combine the 'return type computers' in extract_method.dart and
add_return_type.dart int one.
Change-Id: I223a50b11e7e77183f166c193fa74b8a2800127e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401862
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This change simplifies working with `@Native`-annotated functions by allowing the native type to be omitted when it can be inferred from the Dart function's signature. While this was previously supported for `@Native` fields, it now applies to functions as well.
Before this change, you needed to specify the native type explicitly:
```
@Native<Void Function(Pointer)>()
external void free(Pointer p);
```
After this change, the native type can now be omitted if it's clear from the Dart signature:
```
@Native()
external void free(Pointer p);
```
TEST=tests/ffi/native_assets/*
CoreLibraryReviewExempt: VM only
Closes: https://github.com/dart-lang/sdk/issues/54810
Change-Id: Ied5407fcd2f49d85284cb7817f0c8cad2a73626b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400840
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Moritz Sümmermann <mosum@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This moves completion resolution off `ElementLocation` onto the class recently created as `TypeHierarchyItemLocation`, which is now renamed to `ElementLocation2` and extracted to its own file.
Change-Id: I1f0b831ded7b08d6c09f97fcfd66f38f1dd4750e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401021
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Fixes a couple of the places that would have become errors when
`ElementImpl` no longer implements `Element2`. There are other places
that will break, but some of them are dependent on other changes being
made first.
Change-Id: I1041d70909de27ff33ddabc25ffc92b405b2c6c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401721
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>