Commit Graph

925 Commits

Author SHA1 Message Date
Paul Berry 32806f2e8d Migration: fix handling of loadLibrary.
Fixes #45396.

Bug: https://github.com/dart-lang/sdk/issues/45396
Change-Id: I150a1ded64ae2c22e5598d2023e605a45ddfe680
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193041
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-03-25 20:29:34 +00:00
Paul Berry 9d0d1fb388 Sort declarations in variables.dart
Change-Id: I5bbf3be04e1fc5c1354d3c3d39669b0bfefb9a50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193040
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-03-25 19:28:14 +00:00
Paul Berry 5fc5c0ba6d Migration: Properly escape strings in calls to querySelector.
Fixes #45326.

Bug: https://github.com/dart-lang/sdk/issues/45326
Change-Id: I990b230b7ee1df6d998dbb412814daa668c25e76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191383
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-03-25 14:43:23 +00:00
Paul Berry 128fef8808 Migration: clarify error messages when preview server doesn't respond.
Previously, if the preview server couldn't be reached because it had
exited, we would generate an error message with an obscure looking
stacktrace.  I believe this was prompting users to file bug reports
against the migration tool, when in fact all they needed to do was
restart the migration process.  Hopefully this better error message
should help avoid confusion.

I also took the opportunity to improve the error message that is shown
if the user does restart the migration tool but tries to keep
interacting with it using an old authToken.

Fixes #45202.

Bug: https://github.com/dart-lang/sdk/issues/45202
Change-Id: I83e0ca99d789739e614bfff2d535d427a2fdfbb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192732
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-03-24 17:03:42 +00:00
Ben Konyi a49bea950d [ CLI ] Use 'project' instead of 'package' in CLI help messages
Initial updates, related to
https://github.com/dart-lang/sdk/issues/45279.

Change-Id: I459e719ad6e92378f9240a612e0bd8229d0fcb2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192727
Reviewed-by: Devon Carew <devoncarew@google.com>
2021-03-23 23:05:33 +00:00
Paul Berry 77fbd1d6e5 Migration: avoid crash on unreferenced part files.
Fixes #45369.

Bug: https://github.com/dart-lang/sdk/issues/45369
Change-Id: Ic414de3c002f8993567eed39e049d90ea741b381
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192520
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-03-22 22:55:45 +00:00
Brian Wilkerson d00ef8611a Update the server protocol to support passing back the line and column numbers for the end of a range
Change-Id: I8310e4a32cacbe98310c1dbaa3b3563b1ff1a1ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191862
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-18 19:22:23 +00:00
Paul Berry 9d395f82cf Sort declarations in migration.dart
Change-Id: Id3d76e47c8c635131a767af0accd19d313296a26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191382
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-03-16 17:06:22 +00:00
Paul Berry c509ad1e41 Change "could not" to "couldn't" in error messages
See comments at
https://dart-review.googlesource.com/c/sdk/+/186320/4/pkg/analyzer/lib/src/generated/resolver.dart#3423.
On the recommendation of the documentation team, we use a more
informal tone in messages.

Change-Id: I0c243669ebd91b8f4a745530582e0f829769a754
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189100
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-03-10 15:26:38 +00:00
Paul Berry 73f9d0cd26 Flow analysis: Remove unnecessary argument from tryFinallyStatement_end.
Flow analysis stopped using this argument (the AST node for the
finally block) some time ago, but I kept it around so I could assert
that clients didn't unnecessarily store assigned variables info for
it.  It's been long enough now that we can eliminate this code
entirely.

Change-Id: I8c64e2b4fc5b154f441ec2d057637f3dc9ced277
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190060
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-03-10 13:14:08 +00:00
Konstantin Shcheglov 19e0673582 Revert "Return List<XyzElementImpl> from ElementImpl getters."
This reverts commit 645035bbb9.

Reason for revert: b/182098851

Original change's description:
> Return List<XyzElementImpl> from ElementImpl getters.
>
> Change-Id: Ice8a0feb6a0bd2599fcfd5ccc35c0b4242ed9530
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189620
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>

Change-Id: I33eff159d62813c35e7e00eee5b7d9dd4fb4e563
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189781
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-08 19:09:44 +00:00
Marcin Niemira a84ee9662c update regexp
Closes https://github.com/dart-lang/sdk/pull/45221
https://github.com/dart-lang/sdk/pull/45221

GitOrigin-RevId: 8728725779669558d519c9270bbf6e9e7e7c0f2d
Change-Id: I754f00f49df78230a6245a05c6647fc573c67a22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189383
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2021-03-08 15:14:31 +00:00
Konstantin Shcheglov 645035bbb9 Return List<XyzElementImpl> from ElementImpl getters.
Change-Id: Ice8a0feb6a0bd2599fcfd5ccc35c0b4242ed9530
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-08 07:00:40 +00:00
Konstantin Shcheglov 0506b1b2d3 Deprecate setters in API of AST.
Change-Id: Ib2ec164ef87b3a5a4bf028d592552e37451abd35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189520
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-03-07 21:48:50 +00:00
Konstantin Shcheglov 53c8eda967 Keep more specific types for AnalysisContextCollectionImpl to avoid downcasts.
It seems to me that implicitly expecting DriverBasedAnalysisContext
is equivalent to explicitly stating this with types.

Change-Id: I16ec14e73030d9b34242a2f4ad582e93fc44afa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189382
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-03-06 06:23:25 +00:00
Paul Berry 8be535350d Flow analysis: improve handling of types in "why not promoted" logic.
This CL plumbs the types of `this` and property get expression from
the CFE and analyzer into flow analysis, so that flow analysis will be
able to create more accurate "why not promoted" information for those
expression types.  This made it possible to eliminate a clumsy aspect
of the previous implementation, namely that we would consider a
promotion attempt like `if (x.y == null) return;` as an attempt to
promote the type of `x.y` to `Object`; now we compute the type the
user is actually trying to promote to, so we will be able to generate
more accurate "why not promoted" messages.

Bug: https://github.com/dart-lang/sdk/issues/44898
Change-Id: I67f9fc59e72103194a1ea6b1c4dfeae8aeb194a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187064
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-03-03 23:16:55 +00:00
Paul Berry 32255a579b Migration: fix race condition with null navigationTree.
If the user tries to click around in the migration web UI before the
navigation tree has finished loading, the `navigationTree` global
variable will still be null; we need to allow for this possibility to
avoid a crash.

Bug: https://buganizer.corp.google.com/issues/181067935
Change-Id: I5398ac62bb4eb307aaa48ec39098b6ae0541a6a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188560
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-03-02 21:33:27 +00:00
Konstantin Shcheglov 875af7c991 Deprecated TypeProvider.futureType2/listType2/etc
Change-Id: Ia994be1e29b4d96b89d714beafcb9256a0cb4de6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184641
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-12 17:26:07 +00:00
Konstantin Shcheglov 5a4b8240f9 Stop using FunctionTypeAliasElement in nnbd_migration.
Change-Id: I3dfc310d28f2f3127e61302dc31ab11ee55d51d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182661
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-03 20:41:19 +00:00
Konstantin Shcheglov 4c6f5f7658 Remove NullSafetyUnderstandingFlag.
Bug: https://github.com/dart-lang/sdk/issues/40531

Change-Id: I197cfdf64c697a09bb9e0e3896f3ee5ac1967757
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168160
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 18:03:24 +00:00
Paul Berry a42244f73b Flow analysis: begin tracking non-promotion reasons.
This CL implements the core flow analysis infrastructure for tracking
reasons why an expression was not promoted.  It supports the following
reasons:

- Expression was a property access
- Expression has been written to since it was promoted

I expect to add support for other non-promotion reasons in the future,
for example:

- `this` cannot be promoted
- Expression has been write captured
- Expression was a reference to a static field or top level variable

These non-promotion reasons are plumbed through to the CFE and
analyzer for the purpose of making errors easier for the user to
understand.  For example, given the following code:

  class C {
    int? i;
    f() {
      if (i == null) return;
      print(i.isEven);
    }
  }

The front end now prints:

  ../../tmp/test.dart:5:13: Error: Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
  Try accessing using ?. instead.
      print(i.isEven);
              ^^^^^^
  Context: 'i' refers to a property so it could not be promoted.

Much work still needs to be done to round out this feature, for example:

- Currently the analyzer only shows the new "why not promoted"
  messages when the "--verbose" flag is specified; this means the
  feature is unlikely to be noticed by users.

- Currently the analyzer doesn't show a "why not promoted" message
  when the non-promotion reason is that the expression is a property
  access.

- We need one or more web pages explaining non-promotion reasons in
  more detail so that the error messages can contain pointers to them.

- The analyzer and front end currently only show non-promotion reasons
  for expressions of the form `x.y` where `x` fails to be promoted to
  non-nullable.  There are many other scenarios that should be
  handled.

Change-Id: I0a12df74d0fc6274dfb3cb555abea81a75884231
Bug: https://github.com/dart-lang/sdk/issues/38773
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181741
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 16:15:34 +00:00
Sam Rawlins aeb040fe75 dart migrate: Fix dead code; add test
Change-Id: I1cc015d4bf66c4810a2cb9a161018b075f317176
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180602
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-01-22 18:14:23 +00:00
Sam Rawlins 97df2e6031 dart migrate: Tidy up extra newlines in opt-out comment
Change-Id: If0c2a2c98d3284da847cae40d1ae8fad97abce6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180482
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-01-22 16:22:03 +00:00
Sam Rawlins f6fc66d674 dart migrate: Opt the web app out of null safety
This is needed as the web app (just migration.dart) is viewed as a
stand-alone Dart file, and thus is de facto opted in.

Change-Id: I56930cc95d32ab22d2ade3c174023775a1f44771
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180483
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-01-22 15:28:33 +00:00
Paul Berry 25af65bb91 Fix exception handling in EdgeBuilder._dispatch.
Previously, we did not null check the listener, which meant that if an
exception occurred in a unit test, there would be a cascading
exception, so we wouldn't get a useful stack trace.

Change-Id: I612ca9e7129441e319d92953c481fd1647eb46ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180383
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-21 21:30:33 +00:00
Paul Berry a93a9a05a8 Migration: handle references to property accessors in extensions.
Fixes #42529.

Bug: https://github.com/dart-lang/sdk/issues/42529
Change-Id: I46be5511bf3929ba08da62bdc6ac6c85a307d0ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180400
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-21 19:04:12 +00:00
Paul Berry 5569f10236 Migration: infer non-null intent for this in extensions.
Since `this` is essentially a variable in extensions, it should be
treated similarly to variables in terms of inference of non-null
intent; for example, if an extension declaration contains a a method
that unconditionall dereferences `this` (either implicitly or
explicitly), that's a good indication that the user probably doesn't
intend for the extension to be applied to nullable types.

Fixes #44675.

Bug: https://github.com/dart-lang/sdk/issues/44675
Change-Id: I004328f5b1fd6710954363c07f4e9db6bc6ac2cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180268
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-21 13:33:36 +00:00
Paul Berry db367e728c Sort declarations in edge_origin.dart
Change-Id: I9461d6af29900546cff74879e95f8d729497080b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180283
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-01-21 13:33:36 +00:00
Paul Berry 46fc6ae07c Migration: refactor _ScopedLocalSet so that all conversion from expressions to elements is in one place.
This will pave the way for expanding this logic to handle `this` in
extension methods.

Bug: https://github.com/dart-lang/sdk/issues/44675
Change-Id: I965c28261eb27807e6789b5906a026c5367d8217
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180281
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-01-21 13:33:36 +00:00
Paul Berry 8ad4919482 Null safety migration: don't null check calls to extensions that permit null.
This partially addresses #44675 by ensuring that if an extension's
extended type is nullable, we won't try to insert an unnecessary null
check at the call site.

It's not a complete fix, though, because we still don't account for
obvious indications of non-null intent when analyzing the extension
definition itself.  I plan to address that in future CLs.

Bug: https://github.com/dart-lang/sdk/issues/44675
Change-Id: Ia0ca37b89470a2d4882ae32cd842552ffd34930e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180263
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-01-21 13:33:36 +00:00
Sam Rawlins 8833210ee4 dart migrate: Only opt out files with a comment if they appear in files-to-process
Change-Id: I3cb1bedaa4a03eca89e29528c554488955f2bb04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180083
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-01-21 00:57:33 +00:00
Sam Rawlins f6dba2b25f dart migrate: Separate HintAction and HintActionKind into separate file
This addresses a cyclic dependency build issue in google3.

Change-Id: I3ea917f7216e120b827577bde60b874a9bad52af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180240
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2021-01-20 21:54:53 +00:00
Paul Berry 21bc3980fd Null safety migration: fix non-null intent in the presence of write captures.
After a variable is write captured, references to it should no longer
be considered to express non-null intent, because we can no longer
guarantee that an initially null value of the variable would
definitely lead to an exception.

Change-Id: I44c65350291a4c44cdb4b19529b13149d8170e34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180100
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-20 14:15:15 +00:00
Paul Berry 5df3d0f5f7 Null safety migration: fix non-null intent inference in the presence of local functions.
Previously, code inside of local functions was treated as though it
appeared inline for the purpose of determining non-null intent.  As a
result, a return statement in such a local function would cause any
code references that followed to be incorrectly treated as *not*
expression non-null intent.

Fixes #44703.

Bug: https://github.com/dart-lang/sdk/issues/44703
Change-Id: Ia74da007eb5424c784d41afeb0e2da4771578553
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180081
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-20 05:40:26 +00:00
Paul Berry 306eb2fd97 Null safety migration: fix late inference when there is non-null intent
Previously, the nullability graph propagation algorithm identified
non-null intent prior to inference of `late`.  As a result, late
inference would be skipped for any variable with clear non-null
intent, so late inference was a lot less effective than it should be.

This requires updating several test cases where `late` should have
been inferred.

Change-Id: I0412ee7045e654185af08cc12b6ca1e6866112af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180080
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-01-20 05:40:26 +00:00
Sam Rawlins d97be105f8 dart migrate: Do not attempt to edit migration status icons for external files
Fixes https://github.com/dart-lang/sdk/issues/44705

Change-Id: I993726795391a2d5d0e639e5db56d10b6809ee79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179921
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-01-19 19:11:22 +00:00
Paul Berry 011f98c959 Invoke flow analysis for if-elements during null safety migration.
Fixes #44702.

Bug: https://github.com/dart-lang/sdk/issues/44702
Change-Id: I70e50722572553dca42b21cea9aff010bd978bfe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180000
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-19 18:20:32 +00:00
Sam Rawlins 034540336a dart migrate: insert comment between first comment and first directive
Fixes https://github.com/dart-lang/sdk/issues/44704

Change-Id: I07402a958f7940bb603253a60e43709fc07529b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179920
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-01-19 15:16:12 +00:00
Paul Berry 8c216921ba Remove transitional method MigrationCliRunner.shouldBeMigrated2
Now that `MigrationCliRunner.shouldBeMigrated` has the correct
signature and internal clients no longer use
`MigrationCliRunner.shouldBeMigrated2`, we can remove
`MigrationCliRunner.shouldBeMigrated2`.

Change-Id: I33bdc78a603c859dd8bf1928f2dbc23233ae5e7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178763
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-19 13:41:32 +00:00
Paul Berry 75aea30724 Add an implementation of legacy type promotion to _fe_analyzer_shared.
The new implementation uses the same API as flow analysis.  This
should allow us to significantly simplify the CFE and analyzer, by
dropping their implementations of legacy type promotion in favor of
the shared implementation.

This CL just introduces the new implementation and unit tests for it;
it does not integrate it with the analyzer or CFE.  I will follow up
with a CL that does the integration.

Change-Id: Ie07b3b39604d6a022ad42f3ae6b648a317c8af28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179560
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-01-16 17:07:23 +00:00
Paul Berry 9de69a94e0 Eliminate context arg from MigrationCliRunner.shouldBeMigrated
This is non-breaking since `shouldBeMigrated` is unreferenced outside
the nnbd_migration package).  Once this lands, we can switch clients
from overriding/calling `shouldBeMigrated2` back to `shouldBeMigrated`
and then eliminate `shouldBeMigrated2`.

Change-Id: I1235113bda6f7609de17ec05e7120b312f201536
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178762
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-16 16:58:43 +00:00
Sam Rawlins bdb60329e9 dart migrate: handle an SDK constraint with no min
Fixed https://github.com/dart-lang/sdk/issues/43989

Change-Id: Iddc5e5f0b53a5ec0540b002654bc46b40dc8a46a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179421
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-01-15 18:03:07 +00:00
Devon Carew 70a88e9c4f update the documentation url for the nnbd migration tool
Change-Id: Idb898c0b4c831d7304db7b7a5251b9c8e7e66589
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179402
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2021-01-15 16:35:02 +00:00
Sam Rawlins 6735d3c693 dart migrate: shutdown the process after applying a migration
Change-Id: Ifdb42cffa703912d541d61ba4386d7df96fda718
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179240
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2021-01-15 03:32:52 +00:00
Sam Rawlins c5e0e73df5 dart migrate: Fix rendering overlay offset issue in Firefox
Fixes https://github.com/dart-lang/sdk/issues/44635

Change-Id: Id6e0518b86859605c5cfacb9091f7e1ed612b71c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178724
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-01-12 23:17:33 +00:00
Paul Berry 9370651773 Prepare to eliminate context arg from MigrationCliRunner.shouldBeMigrated
This change changes `MigrationCliRunner.shouldBeMigrated` to forward
to a transitional method `MigrationCliRunner.shouldBeMigrated2`, which
lacks the now-unused `context` argument.  After this lands, internal
clients will be switched to overriding/calling `shouldBeMigrated2`
instead of `shouldBeMigrated`.

Once no clients remain that refer to `shouldBeMigrated`, the `context`
argument will be removed from it (this will be non-breaking since
`shouldBeMigrated` will at that point be unreferenced outside the
nnbd_migration package).  After that, we will switch clients back to
overriding/calling `shouldBeMigrated` and eliminate
`shouldBeMigrated2`.

Change-Id: If9b476878260a5777f3346486d44c805dc361691
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178761
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-12 16:11:21 +00:00
Sam Rawlins 9488ea4c7e dart migrate: support files-to-be-migrated initial state in google3
* Rename isPreviewServerRunnning to isPreviewServerRunning
* Fix top "Migrating" checkbox upon navigation.

This change does not completely solve google3-compatibility, just the
web preview UI portion.

Work to improve any opt-out `// @dart=2.9` comments will follow.

Change-Id: Iee38650ab732179d82060b14bc7b657e3c560543
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178160
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-01-12 05:54:50 +00:00
Paul Berry 5c19c9f5e4 Flow analysis: store ExpressionInfo in SSA nodes.
This CL modifies flow analysis API so that when a variable is written
or initialized, if the written expression has non-trivial flow
analysis information, it is captured in the SsaNode associated with
the variable.

The stored information is not yet used; in a follow-up CL, I will add
the ability to retrieve it on a read and use it for promotions.

Bug: https://github.com/dart-lang/language/issues/1274
Change-Id: I1e2590205d4a0c59f4400a119f3d6b380a11414c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176460
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-12-17 15:16:04 +00:00
Sam Rawlins 6eddd878c0 dart migrate: Fix preview_site_test on windows
Change-Id: Ib0fc934eb1620017da20a444ced58a8d9e63f540
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176380
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-12-15 23:45:01 +00:00
Sam Rawlins fe2205ebde dart migrate: Simplify final output code
Change-Id: Ib472bf14d8dd06efeeb17b2c81fdb97bb886b214
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176340
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-12-15 22:01:11 +00:00