Commit Graph

4276 Commits

Author SHA1 Message Date
Dan Rubel 587e4f8723 Parse local function metadata
Change-Id: I6b578b295e645cf270126de93b03232acd302101
Reviewed-on: https://dart-review.googlesource.com/47400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-21 14:21:09 +00:00
Brian Wilkerson 0e764393f3 A few more Dart2 related fixes
Change-Id: If2503b93e11f0831787dfa21e5ae0abb74e9162f
Reviewed-on: https://dart-review.googlesource.com/47302
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-20 20:17:59 +00:00
Konstantin Shcheglov 965cb81c0f Add AnalysisSessionHelper and move getClass() into it.
R=brianwilkerson@google.com

Change-Id: I5d1f121ff86d1eea75d6f79663394bb79305c4ca
Reviewed-on: https://dart-review.googlesource.com/47187
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-20 19:05:24 +00:00
danrubel 08d305bbd7 Inline modifiers into endTopLevelFields and endFields events
Change-Id: I9681e22ae96c43626558ff567cbf4a12117095fa
Reviewed-on: https://dart-review.googlesource.com/47240
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-20 15:00:35 +00:00
Brian Wilkerson efab00ce5c Fix type issues caused by running with --preview-dart-2
Change-Id: I99758d562e0140095d8f539419da9a98a55e6132
Reviewed-on: https://dart-review.googlesource.com/46941
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-20 13:36:17 +00:00
Dan Rubel adb9f8cc0b Inline modifiers into beginClassDeclaration and beginNamedMixinApplication
Change-Id: I0d95029c203a77d4a9e9dc2d8f1b40bced7535c5
Reviewed-on: https://dart-review.googlesource.com/47186
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-20 13:28:17 +00:00
Konstantin Shcheglov ac322d0fb4 Move LibraryElement caching to AnalysisSession.
I need something similar for Extract Widget refactoring - get references
to some Flutter types, which are probably already available from the
resolved unit.

R=brianwilkerson@google.com

Change-Id: I8d9a9e6c35c9fe7ef8fba6547c560642f650d018
Reviewed-on: https://dart-review.googlesource.com/47184
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-19 22:26:47 +00:00
Dan Rubel 06949dc985 Inline modifiers into beginFactoryMethod event
Change-Id: Ibc1053126b020577625279f4fab0bcff71aa5d15
Reviewed-on: https://dart-review.googlesource.com/47182
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-19 22:04:37 +00:00
Konstantin Shcheglov 8eb9f3db80 Create new AnalysisSession instance on changes.
R=brianwilkerson@google.com

Change-Id: I98ec3e28eadc20076a22ae9ac5d872557e73c9ef
Reviewed-on: https://dart-review.googlesource.com/47181
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-19 21:01:38 +00:00
Dan Rubel 8fde515354 Inline modifiers into beginTopLevelMethod event
Change-Id: I40423fcd53dc6a374a1c5be280d1806c31f34a6d
Reviewed-on: https://dart-review.googlesource.com/47120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-19 20:20:37 +00:00
Konstantin Shcheglov 1d184ace7b Fixes for packages:args deprecated uses.
Mostly addOption() -> addMultiOption().

Change-Id: Iab40059aab45a371e0def89fbdfcd08bd1487d47
Reviewed-on: https://dart-review.googlesource.com/47121
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-19 20:15:37 +00:00
Konstantin Shcheglov 538dbb62d6 Don't expect type arguments for class type parameters of static methods.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/32396
Change-Id: I4b6b6804cfced4c6628198a7e99e0123f77c2108
Reviewed-on: https://dart-review.googlesource.com/46940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-19 17:03:15 +00:00
Brian Wilkerson 209809eee0 Changes to AST impl classes
Change-Id: I2889157892e4a9666d15c5346d0ea24fe8d9d7a0
Reviewed-on: https://dart-review.googlesource.com/47062
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-19 16:19:56 +00:00
Brian Wilkerson 1560f19844 Fixes to make analyzer preview-dart-2 safe, part 1 of many
Change-Id: I8f88168a1fab61b3d0d808b5d9e09e6391325302
Reviewed-on: https://dart-review.googlesource.com/46953
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-19 13:15:46 +00:00
Dan Rubel b2dd274e08 Remove modifiers from local function event structures
This removes pushing and popping modifiers when parsing a local function
declaration since they cannot have modifiers.

Change-Id: Iabbc6bb050d7006d07d4ec5d2220947593d62fd6
Reviewed-on: https://dart-review.googlesource.com/46880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-16 16:05:07 +00:00
Brian Wilkerson 02ac20deb0 Fix bug in optional new/const support
Change-Id: I5798e3ea145f87fe34a996205e2903533179918f
Reviewed-on: https://dart-review.googlesource.com/46578
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-15 20:52:34 +00:00
Konstantin Shcheglov c9cb9c6700 Infer type arguments in constructor redirections.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/30855
Change-Id: I05e9102fe7b7a304be6ac6dd4d59e11bdafee59c
Reviewed-on: https://dart-review.googlesource.com/46575
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-15 19:37:45 +00:00
Peter von der Ahé 4f2bdff90b Rename Program to Component
Change-Id: I1a3cc03fba9783807fa637a9d42fdbad68ee7686
Reviewed-on: https://dart-review.googlesource.com/31040
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-15 12:22:23 +00:00
Dan Rubel 55369c5ed6 Report error on "as void" and "is void"
Change-Id: I1835d2f2c9ff6a4eac21adb3cac3c03e1f613e00
Reviewed-on: https://dart-review.googlesource.com/46640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-15 11:42:53 +00:00
Konstantin Shcheglov 389ad7e93f Issue 32114. Fix instantiating typedefs to bounds.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/32114
Change-Id: I215eafb6314fe265d4809ff6ed80e4a567365a4f
Reviewed-on: https://dart-review.googlesource.com/46381
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-14 00:31:18 +00:00
Devon Carew 5bc6d66bd9 fix a few --preview-dart-2 issues
Change-Id: Ib4bd63b826d8957cdd2db97e1d5311f52bcdf921
Reviewed-on: https://dart-review.googlesource.com/46304
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2018-03-13 17:46:09 +00:00
Brian Wilkerson ea94e65b43 Make preview-dart-2 imply strong-mode
Change-Id: Ifa230f9e64a538e222557ea471dc728ad3dd01d7
Reviewed-on: https://dart-review.googlesource.com/46300
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2018-03-13 17:15:39 +00:00
Paul Berry 28cdeb3a49 Store method invocation arguments in summaries when needed for type inference.
When summarizing an initializer expression that contains a method
call, we need to store the method arguments in case they are needed
for type inference.  They might be needed if the method in question is
a generic method and no type arguments are provided at the call site.

Since we do serialization based on an unresolved AST, we can't tell if
the method in question is generic at serialization time, so we
serialize the arguments of any method invocation that doesn't specify
explicit type arguments.

Addresses one of the root causes of #32394

Change-Id: Ibb50bdfc5ed29a518f51b13d2ffd72c484ab461d
Reviewed-on: https://dart-review.googlesource.com/46301
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-03-13 16:03:59 +00:00
Brian Wilkerson f1586f3bca Remove the unused type parameter from ResultCachingPolicy
Change-Id: I858eaf7365d668bcb19ea35f6d0bbdee4b42897c
Reviewed-on: https://dart-review.googlesource.com/46160
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-13 15:30:09 +00:00
Konstantin Shcheglov c0d69c365e Include default constructor in getElementDeclarations().
We record actual empty name for such constructors.
The client has enough information - kind CONSTRUCTOR, and empty name,
to decide on presentation.

R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/32495
Change-Id: I7cfd09c1e012a7c5ee72f7bb32fb0f258aaff148
Reviewed-on: https://dart-review.googlesource.com/46004
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-12 18:38:29 +00:00
Konstantin Shcheglov de6b837b5f Support for function typed parameters in getElementDeclarations().
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/29510
Change-Id: I2ae8f69cd265286537623eaa0bf15a62c35a5bb8
Reviewed-on: https://dart-review.googlesource.com/46003
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-12 17:40:58 +00:00
Konstantin Shcheglov 693390a776 Index and search implicit references to optional positional parameters.
R=brianwilkerson@google.com

Change-Id: Icf5f48118aeccbc137f125f9e730c9fe84200063
Reviewed-on: https://dart-review.googlesource.com/45922
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-09 23:23:49 +00:00
Konstantin Shcheglov 977f4c706f Issue 32397. Fix for top-level inference and implicit creation.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/32397
Change-Id: Idec5867cfd0ac3e6c0f650afb7f282e66aea91ce
Reviewed-on: https://dart-review.googlesource.com/45880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-09 21:20:00 +00:00
Brian Wilkerson 528d9d2e1f Do not hint when only a responsive asset exists (issue 32250)
Change-Id: I8dc5402bb6d4e20682b49fa653349f03da934afe
Reviewed-on: https://dart-review.googlesource.com/45841
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-09 20:26:29 +00:00
Brian Wilkerson 5eb6d980b5 Do not hint when using a deprecated parameter in the defining function (issue 32468)
Change-Id: I71de5c121add7bca7faa0875573e27f17f672e44
Reviewed-on: https://dart-review.googlesource.com/45840
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-03-09 19:09:08 +00:00
Brian Wilkerson 602a8c2a7b Clean up usage of deprecated constants
Change-Id: I9005ba6e94529e15d8f7b21322591f4a9dabec47
Reviewed-on: https://dart-review.googlesource.com/45763
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-03-09 01:02:49 +00:00
Konstantin Shcheglov eea08cfabe Add optional 'file' for getElementDeclarations.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/32461
Change-Id: I0fa5ab2165e24f5b17ecc20ad8f97471389c8b8f
Reviewed-on: https://dart-review.googlesource.com/45761
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-08 19:10:47 +00:00
Brian Wilkerson 69f8d4ef0d Fix parsing of super expressions (issue 32393)
Change-Id: I887288254eb1be33c111b6dedd16c2acd3eb3dd1
Reviewed-on: https://dart-review.googlesource.com/45440
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2018-03-07 00:43:21 +00:00
Paul Berry b5b8080b2c Disable the conflicting generics check when using the old task model.
This is necessary since the old task model doesn't implement mixin
type inference properly.

Works around bug #32421.

Change-Id: I6d7873d658d9d0fd8ea6aa5d2452bf9e92947032
Reviewed-on: https://dart-review.googlesource.com/45200
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-03-06 14:14:54 +00:00
Mike Fairhurst 748cfdff7e Refactor to efficiently find analysis roots correctly fix #31343 & #31344.
Move logic out into a ContextCache since we're not interested in caching
at least two if not three things (the options, the options path, and
optionally the builder).

Move some convenience methods around accessing contexts into a mixin.

Regarding some semantic decisions for finding analysis roots:
* treat the analysis_options.yaml file as the analysis root if it exists
* if it doesn't exist, assume the directory passed in is the root
* if custom options are provided, assume they "overwrite" the others
  _in-place_.

Tests to confirm this logic via excludes configurations with & without
the yaml file specified, passing in the root in some cases and
subdirectories in others.

Also change to use PathFinder for handling wildcards in excludes.

Bug: 31343,31344
Change-Id: I400fe30a1ec379f9040f812fc0bd9481d42a13cf
Reviewed-on: https://dart-review.googlesource.com/41570
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-05 23:51:00 +00:00
Brian Wilkerson 1d159e7c23 Rename annotation testing methods in Element
Change-Id: I0f60b9abd3de350e62d89eac0d690a1db40316b7
Reviewed-on: https://dart-review.googlesource.com/45080
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-05 17:23:48 +00:00
Brian Wilkerson 5fd560f96b Add getters to replace ParameterKind
Change-Id: I0886c8d032e963857b8054e894ed3343a235b5c2
Reviewed-on: https://dart-review.googlesource.com/44921
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-05 14:22:52 +00:00
Brian Wilkerson 0b332de3a8 Refactor where AST re-writing is happening to not interact poorly with inference (issue 32342)
Change-Id: Ia8c0d17cedb78709dce421658eb46ff6a80d56c5
Reviewed-on: https://dart-review.googlesource.com/44384
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-03-05 14:22:02 +00:00
Paul Berry 2993476129 Report an error if a class inconsistently implements a generic interface.
This is not allowed in Dart 2.0.

Change-Id: I6861ce298e5d5a5cf3f26a010990868b5ba9bda2
Reviewed-on: https://dart-review.googlesource.com/39601
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-03-05 12:13:12 +00:00
Paul Berry 11cbdbe26e When checking mixin type inference errors, don't skip mixins with explicit type args.
Fixes #32372.

Change-Id: I77bcdcdb5a764ba1d6075176800fa038aa46a1f9
Reviewed-on: https://dart-review.googlesource.com/44440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-03-05 09:10:01 +00:00
Dan Rubel e74e2b3c3e Pass varFinalOrConst in beginVariablesDeclaration event
This CL refactors the fasta parse variable declaration functionality
to pass the modifier with the begin event rather than using the
handleModifer and handleModifiers events.

* Refactor modifier parsing as described above
* Update same modifier parsing to use ModifierRecoveryContext2
* Cleanup functionality of ModifierRecovery2
* Remove 2 unused fasta parser methods

Change-Id: Ib3a6b24428dcf6ad3cb462a979a05600fe7ee673
Reviewed-on: https://dart-review.googlesource.com/44860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-03 21:51:31 +00:00
Dan Rubel 22f860a229 Update AstBuilder to report illegal assignment
Change-Id: Ic65fdc6274e73e20b2230048855ef1025548aa5b
Reviewed-on: https://dart-review.googlesource.com/44820
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-02 21:10:59 +00:00
Dan Rubel 590d85876e Report "missing statement" error on void
Also address comments in
https://dart-review.googlesource.com/c/sdk/+/42800

Change-Id: I0fa1a61d1ec9a5a0db0d9d672ab8b436004980b5
Reviewed-on: https://dart-review.googlesource.com/44620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-01 21:04:48 +00:00
Konstantin Shcheglov 94540c56e9 Fix liking for GenericTypeAliasElementForLink.
R=brianwilkerson@google.com

Change-Id: Ibf1740453231e081c82b090186109cab3a54b76d
Reviewed-on: https://dart-review.googlesource.com/44580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-01 18:59:19 +00:00
Dan Rubel 989a3bfc23 Report error on invalid use of super
Change-Id: I361e88714a3221d947e4e90ed44df2bbcc8b6ec3
Reviewed-on: https://dart-review.googlesource.com/44562
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-01 18:54:48 +00:00
Dan Rubel babfa357ae Cleanup error reporter argument use
Address comment in https://dart-review.googlesource.com/c/sdk/+/43560

Change-Id: I99314676177861fdffae6b307dd13b1c47ed2da8
Reviewed-on: https://dart-review.googlesource.com/44561
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-01 16:52:58 +00:00
Dan Rubel 1065da5b34 Report error on duplicate label in switch statement
Change-Id: I4df8e6baf4dc7c14dd900a7212c3b6eda55a861b
Reviewed-on: https://dart-review.googlesource.com/44560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-01 16:52:58 +00:00
Paul Berry b1a5325171 Suppress "extends" check when inferring mixins.
This should be safe since the purpose of the inference is to find an
exact match for each type parameter; if an exact match is found but it
doesn't satisfy the "extends" constraint, that will be detected and
reported later.  If an exact match isn't found, the type bound will be
filled in my instantiate-to-bounds.

Addresses the analyzer portion of issue #32353.

Change-Id: Ic9f71eefac2fa3f6f126957b9d1652ca1d990b89
Reviewed-on: https://dart-review.googlesource.com/44220
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-03-01 05:55:26 +00:00
Dan Rubel 7ddeb32ec7 Update fasta parser to report error on "=" in for-in loop
In addition, this CL
* Inlines parseVariablesDeclarationOrExpressionOpt
* Adds for statement missing parenthesis recovery
* Removes TypeContinuation.VariablesDeclarationOrExpression
    and inline the functionality

Change-Id: Ied57eb35848026ab856f21c66283bc8883a9d5e1
Reviewed-on: https://dart-review.googlesource.com/44360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-02-28 21:22:34 +00:00
Dan Rubel 88c972de64 Address comments https://dart-review.googlesource.com/c/sdk/+/43800
Update AstBuilder to report interpolation in import conditional

Change-Id: Ie3c4971f6c5e99ecc018c5cedf934e37640778b2
Reviewed-on: https://dart-review.googlesource.com/44081
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-02-28 00:37:56 +00:00