Commit Graph

4618 Commits

Author SHA1 Message Date
Brian Wilkerson bade55aa20 Use the context type feature in SuggestionBuilder
Change-Id: I79f9f3f3e46bf240a75eba0d9a5d43d2478fb440
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144781
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-04-24 18:38:08 +00:00
Paul Berry a6b0e4fa13 Fix an analysis_server lint (prefer single-quoted strings)
Change-Id: If154127c6625194a856c23729f5b4a26b8b7fe8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144472
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
2020-04-24 10:55:34 +00:00
Paul Berry 319843b6ff Migration: Further decouple NonNullableFix from DartFixListener.
NonNullableFix now communicates with DartFixListener through the
abstract interface DartFixListenerInterface; this will allow us to
build a version of DartFixListenerInterface that doesn't require the
analysis server.

Change-Id: I106d769b0e6ed49a916e2f1665a7e31a9a63be86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144471
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
2020-04-24 10:06:53 +00:00
Paul Berry 4787fc190b Decouple migration logic from AnalysisDriver.
The migration logic doesn't need to access the AnalysisDriver object;
it just needs access to the AnalysisSession (which the driver holds).
By changing the interface so that it requests the session directly, we
pave the way for making a version of the migration tool that doesn't
require the analysis server.

Change-Id: Ib99725bbb2c1728a4c57b46659e9d94cbfe65ee0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144470
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
2020-04-24 10:06:53 +00:00
Paul Berry b0173c1d3e Begin to decouple nnbd_migration tool from analysis_server.
This removes most of the imports from nnbd_migration to
analysis_server by replacing them with abstract interfaces that are in
turn implemented by classes in analysis_server.

Change-Id: I9be9a5bd69b1664f0fea9ff3b6ba4678f134f0e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144468
Reviewed-by: Janice Collins <jcollins@google.com>
2020-04-24 10:06:53 +00:00
Konstantin Shcheglov 4490e2f541 Deprecate VariableElement.constantValue, use computeConstantValue().
Bug: https://github.com/dart-lang/linter/issues/2073
Change-Id: I68d9c8eaf632c72c4634bb56f13af7ab603e3c5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144666
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-24 00:37:52 +00:00
Mike Fairhurst 94178e920e [nnbd_migration] Fix regression: respondOk not returning JSON.
This causes the current state to fail to parse the (empty) success
result and falsely thinks things like rerunning the migration/applying
the migration result in an error.

Change-Id: Id68e089000e0be65278f687cd06112756ccb2a3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144668
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-04-23 23:55:12 +00:00
Paul Berry eab774c255 Move much of migration tool UI code into pkg/nnbd_migration
Change-Id: Ia3b388b274c908dcc6f9cb9ee4bf004b82681c43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144320
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-23 23:43:42 +00:00
Brian Wilkerson c9c4aa5b25 Remove LibraryElementSuggestionBuilder
Change-Id: Idcc99641e3ffc43fea021b5acd0c14a515a4eee5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144670
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-04-23 22:32:52 +00:00
Mike Fairhurst 11c9dd3cd8 [nnbd_migration] Present errors to user in new popup dialog
Includes link to file an issue on github.

Change-Id: Ie0003651d3b3955766c6af016565418fd6ec86a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144523
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-23 21:10:49 +00:00
Jaime Wren 005af39cbc Add some extensions for ASTNodes to start to cleanup some common utils.
Brian- I didn't know if we wanted this in analyzer or analysis server, I am happy to move it if we want it in analyzer.

Change-Id: I7cf909da6d31009ca9be726829cee4342aa2f7a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144665
Commit-Queue: Jaime Wren <jwren@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-04-23 19:32:59 +00:00
Brian Wilkerson 747d363720 Move more suggestion building to happen in the SuggestionBuilder
Change-Id: I7ced2ecdf2fd126cab24400cd7d5688c204670d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144640
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-04-23 18:39:19 +00:00
Jaime Wren f7d14e49c2 Modify the override_contributor.dart to provide the completions even when no class member characters have been typed.
Change-Id: I03164bcb0761faf7634ec219a1b1cc87dc568fa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144493
Commit-Queue: Jaime Wren <jwren@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-04-23 16:19:49 +00:00
Paul Berry 4d4353ded9 Move navigation_dart.dart from analysis_server to analyzer_plugin.
This will allow it to be used by the nnbd_migration package.

Change-Id: Ia628630cf156af7bbfdbe2e104254cf5a609ae91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144467
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-04-23 12:35:39 +00:00
Paul Berry d2331fd8fc Migration: Remove MigrationState.adapter and InfoBuilder.adapter.
These fields were not being used.  Removing them will make it easier
to move these classes into pkg/nnbd_migration.

Change-Id: I7528bc07e5efd3936a9c6fd1635415e139d5df43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144466
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-23 12:35:39 +00:00
Sam Rawlins a5add116bf Migrator: Add a 'Report a problem' button
Fixes #41485

Change-Id: If5c4347ad177b7050a90a4549a880f49577ada8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144522
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-04-23 09:07:38 +00:00
Mike Fairhurst 09dabd510e [nnbd_migration] Handle json response on client
Change-Id: Ibd06a3529d85903576cb906f5dedb59c5392982f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144484
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-04-23 05:47:18 +00:00
Mike Fairhurst 3a6c863e23 [nnbd_migration] Respond in json for errors, simple successes.
Change-Id: I69015f21463b3060dd168654627f8e753ede52ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144340
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-23 05:47:18 +00:00
Brian Wilkerson 87e8a701db Remove a field by moving the logic it controlled to the only place it was used
Change-Id: I07fc506a3a43de74b7425f1ed2d88a04e5d767c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144492
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-04-22 23:34:34 +00:00
Brian Wilkerson fa75e17298 Use element kind for relevance of constructors
Change-Id: Ia63f70bbcd8a4a40da4a203889bfdd34ab08a873
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144489
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-04-22 21:56:09 +00:00
Brian Wilkerson e89caba01a Stop adjusting relevance scores by computing them correctly initially
A first small step toward cleaning up the suggestion creation code.

Change-Id: Ic434c5dd4c25f6edeb930c143ca12cee66a60675
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144440
Reviewed-by: Jaime Wren <jwren@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-04-22 19:10:49 +00:00
Brian Wilkerson 35d1ac0694 Move an older style fix/assist to the new style
Change-Id: I904e8d6c2181fc738724793961e2314a4dd770b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144481
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-04-22 19:06:49 +00:00
Konstantin Shcheglov a934ec2961 If possible, reuse the last completion result.
Also rename "character" to "column".

R=brianwilkerson@google.com, keertip@google.com

Change-Id: I6167de6e1fd5aede2a619603635e96f16bfbcc8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144352
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-22 14:50:38 +00:00
Sam Rawlins 29bc716241 Migrator: Add a late inference component
Fixes #38747

Change-Id: I045a6481424c75828eb7ae1e71c890b10e9d402c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144244
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-04-21 23:54:54 +00:00
Konstantin Shcheglov 65a944f78f Add CiderCompletionComputer.compute2(), tests.
R=brianwilkerson@google.com, keertip@google.com

Change-Id: Ie6acad3873f78060cde85a350ebd48b854ea1314
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144345
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-21 23:46:04 +00:00
Sam Rawlins 511baaae48 migrator: Switch help link to the shortened URL
Fixes #41488

Change-Id: I272e9dbe32311454767a99d309a694e8d0fc9730
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144300
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-04-21 18:39:34 +00:00
Danny Tuppeny 4932348ff3 Expose fix/assist IDs in LSP code actions
Change-Id: Ic75fd362f9feada81834a7d36419c27cf316f18d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143814
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
2020-04-20 14:57:26 +00:00
Brian Wilkerson 1c12bde2a9 Add a fix to remove invalid question marks
Change-Id: I24caf62176e3426dddcae17204a1435f0f7946d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144080
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-04-20 02:42:25 +00:00
Brian Wilkerson 19008faa12 Pass DartDoc directive info to completion manager under LSP (issue 41564)
Bug: 41564
Change-Id: Ief7b302161b04e21952e4e77e16315bfbbd1e794
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144020
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-04-18 20:09:08 +00:00
Mike Fairhurst 232826b6e6 [nnbd_migration] fix #41391, crash applying migration.
This is caused by changes to non-dart code, which does not get a
UnitInfo.

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

Fixed: 41392
Change-Id: I5054c672c0ca87027d66f1304385ea29d3e17d10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144001
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-04-17 22:54:04 +00:00
Brian Wilkerson 40661e3bc6 Create the class SuggestionBuilder and pass it to contributors
Change-Id: Ia36906d614ced8d8b783a03f86385ebc903375c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143965
Reviewed-by: Jaime Wren <jwren@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-04-17 20:48:04 +00:00
Mike Fairhurst 3de4d76b4a [nnbd_migration] Use offsets instead of column numbers in traces
Change-Id: I37f44c1a4713106e15b346739354b73592d208d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143721
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-04-17 19:07:44 +00:00
Konstantin Shcheglov 780bea595e Add CiderCompletionComputer.
It encapsulates resolution logic, creating completion request and
manager, caching and reusing suggestions from imported libraries.

In the spirit of keeping the Cider part thin.

R=brianwilkerson@google.com, keertip@google.com

Change-Id: I95f13a98d776eb418b40ea2fae421654eef7602d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-17 18:47:36 +00:00
Paul Berry d52dc104d4 Migration: instead of removing weak-only code, warn about it.
Previously we considered such code "dead", but it's not really dead
until Dart 3.0.  Removing it changes weak mode semantics, and we don't
want to do that automatically.

Fixes #41231

Change-Id: I6a88f016b4f3fcba160dcb738558867219715cbb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143941
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-04-17 17:27:59 +00:00
Brian Wilkerson 0eaf749dfd Fix some hints in analysis_server (TBR)
Change-Id: Ia43fa5ad0b12b24f434483da67ce168fb39a69fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143886
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-04-17 15:11:58 +00:00
Paul Berry 4747672929 Migration: fix preview output when accepting a /*late*/ hint.
Change-Id: I383be37cc86d3c83f5b2b332ae14ce35516f858d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143563
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-17 00:17:15 +00:00
Paul Berry a72e0e3412 Migration: don't double count edits when accepting hints
Technically, accepting a hint requires two edits, one to remove the
`/*` and one to remove the `*/`.  But we only want it to show up as
one edit in the "Proposed Edits" pane.

Fixes #38471

Change-Id: Ica7880a2ffab98715a1c9f3bbe723363fd481086
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143484
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-17 00:17:15 +00:00
Paul Berry fdc13e3f43 Migration: remove hints when performing migration.
Previously, if we migrated a code snippet like this:

  void f(int/*?*/ i) {
    /*late*/ int j = i/*!*/;
  }

the migration result would leave the hints and add the hinted text,
resulting in:

  void f(int?/*?*/ i) {
    /*late*/ late int j = i!/*!*/;
  }

We now simply remove the `/*` and `*/` surrounding each hint (with
whitespace corrections as needed), to produce:

  void f(int? i) {
    late int j = i!;
  }

Change-Id: Ic4e1216cb4693d73d71c9ab1a37d5cc15b8ef334
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143460
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-04-17 00:17:15 +00:00
David Martos 8c5bad716b Add some fixes to dartfix
Fixes https://github.com/dart-lang/sdk/issues/41536

The already implemented lint fixes prefer_const_constructors,
prefer_const_constructors_in_immutables and prefer_const_declarations
have been added to the list of all fixes so that they can be used from
the tool dartfix.

Change-Id: I5a3a1a0a849498a5bf759f40dc51606c4f605a32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143800
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-04-16 18:09:05 +00:00
Sam Rawlins 4f2e21b351 migrator: Update pubspec.yaml, not analysis_options.yaml
Fixes #38347

Change-Id: I201a02ad467401e8277631947dcdf3a19f74ddb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143440
Reviewed-by: Janice Collins <jcollins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-04-16 17:35:34 +00:00
Danny Tuppeny 715361eef2 Change format of IDs for fixes and attach them to generated changes
Having IDs to the change allows them to be key-bound in VS Code (see https://github.com/Dart-Code/Dart-Code/issues/2169).

Changing for format is to make them better match the existing IDs for assists (these will need to be pre-loaded into VS Code to allow users to see them to aid keybinding).

Change-Id: Iedcfaaf9a29d5e8575f1b8394e3db0ff19360872
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143588
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-04-16 17:35:24 +00:00
Brian Wilkerson 84beb4d31b Implement the element kind feature
In addition to implementing the feature, this CL updates one of the
contributors to use the new feature as a way of testing it. I haven't
looked to see whether it impacts the metrics, but I wouldn't expect much
change anyway because of the small number of completions that are likely
to be effected by this change.

It might be interesting to start thinking about ways to measure the
impact of individual features.

Change-Id: Idd0040a774e5fd9a6e3f6c29d0aa7fd762676fbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143622
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
2020-04-16 14:33:24 +00:00
pq 0e7df4b062 Remove unneeded <Widget> type params from "wrap with..." assists
Fixes: https://github.com/dart-lang/sdk/issues/41517



Change-Id: I18a560a82863c576cab8694eb940f16a9ebedfee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-04-15 19:44:57 +00:00
Brian Wilkerson 92db79412e Add a generator and generated code for the element kind relevance table
Change-Id: I8b25a6e7c992eb572305d0ae8392baee03e479ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143483
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-04-15 19:15:22 +00:00
Brian Wilkerson f7f0e2b51b Add a fuzzy matcher for filtering completion suggestions
Change-Id: If3e9f87ad6a98be8f2a1f4c5c51679a48a206cf4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143400
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-04-15 18:47:42 +00:00
Konstantin Shcheglov 69526e6512 Depecate many AnalysisOptions fields.
Change-Id: Ibe219527d9abdad38bb99390d3023e7ee6bb8420
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143251
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-15 18:36:52 +00:00
Mike Fairhurst 6617e3e207 [nnbd_migration] New style for when migration needs rerun
Change-Id: I429ab3f0df58228d0bcfe594d6f614ac2b120728
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143401
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-04-15 17:51:13 +00:00
Paul Berry 1d3105e0b3 Migration: prioritize changes differently if they're due to hints.
Change-Id: I4dfdd0287e488dfac21923c71741d2218a2c070c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143334
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-14 23:33:46 +00:00
Paul Berry 46b49d23ec Migration: track multiple fix reasons for expressions with complex types.
Change-Id: I1a1f78377ed64504e5315b5096914219dc625e78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143188
Reviewed-by: Janice Collins <jcollins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-14 23:33:46 +00:00
Mike Fairhurst 46a89f7671 [nnbd_migration] allow edits to be done incrementally.
Mutate datastructures to match disk contents. Leverages offset mapper,
by rebasing the migration mapping onto the disk changes which occur in
sequence.

Add an integration test for preview site tests that confirms multiple
changes workflow works, including regions and navigation, including
using the changed edit offsets.

One thing that is not updated is traces. It seems that trace entries are
misusing "offset" by storing column values. Without that, adjusting
trace entries is not trivial. I have not looked into how difficult it
would be to correct this. Traces still *work*, they just may point to an
incorrect column. This is not easy to notice, but worth fixing in the
next CLs.

Another potential consistency improvement would be to use the offset
mapper to handle regions so that they do not need to be updated this
way. This would be more consistent with how other things like navigation
did not require updates once the offset mapper was done correctly.

Another quirk is that this API for performing edits does not *necessarily*
lend itself to reruns. For this CL, I decided to check when the edit is
"insertion only" and therefore easy to do incrementally. However, the API
allows for things like mass deletions that might be trickier to handle in
general. In this case, it will still do a rerun.

Change-Id: Ib88bb32592f54502d69b58ccab71ffb0b5f8040e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143325
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-14 22:42:46 +00:00