Commit Graph

79 Commits

Author SHA1 Message Date
Brian Wilkerson eb1ce5d640 Remove some unnecessary null checks
These were found using the unnecessary-null-checks lint. It has a bug
that prevents us from enabling it at the moment, but we should consider
enabling it once the bug has been fixed.

Change-Id: Ice250b5a6a8723c5f08dec5b07ae738e17c842cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196550
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-24 18:22:43 +00:00
Brian Wilkerson 5be0438e47 Make local variables that hide fields be final (analyzer)
Change-Id: I4cb41aec1757e133751979d3c0cdc697ccafc4a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196780
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-24 18:04:04 +00:00
Konstantin Shcheglov 51950ab881 Add Resource.parent2 that returns non-null Folder, add Folder.isRoot
A bigger version of than https://dart-review.googlesource.com/c/sdk/+/184381
This is breaking change, so we do this in steps.

Change-Id: I0c7212a073b605ade56657036543c604651810c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184581
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-12 19:09:20 +00:00
Konstantin Shcheglov 9f986d2501 Migrate package:analyzer to null safety.
Change-Id: Iffe4370431587e46a141ddc72a86ceec29c163b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176486
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-02-01 18:56:04 +00:00
Devon Carew 2ba123b86e [analysis server] remove the --file-read-mode cli option for the analysis server
Change-Id: I279233cd0b7ec09a7d2fdcd50837552f56f2584d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171763
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2020-11-12 21:42:50 +00:00
Devon Carew e7647f2cf2 Revert "[analysis server] remove the --file-read-mode cli option for the analysis server"
This reverts commit 1caee4d1fd.

Reason for revert: This breaks google3 - we need to update the linter's use of the analyzer API.

Original change's description:
> [analysis server] remove the --file-read-mode cli option for the analysis server
>
> Change-Id: Id07e3655cb4bcfc462ada0db8257e7cf584272f5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171101
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Commit-Queue: Devon Carew <devoncarew@google.com>

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

Change-Id: I68294ad8b565a94aa098e65276b78e9745eec5a5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171640
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2020-11-11 20:10:41 +00:00
Devon Carew 1caee4d1fd [analysis server] remove the --file-read-mode cli option for the analysis server
Change-Id: Id07e3655cb4bcfc462ada0db8257e7cf584272f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171101
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2020-11-11 19:30:23 +00:00
Mike Fairhurst 000f3135a5 [analyzer] Remove unused dart:async imports
Change-Id: If21c3a30f3bc521586ad01f8f9e241038e7aa7eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161448
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-09-02 17:14:22 +00:00
Konstantin Shcheglov f3936bca67 Add Resource.provider
R=brianwilkerson@google.com

Change-Id: I1d41d46f927e0ca804031a6fdf8148825695636e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158523
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-08-14 01:49:45 +00:00
Sam Rawlins 041e0dd618 Analyzer: Enforce strict-inference
Change-Id: Iba49bfa7cf10f8a3b1d3be03e73fdca280f0940a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155062
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-07-22 00:44:55 +00:00
Sam Rawlins 6bf946bbfc analyzer: Always declare return types.
Change-Id: I23d89bb572310a1a8deef8e173630d9bb59c9a50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152708
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-06-26 23:54:28 +00:00
Sam Rawlins 648b5e9c68 Use ///-style doc comments in analyzer/lib
Bug: https://github.com/dart-lang/sdk/issues/33892
Change-Id: I573cb81dca6462c571bd6bf7bf309a46fd628967
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152610
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-06-26 17:58:50 +00:00
Parker Lougheed 6489a0c68d Fix error when modifying import on Windows
If there is an exception when checking if a resource exists, it is similar to it not existing. Open to feedback here though, perhaps the issue should be handled more specifically to Windows path requirements.

Bug: https://github.com/dart-lang/sdk/issues/37403
Change-Id: Ic5d4ed0cb22619897c3ccaf46feaadd297b55472
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148701
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-05-27 05:50:13 +00:00
Konstantin Shcheglov b344a111dc Remove extra await null in analyzer.
R=brianwilkerson@google.com

Change-Id: Idcc04115f618ae7dfcb58a2ab93df538d2b65873
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140887
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-03-25 15:59:12 +00:00
Konstantin Shcheglov 364dd8936b Fix unnecessary_new in analyzer.
R=brianwilkerson@google.com

Change-Id: I70f80baa3da4b14c0a52c1f28da16a9ad26d7dda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127424
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-12-06 01:11:30 +00:00
Mike Fairhurst c58d263729 [analysis_server] Handle directory watcher closed on windows.
Change-Id: I11d1d9a324ebb27a920837ee4382b89e7cbb0253
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125765
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-11-22 21:22:28 +00:00
Todd Volkert 6aee4f390b Make analyzer's File.readAsBytesSync() impls return Uint8List
As part of the rollout plkan for https://github.com/dart-lang/sdk/issues/36900

Bug: dartbug.com/36900
Change-Id: Ic56cc1054ebae5967a1273b19f886a5e41b9460b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103060
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Todd Volkert <tvolkert@google.com>
2019-05-28 15:02:16 +00:00
Brian Wilkerson 68889c97ae Rework the file system tests so that most tests are shared
Change-Id: Ibeee593ebd3e240dca5ac86a50a3179d72c5ba61
Reviewed-on: https://dart-review.googlesource.com/c/86827
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-12-11 13:49:21 +00:00
Brian Wilkerson 469e1e2e64 Remove unnecessary library directives
Change-Id: I7a157080e4d7fd80d64489a13de4e996b5870930
Reviewed-on: https://dart-review.googlesource.com/c/79474
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-13 00:44:04 +00:00
Konstantin Shcheglov 9c585bf5df Document that ResourceProvider requires absolute, normalized paths, and enforce this.
This allows us to avoid performing normalization, and work with paths
as is. So, this speeds up SourceFactoryImpl.restoreUri() from 7.5% to 3.7%

R=brianwilkerson@google.com

Change-Id: I085f3db40af6543fbb524a82fad48aa051e87937
Reviewed-on: https://dart-review.googlesource.com/77017
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-09-28 17:18:49 +00:00
Devon Carew 0c2d382a6e add the ability to set the analyzer's state location via an env variable.
Change-Id: I37d1599cb96db7c09f929a6e56f191cc7a969145
Reviewed-on: https://dart-review.googlesource.com/70540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2018-08-17 17:42:43 +00:00
Brian Wilkerson f6d2c2378a Add awaits in async methods to restore previous semantics
Change-Id: I7711cd878a31df0fb0c92572e2256c0a26923640
Reviewed-on: https://dart-review.googlesource.com/59480
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-06-08 19:58:07 +00:00
Konstantin Shcheglov 8e59876cca Issue 33381. Make input paths in analyzer_cli absolute and normalized.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/33381
Change-Id: I27e710859fdf2ab8e9380b232739def5acdf561d
Reviewed-on: https://dart-review.googlesource.com/59101
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-06-07 18:48:18 +00:00
Brian Wilkerson 7054d92a02 Remove some classes from the analyzer public API
Change-Id: Ic53a8426818b06f44c2876abd16c789589bf78b5
Reviewed-on: https://dart-review.googlesource.com/52421
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-24 15:28:15 +00:00
Konstantin Shcheglov 818c4b5bfd Remove AbsolutePathContext and use package:path instead.
I see however that linter/test/rule_test.dart uses it, but as far as I
can see, that's it. All other usages are from analyzer and
analysis_server.

R=brianwilkerson@google.com

Change-Id: I2b82870a4a4ec6f155326d8ee6dc1c1028f84793
Reviewed-on: https://dart-review.googlesource.com/52265
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-04-20 21:01:06 +00:00
Devon Carew 3a5fcf5a87 Upgrade the dep on package:isolate.
Change-Id: Ie9c52c6dd24672e2469787220505bd85a50ed5ff
Reviewed-on: https://dart-review.googlesource.com/51241
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2018-04-16 17:08:48 +00:00
Konstantin Shcheglov d9a44c9dc7 Revert "Normalize Windows drive letters to uppercase for analysis"
This reverts commit 56acaee9b1.

See https://github.com/dart-lang/sdk/issues/32186

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

Change-Id: I76c673758e4b9acd22044985b4054b5504f4a205
Reviewed-on: https://dart-review.googlesource.com/41902
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-02-15 22:10:56 +00:00
Danny Tuppeny 56acaee9b1 Normalize Windows drive letters to uppercase for analysis
This fixes #32095, ~~however I'm currently unable to get the tests running locally. I'll continue to work on that, but I'm hoping that creating a PR runs all the tests on CI so we should at least get to see if this (legitimately) broke anything in the meantime?~~

Turns out this also fixes #32042! I can't run the latest analyzer code against a version of the SDK that the flutter_tools is happy with, however I rolled my analyzer code back to `2.0-dev.22` and repro'd this error, then applied the same changes from this PR to that version, and the errors went away.

Turns out to also fix #28895!

@bwilkerson

Closes #32133
https://github.com/dart-lang/sdk/pull/32133

GitOrigin-RevId: 94cc37479214beaf1c8e3e2befa9bef882dbcd5d
Change-Id: I32a5ce52c7b28e1d484c1e5e9a9dd6d64c2b1b3b
Reviewed-on: https://dart-review.googlesource.com/40720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-02-13 19:36:36 +00:00
Lasse R.H. Nielsen 736e310ed5 Reapply "Simplify logic for creating a single IsolateRunner in analyzer."
This reverts commit 83de2423ae.

Reason for revert: Error causing the revert did not seem to be related to this change anyway.

Original change's description:
> Revert "Simplify logic for creating a single IsolateRunner in analyzer."
> 
> This reverts commit 7867fed521.
> 
> Reason for revert: 
> Type error caught by DDC where the type of the function passed to isolate.run isn't what the runner expects.
> 
> Original change's description:
> > Simplify logic for creating a single IsolateRunner in analyzer.
> > 
> > Change-Id: I8583f9947fde8f4cf87d7feb64c8eb170a19e81d
> > Reviewed-on: https://dart-review.googlesource.com/6941
> > Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> 
> TBR=lrn@google.com,scheglov@google.com
> 
> Change-Id: I5a0e46e345673dee447fd848c064dd0039832fb1
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/7280
> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
> Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>

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

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

Change-Id: Ic3793a85d979b695dc62bafd19c490aa24547682
Reviewed-on: https://dart-review.googlesource.com/8060
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2017-09-26 12:26:10 +00:00
Lasse R.H. Nielsen 83de2423ae Revert "Simplify logic for creating a single IsolateRunner in analyzer."
This reverts commit 7867fed521.

Reason for revert: 
Type error caught by DDC where the type of the function passed to isolate.run isn't what the runner expects.

Original change's description:
> Simplify logic for creating a single IsolateRunner in analyzer.
> 
> Change-Id: I8583f9947fde8f4cf87d7feb64c8eb170a19e81d
> Reviewed-on: https://dart-review.googlesource.com/6941
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>

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

Change-Id: I5a0e46e345673dee447fd848c064dd0039832fb1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/7280
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2017-09-20 11:05:28 +00:00
Lasse Reichstein Holst Nielsen 7867fed521 Simplify logic for creating a single IsolateRunner in analyzer.
Change-Id: I8583f9947fde8f4cf87d7feb64c8eb170a19e81d
Reviewed-on: https://dart-review.googlesource.com/6941
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-09-20 09:14:59 +00:00
Konstantin Shcheglov 5517f356c8 Check for null in _getStandardStateLocation().
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/3006023002 .
2017-09-01 09:07:51 -07:00
P.Y. Laligand 59516d9794 Added an analysis server argument to set the location of the session cache. (#30583) 2017-08-31 10:25:50 -07:00
Konstantin Shcheglov 9dd0668ae2 Fix for DirectoryWatcher.handleError() closure signature.
I missed the fact that the closure must have either one, or two arguments,
I see failures at runtime in internal logs.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2782463003 .
2017-03-28 09:42:36 -07:00
Brian Wilkerson f645c34bb0 Add support for copying directory structures
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2733053002 .
2017-03-06 08:51:40 -08:00
Konstantin Shcheglov 81b725aa3f Filter out 'FileSystemException: Failed to watch path' from _PhysicalFolder.changes.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2660703002 .
2017-01-27 13:23:01 -08:00
Konstantin Shcheglov 891e709c5f Add File.lengthSync to use it for FileByteStore eviction.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2490023003 .
2016-11-10 13:31:06 -08:00
Brian Wilkerson 5bd4de469e Clean up warnings and hints
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2324463006 .
2016-09-09 09:09:59 -07:00
Konstantin Shcheglov c1cd58ce29 Issue 27243. Don't attempt to read Windows device drivers.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/27243

Review URL: https://codereview.chromium.org/2324513002 .
2016-09-07 13:00:08 -07:00
Paul Berry 94309733cd Revert "Remove unnecessary hide clauses"
The `Resource` class wasn't removed from the SDK until version
1.20.0-dev.0.0, which was only recently published.  Reverting this
change to allow people using older SDK releases a little more time to
upgrade.

This reverts commit 2cdafd82c2.

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

Review URL: https://codereview.chromium.org/2299243002 .
2016-09-01 16:08:43 -07:00
Brian Wilkerson 2cdafd82c2 Remove unnecessary hide clauses
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2305453002 .
2016-08-31 16:44:52 -07:00
Brian Wilkerson 6ccbef94fc Convert analysis server over to use ContextBuilder
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2286923002 .
2016-08-29 08:11:53 -07:00
Brian Wilkerson 3a6d80780b Add support for resolving symbolic links
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2270593003 .
2016-08-23 09:39:48 -07:00
Brian Wilkerson 17ffa1e9c0 Add writeAsStringSync (issue 27109)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2265593002 .
2016-08-19 12:17:13 -07:00
Brian Wilkerson 910b2ba016 Convert resource providers to use FileSource
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2245133005 .
2016-08-16 20:10:59 -07:00
Konstantin Shcheglov 9f187f3df5 Normalize paths in PhysicalResourceProvider.getFile()/getFolder().
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2239303004 .
2016-08-12 11:04:02 -07:00
Brian Wilkerson c03b85d418 Add a toUri method to Resource
R=paulberry@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/2165843002 .
2016-07-20 08:53:03 -07:00
Konstantin Shcheglov ed887c09d1 Validate cache consistency asynchronously. Compute modification times of physical files in a separate isolate.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2132073003 .
2016-07-08 15:01:05 -07:00
Konstantin Shcheglov d2e3078321 Add Resource.delete() method.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2067613002 .
2016-06-13 13:00:06 -07:00
Konstantin Shcheglov cb428694d3 Add Folder.getChildAssumingFile().
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2058163002 .
2016-06-10 10:37:43 -07:00