Commit graph

5461 commits

Author SHA1 Message Date
Konstantin Shcheglov b7a63c8d52 Use @isTest and @isTestGroup to understand executable element as a test/group.
R=brianwilkerson@google.com, devoncarew@google.com

Bug: https://github.com/flutter/flutter-intellij/issues/2055
Change-Id: I7c8e7639d111eca63df0780ebdec182573493047
Reviewed-on: https://dart-review.googlesource.com/53690
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-04 17:09:06 +00:00
Dan Rubel 64754764b1 Update computeType to call computeTypeParamOrArg
This is another step to replacing parseType with computeType
and improving recovery when parsing types and type arguments.

This adds a new computeTypeParamOrArg utility which returns
one of a couple constants for common situations or an instance
of ComplexTypeParamOrArg. The computeType function and
some places in ComplexTypeInfo class have been updated to use
this new method, but there are additional places that will be
tackled in subsequent methods.

Change-Id: I7012b65580e9dbc74b9424456262aa3c0367f48b
Reviewed-on: https://dart-review.googlesource.com/53641
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-04 13:38:07 +00:00
Paul Berry 8f52be2282 Don't infer types when there's an irreconcilable type mismatch.
Also fix the type inference algorithm so that when it explores
multiple alternatives (as a result of the use of FutureOr<>), if one
alternative generated some constraints but failed to produce a match,
it rewinds those constraints and tries the other alternative.
(Previously, it erroneously assumed that if any constraints were
generated, the alternative matched successfully).

Also add unit tests to verify the proper operation of the subtype
match algorithm.

Fixes #32305.

Change-Id: I060b5d6d5247a68d2b27bba78819bae172e43d97
Reviewed-on: https://dart-review.googlesource.com/53685
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
2018-05-03 23:27:14 +00:00
Konstantin Shcheglov dfa661d460 Add AnalysisSessionHelper.getTopLevelPropertyAccessor().
R=paulberry@google.com

Change-Id: I37c172ff087e1f4a6a859abb1304d18aedd34dfe
Reviewed-on: https://dart-review.googlesource.com/53686
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-03 21:51:14 +00:00
danrubel e93b2ee250 Improve typedef identifier recovery
... and also address comment in
https://dart-review.googlesource.com/c/sdk/+/53140

Change-Id: I915fe4433102bfcbdac95bb63416587b03b98680
Reviewed-on: https://dart-review.googlesource.com/53300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-03 15:14:43 +00:00
Konstantin Shcheglov fd27cc3435 Don't store bytes in the file cache.
We needed bytes only to get their length.
This CL replaces it to using the content (String) length.
This should help to fix heap usage regression.

R=paulberry@google.com

Change-Id: I4d58e91987db21233a71ca600eea8fae3fb38346
Reviewed-on: https://dart-review.googlesource.com/53243
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-01 21:11:04 +00:00
danrubel bf91621857 Improve fasta parser import prefix recovery
Change-Id: Ib1265cee27ff4e7cfc20012d3e4281cd151accdc
Reviewed-on: https://dart-review.googlesource.com/53140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-01 11:26:11 +00:00
Janice Collins 6d9371aec3 Prepare for analyzer-0.31.2-alpha.2
Change-Id: Ib428b7316633bb77978428a17956bc05e736d57d
Reviewed-on: https://dart-review.googlesource.com/52981
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2018-04-30 17:56:31 +00:00
Dan Rubel 79a15f52bf Fix isValidMethodTypeArguments
Change-Id: I3c4bb8dc981c285b8ecfad7dcd7dc849ed1bda7b
Reviewed-on: https://dart-review.googlesource.com/52920
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-28 18:10:06 +00:00
Leaf Petersen 0b8734acb2 Fix some erroneous errors associated with returns in void functions.
Fixes https://github.com/dart-lang/sdk/issues/32443 .

A separate CL with language tests for a super set of the errors covered by this CL is in progress.

Change-Id: I1a0f6a6a347f75b8e332c8bfccf8fbbd32f20efe
Reviewed-on: https://dart-review.googlesource.com/52980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-27 22:08:09 +00:00
Konstantin Shcheglov e44bc903e0 Remove UnitLintRule.
R=brianwilkerson@google.com

Change-Id: Ib89333a6afc6a4785eff47ee3433c9e0dc8a5a40
Reviewed-on: https://dart-review.googlesource.com/52883
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-04-27 17:51:26 +00:00
Konstantin Shcheglov 70547d8197 Change linter subscriptions from functions to AstVisitor(s).
The performance I see is similar to using functions.

R=brianwilkerson@google.com

Change-Id: Ib5f675f07b422bd9e6f28df0f9d7ea8b24669f63
Reviewed-on: https://dart-review.googlesource.com/52881
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-04-27 16:51:47 +00:00
danrubel 88a098c71c Improve fasta parser field name recovery
Change-Id: I3a27b765df7543eda56c8ef691d6a3192a2769f1
Reviewed-on: https://dart-review.googlesource.com/52621
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-27 11:58:30 +00:00
Brian Wilkerson 1c5d1a56e7 Clean up some hints
Change-Id: I623a4d86912ad0666b75ad519c15c84b24a5b579
Reviewed-on: https://dart-review.googlesource.com/52861
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-04-26 22:29:06 +00:00
Brian Wilkerson cb15b43c32 Add support for getting parse results synchronously
Change-Id: I2a6c4507fcc6debf3d4ffc3458621100d184619b
Reviewed-on: https://dart-review.googlesource.com/52820
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-04-26 20:24:46 +00:00
Konstantin Shcheglov c97d36c127 Add all concrete AST nodes for lints to subscribe.
R=brianwilkerson@google.com, pquitslund@google.com

Change-Id: Idb21390d49e5963f28c14db8d3ae27e77287e7c3
Reviewed-on: https://dart-review.googlesource.com/52741
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-26 18:19:21 +00:00
Janice Collins 1afe71c08a Enable preview-dart-2 as default for analyzer.
Based on https://dart-review.googlesource.com/c/sdk/+/52340, but adds
the necessary plumbing through the test system to pass through
negations to strong and preview-dart-2.  Also adds support for those
negations to the analyzer.

Change-Id: I9793ff28bb593d25bbb0a2ed8736b5b53e0a62d8
Reviewed-on: https://dart-review.googlesource.com/52461
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-26 17:01:12 +00:00
Konstantin Shcheglov 1030189d56 Add NodeLintRule and UnitLintRule that replace AstVisitor in lints.
This makes the Flutter repo analysis about 6% faster.

Before: 56.9 57.4 56.9 57.3 56.5 56.9 56.6
After:  53.5 53.0 53.8 54.3 53.5 53.0 53.0

To see the different better, I ran lints 100 and 10 times for each file.
Before: 628 621 109 107 109
After:  338 333  77  75  76

To get these numbers we will need to make corresponding changes to lints,
to implement these interfaces, so that they are used instead or the
current visitors. I have these changes locally, but we would need to
publish analyzer first.

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

Change-Id: I8b4efe05f815082fe39c33c303bb92b7dac19f65
Reviewed-on: https://dart-review.googlesource.com/52644
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-25 21:22:42 +00:00
Brian Wilkerson 9e9b50d19d Improve error messages for annotations involving undefined names (issue 27788)
Change-Id: Iccfcb73b7671f50353b57a81817dec013b997a53
Reviewed-on: https://dart-review.googlesource.com/52640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-25 17:48:49 +00:00
danrubel 8d4074175f Improve fasta parser method name recovery
Change-Id: If0911c8ee8c8d403e711229e6f5f6bd4a8768c9c
Reviewed-on: https://dart-review.googlesource.com/52620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-25 15:09:59 +00:00
danrubel 34a1ba7307 Fix AstBuilder construction of if statement
... and update more analyzer tests

Change-Id: Ieed123e16e7ae451cf2046253deb0c7773091417
Reviewed-on: https://dart-review.googlesource.com/52500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-24 22:00:38 +00:00
Paul Berry dc21d3ce9d Export SyntheticBeginToken and SyntheticToken from the analyzer.
These classes are needed by the angular_analyzer_plugin project, and
we don't want to make it depend directly on front_end, so we need to
re-export the classes from the analyzer.  See discussion at
https://github.com/dart-lang/angular_analyzer_plugin/pull/558#discussion_r183825214

Change-Id: Ide0264e3e04f783eb9f68079cc2de8a6acfb94b3
Reviewed-on: https://dart-review.googlesource.com/52425
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-04-24 21:44:08 +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
Aske Simon Christensen 9c2fcedaf4 Error on missing method implementation in non-abstract class
Bug: https://github.com/dart-lang/sdk/issues/32013

Change-Id: I163a84e70e94852a05ce99b07ec883c610ea788c
Reviewed-on: https://dart-review.googlesource.com/52320
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-04-24 13:07:54 +00:00
danrubel 7dacba68d1 Improve fasta parser local variable declaration recovery
Change-Id: I586496953791a6755bb47e0199f786a5cee0d5aa
Reviewed-on: https://dart-review.googlesource.com/52360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-23 23:18:32 +00:00
Brian Wilkerson bf1d0efde2 Revert "Improve error messages for annotations involving undefined names (issue 27788)"
Change-Id: I017592bf8982ff51bb73eb5fe892f8d9cffb9c9d
Reviewed-on: https://dart-review.googlesource.com/52400
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-23 21:05:53 +00:00
danrubel 07daecf36f Improve fasta parser skip type variables
Change-Id: Icbf546a496dd1665615e4cb70d3fa130f770413d
Reviewed-on: https://dart-review.googlesource.com/52301
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-23 16:45:42 +00:00
Brian Wilkerson 1ffd7e529a Improve error messages for annotations involving undefined names (issue 27788)
Change-Id: Ib7af4bdd97e9f775646c90e8f49f021836125b78
Reviewed-on: https://dart-review.googlesource.com/52240
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-04-22 20:11:11 +00:00
danrubel 0e46a199fc Fix type reference prefixed annotation recovery
When recovering from an invalid annotation in a type variable
(e.g. "< @Foo.bar T >"), the parser could get stuck in an
infinite loop trying to recover. This fixes that situation.

Change-Id: If01e43b9eec575824329808eeb93437432830654
Reviewed-on: https://dart-review.googlesource.com/52300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-21 15:28:31 +00:00
Mike Fairhurst ebcd876d0c Remove broken overrides
Change-Id: I7815fb1a139bf4723e29177965cfde8942ef2d3e
Reviewed-on: https://dart-review.googlesource.com/52264
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-20 22:04:26 +00:00
Konstantin Shcheglov 6865041334 Issue 27098. Check that argument is assignable to parameter in call().
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/27098
Change-Id: I0d5ac65202b632646bd7b26170c55ab985d2523c
Reviewed-on: https://dart-review.googlesource.com/52263
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-04-20 21:50:59 +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
Brian Wilkerson 27d93e20c4 Remove unused code in a test
Change-Id: I83bae6d28c27dde2beaff470362e84b2fb0e5296
Reviewed-on: https://dart-review.googlesource.com/52161
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-20 20:17:30 +00:00
Mike Fairhurst bd757f9948 Redo #28580: instantiate bounds to bounds.
One thing to be careful of here is that function type bounds may be
left unbounded. However, their parameters and return type cannot refer
to a type parameter for resolve-to-bounds to work.

There are also a large number of ways that this can loop infinitely, and
a number of new guards had to be added (as well as some test cases) to
catch them all.

Change-Id: I14322f5f71d1f7b73b27a870553e5c588b2c7e2e
Reviewed-on: https://dart-review.googlesource.com/52062
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-04-20 17:25:09 +00:00
Brian Wilkerson 9d7e35b417 Unmake some breaking changes made in previous CLs
Change-Id: I4c28418f8e5a3c9af7b37f44d7ebd3cd2d818c16
Reviewed-on: https://dart-review.googlesource.com/52160
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-20 16:16:09 +00:00
danrubel 10b441b16b Improve conditional import expression recovery
This improves recovery when parsing conditional import expressions
by repositioning the synthetic closing ')' that was inserted by the
scanner in a less than optimal location.

This approach relies on the beforeSynthetic field being set correctly.
While the scanner still sets the 'next' and 'beforeSynthetic' fields
directly for efficiency, most other functions which update an existing
token stream have been revised to call 'setNext()' rather than setting
the 'next' field directly. This ensures that the 'beforeSynthetic' field
will be correctly updated.

Change-Id: Id631fd600c64d1feaf00593acb74a7070e354f07
Reviewed-on: https://dart-review.googlesource.com/52120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-20 13:58:50 +00:00
Dan Rubel bdfcc20846 Improve fasta parser formal parameter recovery
This CL improves recovery given invalid or malformed formal parameter
types and identifiers. This accomplished by switching the
parseFormalParameter method to use computeType rather than parseType,
improving recovery when parsing field initializers, and in the process,
further reducing the size of parseType and eliminating 6 unused
TypeContinuation elements.

Change-Id: I6f05d8018bf8d9f2c256e5a64408c29db006a8e2
Reviewed-on: https://dart-review.googlesource.com/52000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-19 20:25:58 +00:00
Brian Wilkerson 1a56d6534c Add a recovery test based on reported failure (and fix a minor bug)
Change-Id: Ieaa0309559f7b2cc5c24741f16194c98f9ba0df2
Reviewed-on: https://dart-review.googlesource.com/51960
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-19 18:47:19 +00:00
Dan Rubel 58dc646c85 Update parser recovery tests
Change-Id: Iab3523b61e878844e7e8ee296a7c4da289758028
Reviewed-on: https://dart-review.googlesource.com/51860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-19 15:05:58 +00:00
Aske Simon Christensen 2b09c1efc0 Revert "Error on missing method implementation in non-abstract class"
This reverts commit 7cc55d0372.

Reason for revert: More test fixes needed.

Change-Id: Ib36159184ffbd14ce3f7cca184ce2b8cdfec237c
Reviewed-on: https://dart-review.googlesource.com/51680
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2018-04-18 17:27:22 +00:00
Aske Simon Christensen 7cc55d0372 Error on missing method implementation in non-abstract class
Closes https://github.com/dart-lang/sdk/issues/32013

Change-Id: I8f49d2640ef92a3d9d723969208cdb5f397e806d
Reviewed-on: https://dart-review.googlesource.com/43660
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-04-18 14:39:09 +00:00
danrubel 17d7f23e71 Improve fasta parser conditional import recovery
Change-Id: I5479078d8d2c3de10b74ed04001fdd852a427c5c
Reviewed-on: https://dart-review.googlesource.com/51561
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-18 11:04:19 +00:00
Konstantin Shcheglov 5990a51456 Optimize computing exported namespaces in prelinker.
Similar to https://dart-review.googlesource.com/51442, we compute
export namespaces recursively and remember full export namespaces
when there are no cycles.

This makes Flutter analysis about 8% faster.

Before: 59.8 60.0 59.4
After:  55.2 55.3 55.1 55.6 55.4

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

Change-Id: Id78aae1ff475e4386e5a01a01b92f0768a0cd4aa
Reviewed-on: https://dart-review.googlesource.com/51582
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-04-18 01:11:28 +00:00
Dan Rubel 8e812ddaa5 Pass modifiers in beginFormalParameters event
This CL updates the beginFormalParameters event to include
the covariant and const/final/var modifiers, and cleans up
a number of unused classes and methods including:

* the original implementation of ModifierContext/Recovery
* handleModifier and handleModifiers events

Change-Id: Ie89a202d17872fba85cd1a477091472a8d2d223b
Reviewed-on: https://dart-review.googlesource.com/51380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-17 20:27:37 +00:00
Dan Rubel 9e3d94ba94 Move class name recovery into ClassOrNamedMixinIdentifierContext
Change-Id: I608c6a0a9f22cbfaf3a5193c0d57c628768475da
Reviewed-on: https://dart-review.googlesource.com/51480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-17 19:01:17 +00:00
Brian Wilkerson b936ffb329 Move several libraries out of the public API
Change-Id: I8259de00134310f25b1c6168940aea5190488999
Reviewed-on: https://dart-review.googlesource.com/51443
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-04-17 17:35:27 +00:00
Konstantin Shcheglov fcb4c671b0 Optimize computing exported namespaces in FileState.
Instead of chasing exports in each FileState library individually, we
perform recursive computation, and remember computed export namespaces
for visited branches. Cycles require special handling - we don't
remember partial namespaces, we compute one full export namespace and
so break the cycle; then the rest also can be computed in one pass.

This makes Analysis Server a bit faster for some Quick Fixes, and
what is more important, is a playground to test the idea of makeing
the similar change to _Prelinker. We spend 8% of total analysis time
chasing long chains of exports in Flutter.

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

Change-Id: Ia45cff9a7fb24aac2e72fe50752274b764462017
Reviewed-on: https://dart-review.googlesource.com/51442
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-17 04:45:58 +00:00
Brian Wilkerson 5460ddbab5 Move three more libraries out of the public API
Change-Id: I8e6aeaea35c739fb26e22ffcfc30a343ebbb5424
Reviewed-on: https://dart-review.googlesource.com/51363
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-16 22:15:28 +00:00
Devon Carew 9968728df1 Remove package:cli_util deps from package:analyzer.
Change-Id: I6bda63e31b9a8eb3e7ede406bd7e3e5748130ff6
Reviewed-on: https://dart-review.googlesource.com/51362
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2018-04-16 20:26:08 +00:00
danrubel 0ca8b6e5be Improve recovery when "assert" is used in an expression
Change-Id: I01e8c6fbe0faf6ce6ded32b2cfa1ec034f22588d
Reviewed-on: https://dart-review.googlesource.com/51341
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-16 20:20:49 +00:00
Brian Wilkerson d4a1896cfb Demote IMPORT_DUPLICATED_LIBRARY_NAMED to a warning
Change-Id: I2655446e333096f4c7f54a25e7659f9446a62bbf
Reviewed-on: https://dart-review.googlesource.com/50320
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-16 20:06:38 +00:00
Brian Wilkerson a865531f57 Remove two unused classes from the public API
Change-Id: I4d27bc95d3a3e0ffc3ad379ffd823abf4fff0db1
Reviewed-on: https://dart-review.googlesource.com/51244
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-16 19:15:29 +00:00
Konstantin Shcheglov 35fecb4a10 Issue 32896. Add isXYZ accessors to ParameterElementForLink_VariableSetter.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/32896
Change-Id: I2482912b9d18c7bdb9d08b0ffd06fbf4699427a3
Reviewed-on: https://dart-review.googlesource.com/51243
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-04-16 18:26:13 +00:00
danrubel 8df94f34fd Improve fasta parser await-for statement recovery
Change-Id: I8b3896437f6ed9d51bb79927dc7387103237d817
Reviewed-on: https://dart-review.googlesource.com/51340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-16 18:20:18 +00:00
Brian Wilkerson dd897d35a2 Move the task API out of the public API
Change-Id: I0fbafb4965ced89fb9a063edb773c3f1cb3a39fa
Reviewed-on: https://dart-review.googlesource.com/51242
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-04-16 18:18:08 +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
Peter von der Ahé 0cbd4b520a Address review comments from change 51120
Change-Id: I017fae6b5bc2c9f8afacd08e9e4d6a1edff2d1db
Reviewed-on: https://dart-review.googlesource.com/51127
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-04-16 12:13:01 +00:00
Dan Rubel ce2b0db370 Improve fasta parser "assert" recovery
Change-Id: Idf5a9c7fd73a0a4b34ab26fdf1032a516750928d
Reviewed-on: https://dart-review.googlesource.com/51180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-15 21:52:22 +00:00
Brian Wilkerson 805c08d8bf Fix a run-time type issue when running in Dart 2 mode
Change-Id: Ic612510dbdc893c86a8b66afd12fe044cbf50f02
Reviewed-on: https://dart-review.googlesource.com/51204
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-13 22:17:51 +00:00
Konstantin Shcheglov 6fe7a86e7f Replace SourceFactory.resolveUri() with resolveRelativeUri() in resynthesizer.
This makes Flutter repository analysis another 10% faster.

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

Before: 65.6 66.0 67.2 67.1
After:  60.7 60.3 59.7 61.1
Change-Id: Ie0282f9480c2553b549f9636edbab8a59df32e3f
Reviewed-on: https://dart-review.googlesource.com/51160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-04-13 17:55:05 +00:00
Leaf Petersen c2b338f1b7 Remove fuzzy arrow support from analyzer
Fixes #31637

Change-Id: I87767b92814455187ea71cc4caca786043dbbe3d
Reviewed-on: https://dart-review.googlesource.com/51100
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
2018-04-13 16:47:16 +00:00
Konstantin Shcheglov 9976cddcd7 Shared cache of FileState contents.
This makes Flutter repo analysis about 12% faster.

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

Base: 76.2 74.9 75.9
After: 65.6 66.0 66.6 67.1
Change-Id: I5afffdae15eacf2c09c4ede40d7312c8827bae0c
Reviewed-on: https://dart-review.googlesource.com/51061
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-13 16:43:36 +00:00
Brian Wilkerson c214c43758 Make LineInfo a public class
Change-Id: I1bc7f5302797374609752ea5293b96c30719b41f
Reviewed-on: https://dart-review.googlesource.com/51101
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-13 16:23:47 +00:00
Ian McKellar 92f1d0fab4 [gn] Allow single or double quotes in .config
Change-Id: I1b80d14d2f89c8f652005313860e9003f6856a9a
Reviewed-on: https://dart-review.googlesource.com/51001
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-04-12 23:07:56 +00:00
Brian Wilkerson e2ee654cd1 Make a method in MempryResourceProvider private
Change-Id: Iae42ab38e3ae379fa015fbbd5c0341f6539996db
Reviewed-on: https://dart-review.googlesource.com/51060
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-12 22:04:16 +00:00
Brian Wilkerson 5e1cb4d41b Make SourceRange part of analyzers public API
Change-Id: I06376814ab2992623fed6d3121baa861522186c9
Reviewed-on: https://dart-review.googlesource.com/51046
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-12 21:13:16 +00:00
Konstantin Shcheglov 6d7df88fa3 Delay computing file name sets until they are requested.
This makes Flutter repo analysis about 1 second faster.

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

Before: 74.8 74.8 73.3 72.7
After:  72.3 72.2 72.2 72.6
Change-Id: Iedc6a3d25a4de051b9207fbb6e549e7f3575a75a
Reviewed-on: https://dart-review.googlesource.com/51020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-04-12 19:36:09 +00:00
Brian Wilkerson 16a4ed7dc4 Remove an unused subclass of LineInfo
Change-Id: I9503b52de9ed43c94432dd9c6b36719c4192d610
Reviewed-on: https://dart-review.googlesource.com/50960
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-04-12 16:26:59 +00:00
Dan Rubel 58a6bfd974 Improve identifier recovery in expressions
Change-Id: I6af7f3398953d1f98dd186564af92da14d015f2a
Reviewed-on: https://dart-review.googlesource.com/50560
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-12 12:57:18 +00:00
Jenny Messerly a9c3dabb4c fix #32769, performance regression in Analyzer callable function support
isAssignableTo should check for subtype first, and it should only check
for a call method if the other side accepts a function type.

Also improves performance of the recursive guard checking: function
types should not need it (pruning takes care of that), so we can simplify
the code for interface types. Also adds TODO comments for some bugs I
found while reading the _matchSubtype code.

Change-Id: I7b3318e3cc1f89c09960efe82d3cfdbf48ab9746
Reviewed-on: https://dart-review.googlesource.com/49962
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-04-11 22:59:09 +00:00
danrubel 072bd1c88e Remove KernelLibraryBuilder proxies
Change-Id: Ib2326bc4700e5063c2885664389a5310d672fbea
Reviewed-on: https://dart-review.googlesource.com/50780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-11 18:12:36 +00:00
Brian Wilkerson 12950e8170 Fix the windows bot and update a missed test
Change-Id: I0d1237e9ffdbdac7bb4a5cc53f22c4530e8d24b7
Reviewed-on: https://dart-review.googlesource.com/50740
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-11 15:58:26 +00:00
Brian Wilkerson 98671b2659 Make DeclaredVariables immutable
Change-Id: I3d0233cfb4002140af7cf0166cd98466d73d630c
Reviewed-on: https://dart-review.googlesource.com/50580
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-11 01:58:51 +00:00
danrubel 5c508ff785 Update more IdentifierContext type reference recovery
Change-Id: I7268bce4379ac4613ecd182c9d41022f2a08e7c4
Reviewed-on: https://dart-review.googlesource.com/50521
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-10 19:38:41 +00:00
Brian Wilkerson 8054721512 Move DeclaredVariables to a better location
Change-Id: I17190a8e888cc37cded141cbaf028691db061e49
Reviewed-on: https://dart-review.googlesource.com/50540
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-10 19:25:11 +00:00
Brian Wilkerson 7764e6962e Initial API to build analysis contexts (replaces ContextLocator.locateContexts)
Change-Id: If00ce6321efb6ff4da96e654cfe2a0a8501bed95
Reviewed-on: https://dart-review.googlesource.com/50323
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-04-10 15:48:10 +00:00
Aske Simon Christensen bd39320b3b Recover from error on undefined continue label.
Closes https://github.com/dart-lang/sdk/issues/32800

Change-Id: Idbd11f1c17affc1e9a6dd7f4c6999464bac8982e
Reviewed-on: https://dart-review.googlesource.com/50220
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-04-10 14:33:11 +00:00
Dan Rubel 5e99872770 Improve missing/invalid type reference recovery
Change-Id: I52231fba7ebce51242393a0030325198bf51dfbf
Reviewed-on: https://dart-review.googlesource.com/50340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-09 22:53:28 +00:00
Konstantin Shcheglov 2471888d4a Serialize any MethodInvocation as possible const.
Bug: https://github.com/dart-lang/sdk/issues/32823
Change-Id: I0be8d25cf9d5ac16aacb693c4730ddaba3ccad5a
Reviewed-on: https://dart-review.googlesource.com/50160
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-09 18:58:06 +00:00
Brian Wilkerson 3575b810b3 Only add const in a constant context (issue 32819)
Change-Id: Ia149d812d2540fa98d76765ffb8b54fe32ecf010
Reviewed-on: https://dart-review.googlesource.com/50120
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-04-09 18:11:36 +00:00
Brian Wilkerson 71ffe976a9 Correctly handle constant fields when computing constness (take 2)
Change-Id: I03e78ff4a2ea18fa7362f159a07d6d035c59a4ae
Reviewed-on: https://dart-review.googlesource.com/50280
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-09 16:02:26 +00:00
Brian Wilkerson 00097adce0 Remove reference to deprecated setter
Change-Id: Ie775c23175363135f58ebc12d476db2640cf200b
Reviewed-on: https://dart-review.googlesource.com/50060
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-09 13:54:06 +00:00
Devon Carew 6ce79da9a1 Fix windows issues w/ the packages dir handling removal.
Change-Id: I78cf4b8787da7449f8a7a2840b9dd91e2342d5ec
Reviewed-on: https://dart-review.googlesource.com/49830
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2018-04-06 16:24:52 +00:00
Dan Rubel fd87a11ad0 Update fasta parser to generate error when "throw" missing expression
Change-Id: I6610400204e111a3a6cc7971159bfdd6c2e58794
Reviewed-on: https://dart-review.googlesource.com/49880
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-06 16:10:12 +00:00
Devon Carew 7cbd0f55b5 Remove the special casing of 'packages' files from the analyzer and analysis server.
Change-Id: I11fa2f73f7cdba8c53478c9002cefe82e58c09d6
Reviewed-on: https://dart-review.googlesource.com/49822
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-06 14:57:42 +00:00
Devon Carew e448d18591 Allow empty flutter: sections in pubspec files.
Change-Id: Ibdea9fff8f20659abd7da10f0ef11b7a042e5436
Reviewed-on: https://dart-review.googlesource.com/49625
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-05 16:03:16 +00:00
Dan Rubel edb6e776f1 Update parseFields to use typeInfo
... and remove typeContinuation from top level parsing,
class member parsing, and ModifierRecoveryContext2

Change-Id: I2a9653e42c180a050316205fdf320c61c30ae47c
Reviewed-on: https://dart-review.googlesource.com/49562
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-05 14:49:46 +00:00
Aske Simon Christensen bbb281ff3b Error reporting functions take a list of context messages.
Change-Id: I8f48944d3c25099827c820d2b7f49ab44c60abd2
Reviewed-on: https://dart-review.googlesource.com/44462
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-04-05 13:29:16 +00:00
Devon Carew e27b800e2a Don't emit errors for lint rule names.
Change-Id: Iafcb0cba215e07cfe5b9e30b6983dd69c2e1492b
Reviewed-on: https://dart-review.googlesource.com/49520
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2018-04-04 19:05:35 +00:00
Peter von der Ahé 47f09a619e Redesign LibraryPart
Before, the part-URI was serialized as a file-URI and conflated with
source location information. The part-URI is the URI in the following
declaration in a Dart source file:

   part "URI";

This is different from what we normally call a file-URI. A file URI
is used to point to the source location of the part declaration, not
the URI in the part declaration.

Furthermore, the field was serialized using writeUriReference which
only works for URIs that are in the uriToSource map on a Component.
Although this might seem like a safe optimization, it doesn't work
if the uriToSource map is omitted or if a part declaration refers to
a missing file.

Finally, due to the confusing use of fileUri, LibraryPart was
mistakenly implementing FileUriNode and annotations were stripped
of source locations if the source for the part were omitted from
uriToSource.

The partUri field is now an unresolved string that can be resolved
against either the parent library's import- or file-URI to obtain
either version as needed.

Change-Id: I255cb4eeaf89928292ab32a2f6be9ead6cc8cee1
Reviewed-on: https://dart-review.googlesource.com/49500
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-04-04 16:08:57 +00:00
Dan Rubel d0ad78db24 Improve recovery when "set" found in function body
Change-Id: I11cab70a526fb52b61be9ff91ad94b6fd23044e2
Reviewed-on: https://dart-review.googlesource.com/49340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-04 14:43:23 +00:00
Dan Rubel bec3801a02 Improve recovery when mixin app missing "with" clause
Change-Id: I81849a973f1033f271b39de851c6335cae63377f
Reviewed-on: https://dart-review.googlesource.com/49241
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-03 20:45:19 +00:00
Dan Rubel 701e02b2fa Update AstBuilder to handle named function declaration
Change-Id: I34e699e49b7138b6d0ecf7087afef9739888c716
Reviewed-on: https://dart-review.googlesource.com/49240
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-03 20:45:19 +00:00
Dan Rubel 57d6ec265d Improve AstBuilder for-in recovery
Fix AstBuilder recovery when for-in expression is not a simple identifier

Change-Id: Id32ec4f8054de7870d8424c489dc5f5819ec7632
Reviewed-on: https://dart-review.googlesource.com/49181
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-03 18:08:29 +00:00
Konstantin Shcheglov 0ea0c42313 Extract AnalysisDriverResolutionTest and corresponding Kernel version into separate files.
Large files are pain to work in.

R=brianwilkerson@google.com

Change-Id: I94ba96323a4de41b1b67e72a4ac21644e13815ef
Reviewed-on: https://dart-review.googlesource.com/49220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-03 17:47:27 +00:00
Dan Rubel ca7edd065c Improve invalid function body recovery
* Improve error message for use of "return" instead of "=>"
* Improve recovery given extraneous "return" after "=>"

Change-Id: I0e421ece1128f98b883b6c9110f1a5eaaced3d78
Reviewed-on: https://dart-review.googlesource.com/49180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-03 17:31:39 +00:00
Konstantin Shcheglov 83418436b7 Issue 32740. Support for implicit call() invocation in top-level inference.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/32740
Change-Id: I669ca31653019c30a19f45f527b2bd7023ff80b0
Reviewed-on: https://dart-review.googlesource.com/49100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-04-03 16:04:40 +00:00
Brian Wilkerson 8d78982c3f Move file system access support from AnalysisContext to ContextRoot
Change-Id: Ic9097b8852e578001cc6555bcd4d8a94a1fde08d
Reviewed-on: https://dart-review.googlesource.com/49041
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-04-02 22:16:25 +00:00
Dan Rubel 1daa81339f Improve fasta parser enum declaration recovery
In addition to improving recovery when an enum declaration is missing
a body, this CL also fixes ensureBlock to report an error on the
correct token and cleans up some more analyzer tests.

Change-Id: I96e9f8380b8d92082d94fcc9fa4b8cfe113fa238
Reviewed-on: https://dart-review.googlesource.com/48980
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-02 17:55:14 +00:00
Konstantin Shcheglov fabc51bbf7 Silence parser recovery tests.
I realize that it is convenient to get debug output while working on
a test, but it is probably better to enable this debug output only
while one is working in this area, not for everyone ;-)

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

Change-Id: I4027b3351eba07ba2b5e13471bbdb076ee72d388
Reviewed-on: https://dart-review.googlesource.com/48764
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-04-02 17:50:54 +00:00