Commit Graph

27 Commits

Author SHA1 Message Date
Paul Berry 91540068d3 Analyzer: Fix null safety migration error in message generation
When generating the file
`pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart`, we now need
for the top level variable `fastaAnalyzerErrorCodes` to have type
`List<ErrorCode?>`.

The generated file was updated in
9f986d2501 as part of migrating the
analyzer package to null safety; this updates the code generator so
that when it is re-run in the future we won't lose the change.

Change-Id: I893c1fe6f206d5dfbfebbf7bb80d5a00fc7b56be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182365
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-03 00:02:19 +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
Lasse R.H. Nielsen 6e29700e16 Update List constructor documentation, deprecate constructor.
Emphasize that the operation is going away,
and mark constructor as deprecated.

TEST= Refactoring+deprecation only, covered by existing tests.

Change-Id: I82aa044cd2cf7bf347b624371399f44bda8f4a07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173261
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-12-07 16:20:28 +00:00
Paul Berry 7d3bc4862d Rename pkg/analysis_tool to pkg/analyzer_utilities.
It's no longer just for the tools in the `tool` directory; it also
contains test utilities for use by the analyzer and related packages.

Change-Id: I0f8cf57f24ea7aad8e2177e43ee2bcb2ab3030da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171704
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-13 17:46:30 +00:00
Paul Berry 596198fb74 Share logic of package_root.dart
This CL unifies the implementations of `package_root.dart` found in
packages `analysis_server`, `analysis_server_client`, `analyzer`, and
`analyzer_plugin`.

This should make it easier to re-use this logic in other packages,
such as `nnbd_migration`.

Change-Id: I0da44edb379b8e929dd0b1c16a6989c1e9418acb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-11-11 18:09:18 +00:00
Paul Berry 2412bc1643 Add a safety check to analyzer messages codegen.
Previously, if the user added an `index` field to a message but failed
to add an `analyzerCode` field, code generation would just silently
ignore the index.  This was error prone.  Changed to report
`invalidAnalyzerCode`, which is the same error we report if the
analyzer code is improperly formatted.

Change-Id: I37de06058cd1938af2c9ef506412dc7960986269
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158402
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-08-13 15:25:54 +00:00
Sam Rawlins a558d576b7 Use ///-style doc comments in analyzer/tool
Bug: https://github.com/dart-lang/sdk/issues/33892
Change-Id: I67094e84af2ec54ede00b248a2e67d3cebadc576
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152702
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-06-26 18:46:25 +00:00
Jens Johansen 4ab3bda5db [parser] Change recovery for constructor; report errors in bad constructors
Change-Id: I3d656afce4a3ec14c7c099893a434abba3945ebf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140862
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-03-27 11:57:56 +00:00
Sam Rawlins 40718899fe Fix pedantic 0.9 lints around collection literals and spreads
Change-Id: I64277c36fbeb4ea7a1bb429a8e0a40203520c883
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128380
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-12-14 00:15:41 +00:00
Konstantin Shcheglov 54b7543c55 Fix unnecessary_const in analyzer.
The only non-mechanical change is update for tool/diagnostics/generate.dart
to handle MethodInvocation, because without resolution and without
explicit `new` and `const` we get MethodInvocation(s).

R=brianwilkerson@google.com

Change-Id: Ib89ce9c37066e9b27ad03aed96b349ef36f11d43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127453
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-12-06 15:03:00 +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
Brian Wilkerson 1f933abcee Convert a compile time error into a parse error (issue 39389)
Change-Id: I115c7bb4ab05f8c6e9ddc566985126a1b9a09842
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125621
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-11-19 18:25:29 +00:00
Johnni Winther 00c2962db8 [cfe+analyzer] Move messages, scanner and parser to package:_fe_analyzer_shared
Change-Id: I4fa87aee65f30a9868a6cf8f0342591869ece7ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123663
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-01 09:37:57 +00:00
Brian Wilkerson 61b4c0f770 Cleanup hints and lints in analyzer packages
Change-Id: I7f1a6ad1ed3610da9616683576ebfb5efd543fd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119164
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-09-27 16:12:44 +00:00
Brian Wilkerson 3c18db7d9e update analyzer error message generator to generate hasPublishedDocs
Change-Id: I87fae43033876c84448e785417bd5a72efe52ef9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118180
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-09-26 17:11:02 +00:00
Jens Johansen 74e09abc6e [CFE] Remove/move file that wasn't needed by frontend; cleanup pubspec.yaml a bit
Change-Id: I204b844e7f1cb892a529bca3a13017ed836275f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114074
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-08-23 07:42:03 +00:00
Dan Rubel 9197b34a0e generate analyzer experimental flags
Change-Id: I7dc2be03e7266b6ef0a936269a2dbe584096e3db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104785
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-06-05 14:17:35 +00:00
Kevin Moore ca4978e363 Add pkg:analysis_tool as an SDK-only set of utils
Reduces the API surface of pkg:analyzer that requires pkg:html

Related to https://github.com/dart-lang/sdk/issues/35802

Change-Id: Icd08d76190d6ab77cd180561cdde6df254b22557
Reviewed-on: https://dart-review.googlesource.com/c/91701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2019-01-31 16:52:05 +00:00
Dan Rubel 3b65f0ded8 Update the analyzer error code auto generation tool
to display a list of fasta error codes in the parser that are not yet auto generated.

Change-Id: Ic3c82c76de2af01b8a80c670e4783da18704c48e
Reviewed-on: https://dart-review.googlesource.com/c/86461
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-12-06 22:21:17 +00:00
Brian Wilkerson 9a69a5c1ee Remove more unnecessary awaits (from analyzer)
Change-Id: I796c8344db1d8bf225ef347cd09e419bb86b3a5f
Reviewed-on: https://dart-review.googlesource.com/c/80400
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-17 00:29:01 +00:00
Peter von der Ahé eb0ec965e3 Move codegen/tools.dart to package:analyzer
Change-Id: Iab61e0dfcdd0969d1bf35e27c13c336a944d14e6
Reviewed-on: https://dart-review.googlesource.com/c/77780
Commit-Queue: Peter von der Ahé <ahe@google.com>
Auto-Submit: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-10-03 07:41:43 +00:00
danrubel af2fd419fb Update more analyzer error codes to be generated from messages.yaml
Change-Id: I1d8a0db791309ac3551fc1079f91807e6e98dcb2
Reviewed-on: https://dart-review.googlesource.com/75603
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-20 18:10:04 +00:00
danrubel ffa99b9cde Update analyzer error code generation
This fixes error code generation when template contains a backslash

Change-Id: If14cbd07605eab454b00c6970d1e21349ac7a662
Reviewed-on: https://dart-review.googlesource.com/75602
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-20 16:54:58 +00:00
danrubel 61096acab3 Improve analyzer/fasta error code matching
This addresses a comment in https://dart-review.googlesource.com/c/sdk/+/74600,
updates the "run fasta generate first" exception message,
and converts more Analyzer errors to be auto generated.

Change-Id: I9c98184d1b9fe642dab4d66fbcd961dc27dfa6f9
Reviewed-on: https://dart-review.googlesource.com/74900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-13 21:03:47 +00:00
danrubel 29847b8235 Improve analyer error code template matching
... and auto generate more Analyzer error codes

Change-Id: I8b6097685aad30d59e9513656581782819d5ce2e
Reviewed-on: https://dart-review.googlesource.com/74600
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-12 14:45:00 +00:00
danrubel 25d14df016 Auto generate more ParserErrorCodes
Specifically:
* CONTINUE_OUTSIDE_OF_LOOP
* EXTERNAL_CLASS
* EXTERNAL_ENUM
* STATIC_CONSTRUCTOR

Also:
* Exclude classes that are already auto generated from the list of those
  that could be translated,
* Print summary after checking for manual changes
* Generate error codes before checking if manual changes need to be made

And address comments in
* https://dart-review.googlesource.com/c/sdk/+/74040
* https://dart-review.googlesource.com/c/sdk/+/74240

Change-Id: I573215d58e14749edd02a2416389df3047841002
Reviewed-on: https://dart-review.googlesource.com/74520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-11 21:01:46 +00:00
danrubel c7960df357 Generate analyzer error codes from messages.yaml
With this change, analyzer error codes can be generated from messages.yaml
and those error codes easily translated from the corresponding fasta error.

Each fasta error code in messages.yaml that has an "index:" field
(see prior CL https://dart-review.googlesource.com/c/sdk/+/74040)
now has an Analyzer error code automatically generated
with the information in messages.yaml. In addition
a list of all indexed errors is generated so that a fasta error
code can be quickly translated into an Analyzer error code.

Change-Id: I2d534b7349590ddd54996f564db786c6ffe259b3
Reviewed-on: https://dart-review.googlesource.com/74240
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-09-10 23:07:19 +00:00