Dan Rubel
d26c310a27
Rework parsing of local const declarations
...
Similar to earlier work that reworked parsing of variable declarations,
this CL reworks parsing of local constant declarations to use
TypeInfo rather than parseType. This simplifies and improves recovery,
and reduces the number of error messages in some recovery situations.
Change-Id: I32705bdba20a0cb7aee41c64510c4c2896a5ae68
Reviewed-on: https://dart-review.googlesource.com/47241
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Dan Rubel <danrubel@google.com >
2018-03-20 22:50:20 +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
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
Dan Rubel
fd005e17bc
Rework parsing of local function declarations
...
This CL reworks parsing local variable and local function
declarations to improve recovery and error messages.
In addition, the fasta parser properly parses metadata
before a local function declaration.
Change-Id: Ia43c8bab3f3ce3b824390a4aa36d50b85f1ea9af
Reviewed-on: https://dart-review.googlesource.com/46952
Commit-Queue: Dan Rubel <danrubel@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2018-03-20 12:01:26 +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
Brian Wilkerson
6856e70b2f
Disable unused tests
...
Change-Id: Ib5c50063215e282c2b28b2b2fc207a3d63f81413
Reviewed-on: https://dart-review.googlesource.com/47100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
2018-03-19 18:00:26 +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
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
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
Brian Wilkerson
e9cdb5d4a8
Convert more analyzer tests to pass under preview-dart-2
...
Change-Id: Id2c7069da725db2d2572507fb73b51f5ab574d8a
Reviewed-on: https://dart-review.googlesource.com/46571
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
2018-03-15 17:25:54 +00:00
Brian Wilkerson
8819d9fe98
Update analyzer tests for preview-dart-2, part 1
...
Change-Id: I3440607f7b3892193e1d9883709a1b9d4a7463d9
Reviewed-on: https://dart-review.googlesource.com/46562
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
2018-03-15 16:45:04 +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
71e16622cd
Improve for statement errors and recovery
...
This CL updates fasta parsing of `for` statements
to detect additional errors and improve recovery.
The parser originally called parseType when parsing `for` statements
which committed the parser down a particular path
and limited the ability of the caller to gracefully recovery.
Now the parser calls computeType, which parses and caches
the type information, so that the caller has more opportunity
to recover gracefully.
Change-Id: I6296ffb1f75e77a87a7533bfca77dae18cfcf60d
Reviewed-on: https://dart-review.googlesource.com/46383
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Dan Rubel <danrubel@google.com >
2018-03-15 11:43:13 +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
Dmitry Stefantsov
8c82c3b5fe
Fix instantiate-to-bound algorithm implementation
...
Change-Id: Ia13867b0ffab9fab527d8dba6d4f10cc90c002c2
Reviewed-on: https://dart-review.googlesource.com/43061
Reviewed-by: Samir Jindel <sjindel@google.com >
Reviewed-by: Peter von der Ahé <ahe@google.com >
Reviewed-by: Erik Ernst <eernst@google.com >
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com >
2018-03-13 19:18:34 +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
Dan Rubel
83c8c21abe
Gracefully handle local function modifiers
...
Change-Id: I23f5ab9c9aaaee595ab6c552a6dddf9522ee17cd
Reviewed-on: https://dart-review.googlesource.com/45400
Commit-Queue: Dan Rubel <danrubel@google.com >
Reviewed-by: Peter von der Ahé <ahe@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2018-03-07 12:47:31 +00:00
Leaf Petersen
7fe8bdb2ee
Refactor tests
...
Change-Id: I29caa5421d9a2d25726aaaf676fd319b595dde7f
Reviewed-on: https://dart-review.googlesource.com/44880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2018-03-07 01:57:31 +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
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
fe8eb7a402
Update some analyzer fasta integration tests
...
Change-Id: If479bb6c52e3ba6c8deadf20d16e484d4e7d96d3
Reviewed-on: https://dart-review.googlesource.com/44640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Dan Rubel <danrubel@google.com >
2018-03-01 22:16:28 +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
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