Commit Graph

393 Commits

Author SHA1 Message Date
Danny Tuppeny 0fa6674ea9 [Analyzer] Include required-named params in defaultArgumentListString and LSP complete-function-calls
Change-Id: I8b4c09305df6e868e7447c538be4a3b540aa7e57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174802
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-12-08 20:47:04 +00:00
Danny Tuppeny a0cc6c9819 [Analyzer] Add a new CompletionSuggestionKind for Pub package names
Change-Id: I73fad5c793249a8ee0e30c1ce198b5adf7ff429a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174128
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-27 17:38:16 +00:00
Brian Wilkerson c6126c34e9 Suggest previously missed type parameters
Change-Id: I09361984b7a58a281769e5feb04aeb1656620237
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173880
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
2020-11-25 00:13:49 +00:00
Brian Wilkerson 32d0d625b3 suggest loop variables defined in for elements
Change-Id: Ie01dabd21b5a37b07d965fc78876a2876b57ce4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173840
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-11-24 21:51:09 +00:00
Sam Rawlins 19a96e4d5e Analyzer: override element type in ExportDirective and ImportDirective
This reduces the number of explicit casts needed for null safety.

Change-Id: I8ad0ab9cddbbe81e5fbf66b95ae4ae1cb57efebc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172743
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-11-20 15:22:46 +00:00
Sam Rawlins 0a4685822f analyzer_plugin: Remove unused imports which share a prefix
Bug: https://github.com/dart-lang/sdk/issues/38784
Change-Id: Ia1c1b2774ae483d30278dea4ee9d069104f7f1a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172301
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-11-16 20:09:46 +00:00
Brian Wilkerson 9f6ea5b6f6 Remove an unused import
Change-Id: Ib5c9997a309353baa2b11c8e36c4b1bfafd59c98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172025
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-11-15 17:57:47 +00:00
Brian Wilkerson c3f96e863f Remove uses of useNewRelevance and clean up associated code
Change-Id: I04dd3b33d229348042609c5a656d1ad68a95913d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172120
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-11-15 00:18:07 +00:00
Devon Carew 2f9cb8e81b Remove support for v1 of analysis highlighting.
Change-Id: I65bc645de9565628d82d1ff969616f3e38582275
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171682
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-12 18:36:19 +00:00
Brian Wilkerson 23478cb386 Implement a simple transactional model for change builders for use by bulk fixes
Change-Id: I4e7a3e13345a865a2302dfddbc9aa4eb7b531d15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171340
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2020-11-11 16:46:42 +00:00
Brian Wilkerson 0d222cc712 Throw an exception when an attempt is made to produce conflicting edits.
Change-Id: I826cd1771a61685f76314b3ec0125cfc0364b700
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170800
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-11-10 15:56:06 +00:00
Lasse Reichstein Holst Nielsen 92e52a1874 Remove direct dependencies on package:charcode from SDK.
Change-Id: I9ef36e8a6890a70baac6c18f0be2252dcf5453df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163941
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-10-20 13:07:53 +00:00
Konstantin Shcheglov aad1a677c0 Deprecate GenericTypeAliasElement
See also https://dart-review.googlesource.com/c/sdk/+/166680

Change-Id: I6018f3bf5796dcc8ab059aab5b29d01e7336581b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167727
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-15 16:03:26 +00:00
Konstantin Shcheglov fbfc723de7 Use CompoundAssignmentExpression instead of LHS element/type.
This adds some technical debt in form of using writeOrReadElement in
clients, which can be paid incrementally by migrating these places to
handling assignment like expressions one by one. Doing it all in one
CL was too much. But now the underlaying AST resolution will be
sound.

In the next breaking change we will remove
setAssignmentBackwardCompatibility(), so stop setting elements/types
for assignment targets.

Change-Id: I11626876cfed25653edb0cc18544aba51cef5965
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165622
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-14 18:45:08 +00:00
Brian Wilkerson 1fcb032798 Do not generate void when overriding a setter
Bug: https://github.com/dart-lang/sdk/issues/43767
Change-Id: I373793360ffc58f28cb7a58b1b16c360b560ba51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167363
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-10-13 16:30:08 +00:00
Danny Tuppeny 8b567447dc [Analyzer] Use new NAMED_REQUIRED ParameterKind for signature help
Change-Id: Ia4d23cb51f4e3729e8d40fa5a38dd8b2a8771c03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162006
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-29 07:38:14 +00:00
Mike Fairhurst e4f20f647e [analyzer_plugin] Remove unnecessary dart:async import
Change-Id: I759d4f9b05a21062550f9cbbc2fe56a2f19dfaf1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164621
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-28 21:07:08 +00:00
Brian Wilkerson fdf4a1cc47 Fix the production of overrides under null safety
Bug: https://github.com/dart-lang/sdk/issues/43535
Change-Id: I9386d3abed83095e2363ba9b52c111dc93356914
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164260
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-09-23 22:42:59 +00:00
Brian Wilkerson 69de8fd3d4 Make it possible to write imported names in data-driven fixes
Change-Id: Icc1843a767261180df2b07205faf3f960adf0826
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164200
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-09-23 18:46:09 +00:00
Danny Tuppeny c0c5a7404c [Analyzer] Make newlines in fixes like CreateMissingOverrides consistent on Windows
See https://github.com/Dart-Code/Dart-Code/issues/2766.

Change-Id: Ib1d5f06a9a3667c704e9656b233cc2cce01fa3d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163206
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-17 16:01:10 +00:00
Danny Tuppeny 9181df9d6b [Analyzer] Fix error in LSP go-to-definition when target is in a "part"
Plus unrelated navigation regions (for example in comments, references
outside of the required range would be returned).

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

Change-Id: I2fce33a3bd2678abfb40e5e9b3e3c5662e4f5608
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161948
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-09 18:53:39 +00:00
Danny Tuppeny 4ce8084672 [Analyzer] Avoid error in code range calculation when codeOffset is null
Change-Id: I615bdc21242407af5b375e9eb1f1565be9d79e61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161947
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
2020-09-08 16:38:33 +00:00
Danny Tuppeny 31cc6df4fe [Analyzer] Compute code locations for LSP definitions
Change-Id: Id52fefae11b0d779b860cb44e33bc36cc12e55bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161168
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-02 20:51:27 +00:00
Danny Tuppeny 5112f526cf [Analyzer] Add optional support for codeOffset/codeLength on navigation targets
Change-Id: Ib328c408d590398d30bd341603781f68f2fd1402
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161166
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-02 20:51:27 +00:00
Mike Fairhurst 334d368146 [analyzer_plugin] Remove unused dart:async imports
Change-Id: I079d5f7c1f6c36d4e76ecd41b5d22e4199c1304c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161464
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-02 18:09:52 +00:00
Brian Wilkerson 61c8053730 Fix computation of OpType in an empty return statement with a semicolon
Change-Id: Id28f0ce01bd4ba2a5185b4d3f407409a6b724a1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159969
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-08-24 23:30:27 +00:00
Brian Wilkerson 680f3b51ca Suggest named parameter names in a super constructor invocation
Change-Id: Ibe095cab1473aefd3a1067bb0264a115f44c05d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159964
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-08-24 20:42:07 +00:00
Konstantin Shcheglov cf4d41074e Fix crash when working with directives with invalid URIs.
R=brianwilkerson@google.com

Change-Id: Id8bd5c49269c58404b4a4d3182b77a37fb494c11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-22 18:37:51 +00:00
Brian Wilkerson 90b2e5f576 Enhance DartEditBuilder.writeParameter to support the covariant and required keywords
Change-Id: I625196ff5786d9a6029db92809487d79e0e8d710
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159385
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-08-20 14:03:18 +00:00
Brian Wilkerson 4af6831020 Add support for modifying parameters in a data-driven fix
Change-Id: I756df3e665c24cbf5131a0aae1c1526c08a5d172
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158940
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-08-18 14:56:40 +00:00
Brian Wilkerson a4baaa3ac5 Fix a bug in the way RangeFactory deals with trailing commas in a list
Change-Id: Ic9ba9acbbb583068662972fd5cc42d28aa1dfa6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155824
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-07-24 20:08:47 +00:00
Konstantin Shcheglov ea7a92845c Fix NPE for CREATE_FUNCTION when IndexExpression argument.
Change-Id: I539908a5033aa0f84adcce5ae0be4ea6713ff75c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-07-19 15:40:19 +00:00
Brian Wilkerson e0cfdc0d62 Deprecate the class DartChangeBuilder and update all references to it in the analyzer packages
Change-Id: I6c2692ed5ece57d28f70482877933564d443cfa5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154753
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-07-17 00:11:14 +00:00
Brian Wilkerson cbe22f1533 Merge the functionality of DartChangeBuilder into ChangeBuilder
This introduces the new API. When we're happy with this I'll mark the
old APIs as deprecated and fix up the nearly 900 places impacted by the
change.

Change-Id: Ie88e354d9111339dc79448139bd64246cf06e0c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154700
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-07-16 17:44:34 +00:00
Konstantin Shcheglov a9e67d8194 Prepare to publish analyzer_plugin 0.3.0
We need this for https://dart-review.googlesource.com/c/sdk/+/154128

Change-Id: I7ce15ad1a0037e60422f412a0cb9840c29a7e4e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154129
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-07-11 17:05:43 +00:00
Brian Wilkerson 082a6e03bd Use element kind to boost the relevance of available declarations
This doesn't significantly improve the overall scores, but it does cause
the element kind to be used for available declarations, which means that
constructors are suggested before classes.

Change-Id: I75e7bb13bd867b9209a43c4d737c5079c42eb25a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154080
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-07-10 20:08:36 +00:00
Konstantin Shcheglov 653e44485f Prepare to publish analyzer_plugin 0.2.5
R=brianwilkerson@google.com

Change-Id: Ie48ebda4951c1ea6d90e049639d3bbf8e15013be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153383
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-07-08 01:17:50 +00:00
Brian Wilkerson ff83b0fec9 Add support for navigating from the URI in import and export configurations to the referenced file
Change-Id: Ic6234d9a24dcb52228067b20d69277e47ff89a0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152401
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-06-24 22:46:33 +00:00
Brian Wilkerson d0e78f8a77 Fix the edit groups created by create_missing_overrides (issue 42468)
Change-Id: I53e5f44af3583549f277f1d7acbe1f725f7a6ef5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152400
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-06-24 22:39:18 +00:00
Danny Tuppeny f0e1f32c87 Add support for folding if/else/elseif blocks
Change-Id: I3cbf1f282ee59c577c6ba912e957f838e827fd3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-06-17 19:32:50 +00:00
Brian Wilkerson c22dc20a93 Use the const-ness of an element when completing in a const context using available declarations
Change-Id: Ia950ad81ed571cbcf1f0060da0cba26406206ad1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151031
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-06-12 22:15:55 +00:00
Jaime Wren 1e0611cfac Refactor the LocalConstructorContributor into the LocalReferenceContributor.
local_declaration_visitor.dart was updated to better implement ConstructorDeclarations

This adds the API of _recordCompletionElement() and _elementAlreadyInCompletionSet() to local_reference_contributor.dart, if this API looks good and lands, I will use it in the rest of the contributor to fix other known shadowing bugs.

local_constructor_contributor_test.dart was removed (a large copied & pasted body of tests not providing value) and tests were added at the beginning of local_reference_contributor_test.dart.  Tests in this file were also updated accordingly.

The change of the testCommentSnippets025 test in completion_test.dart is due to the framework not supporting (in a more robust way) the allowance of both a class and an implicit constructor

The addition of the testCommentSnippets045 test in completion_test.dart is to show that constructor invocations don't need the new keyword.

Change-Id: Ic4a52e3cb94320a92f24b1c743dd61e18c6c7b16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150165
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
2020-06-05 16:15:04 +00:00
Brian Wilkerson 333873fc05 An initial naive approach to integrating the new relevance computations
and the available declarations support.

The resulting metrics are lower than I'd like them to be, but I suspect
that this will be a reasonable first step toward the final solution.

Change-Id: Ib5d471a9d3c0dafcb2b3687e25b9af21da97854a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149860
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-06-03 16:29:00 +00:00
Paul Berry 930cae0f13 Revert "Remove DartSdk.useSummary."
This reverts commit a2c3ecabce.

Reason for revert: Breaking change to de facto API

Original change's description:
> Remove DartSdk.useSummary.
> 
> R=​brianwilkerson@google.com
> 
> Change-Id: Ifa851f4af47a973d65c528c6d07fcac0a515134b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149495
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>

TBR=scheglov@google.com,brianwilkerson@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I9998bedb74ea940371f18ac7dce42b2f5dcc3b98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149687
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-06-02 15:20:32 +00:00
Konstantin Shcheglov a2c3ecabce Remove DartSdk.useSummary.
R=brianwilkerson@google.com

Change-Id: Ifa851f4af47a973d65c528c6d07fcac0a515134b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149495
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-05-30 19:07:32 +00:00
Paul Berry 3870ca7c9f Analyzer_plugin: fix problematic imports of analysis_server, and prepare to publish.
The previous publish attempt failed because
lib/utilities/navigation/navigation_dart.dart imported from
analysis_server.  Bumping the version number to 0.2.4 since the fix
required exposing a new method to the public API.

Note that one import of analysis_server remains, in
test/verify_sorted_test.dart.  This is less urgent to fix, since it
doesn't block publishing analyzer_plugin, it just prevents users from
running analyzer_plugin tests based on the files downloaded via pub.
I'll fix this in a follow-up CL.

Change-Id: I8ae9470db3249492b5756b8f9af742e528db004a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149387
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-05-29 23:29:47 +00:00
Jaime Wren 77d2a59d8e Add declaredConstructor() to the LocalDeclarationVisitor and mark all declared*() members as concrete with empty bodies. Subclasses are updated in this change as well.
Change-Id: I458968049781830af83d09512a6a1dd75b573070
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149391
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
2020-05-29 15:23:46 +00:00
Brian Wilkerson b7364da5fd Fix the computation of completion location in OpType
There was a bug earlier in which we were attempting to use a relevance
table (MethodInvocation_arguments) that was not generated. I thought
the bug was that the table wasn't being generated, so I attempted to
generate the table (in relevance_table_generator). But the table can't
be generated and the real bug was that the wrong contextLocation was
being generated when computing the OpType. So I backed out the earlier
change and updated the generation to generate the right location.

Change-Id: Ifbd2c6c3e11e1e98887108be7eb6d90e90452446
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149381
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-05-28 21:23:01 +00:00
Brian Wilkerson 3fb5f27d05 Extract and enhance the CREATE_CLASS fix
The enhancement is that we can now create a const constructor if the
class to be created is being used as an annotation. We could also do
this if the class were being created from a constructor invocation, but
I didn't do that. This also doesn't handle creating a named constructor,
but I don't think it's any worse than before. If you disagree let me
know.

Change-Id: Idcff7bd0ac8def416b141b49b801f6798548405d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148885
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-05-22 18:50:06 +00:00
Brian Wilkerson b560016446 Fix some issues in the new relevance computations
The code to check the element kind was not being used in a few places
because (a) the generator wasn't always generating a table when it
should and (b) the key for the table wasn't always being set when
creating the OpType. Both of these issues have been mostly addressed.

That required re-generating the element kind tables.

There were several places where context type information wasn't being
used when building suggestions. This has been fixed for all the places
I'm currently aware of.

There were a couple of places where the context type wasn't being
computed where it could have been. I have fixed the places I'm aware of.

Context types were not being computed anywhere because of a bug that
has now been fixed.

There is now one place that computes and caches the context type, which
should improve performance slightly.

I also removed some dead code that I discovered in the process of making
the other changes and cleaned up a couple of places in the code that
were suboptimal.

Change-Id: Ieae8dcc71b986841be3078d6e0b3a653c35384b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148237
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-05-16 17:15:33 +00:00