Commit Graph

110 Commits

Author SHA1 Message Date
Paul Berry b10a592341 Add a url field to DiagnosticMessage.
This paves the way for allowing analyzer and analysis server clients
to format diagnostic message URLs in a special way (e.g. to make them
clickable).

Note that DiagnosticMessage is part of the public API of the analyzer,
so I've retained the old behavior in a deprecated fashion to avoid
breaking clients that don't yet handle diagnostic messages containing
URLs.

See
https://dart-review.googlesource.com/c/sdk/+/193749/comment/86d1ce4b_77a60b1e/
for additional discussion.

Change-Id: Iae9d43a2be7dbc67cb7cb82afe0a7824043d6113
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196101
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-04-23 20:34:32 +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
Sam Rawlins 69cb9f7a67 Analyzer: Remove legacy parser (replaced by Fasta).
* Replace most of the implementation of Parser with the implementation
  found in _Parser2, which uses Fasta.
* Rework Parser constructor to do exactly what the previous factory
  constructor + _Parser2 constructor did.
* Remove _Parser2 and ParserAdapter.
* Remove `useFasta` argument in several places.
* Delete tests in parser_test.dart which only used the legacy parser.
* Move ParserProxy from parser_fasta_test.dart to parser_test.dart
* Remove ~240 cases of dead code like `if (useFasta)` and `useFasta ?`
  in tests.

Change-Id: Iea29a10ff83103293902336490fbc9cd46cd20ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175560
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-12-10 23:47:48 +00:00
Konstantin Shcheglov d279cb47b5 Enforce sorting in analyzer/.
Change-Id: If7e76e442e64cd4991b80c3993e3da10bb3a19ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151462
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-06-17 05:04:30 +00:00
Konstantin Shcheglov 83378633e1 Add the attachment with the content of the file being analyzed.
Change-Id: I75b1c61e2d04cd5e03ef4375e97ef3c9f4add874
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138384
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-03-10 04:57:20 +00:00
pq 8ebe354ecc fix diagnostic messages for named constructors
Fixes: https://github.com/dart-lang/linter/issues/1986

Change-Id: I67ba3393be48dc39d3bbaaa922542f11b138afae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133244
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-01-24 18:50:13 +00:00
Danny Tuppeny 2678ee01ac Don't include end of comment markers in TODO range
Fixes https://github.com/Dart-Code/Dart-Code/issues/2181.

Bug: https://github.com/Dart-Code/Dart-Code/issues/2181
Change-Id: I670f8f46ef60d09ec3f1fd743084734048f3cfc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129440
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-01-03 15:48:09 +00:00
Konstantin Shcheglov 8a0d30d4e2 Fix annotate-overrides in analyzer.
R=brianwilkerson@google.com

Change-Id: I7a587daf9715ded6450b28ecf3892ce4181aeb37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129421
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-12-23 00:02:37 +00:00
Sam Rawlins 2d332ee1d3 Make private fields final where possible
Change-Id: I16ee52f1b23e8d708e40cb482c5150f1e04d2417
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128524
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-12-17 06:12:39 +00:00
Konstantin Shcheglov 364dd8936b Fix unnecessary_new in analyzer.
R=brianwilkerson@google.com

Change-Id: I70f80baa3da4b14c0a52c1f28da16a9ad26d7dda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127424
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-12-06 01:11:30 +00:00
Mike Fairhurst 7ba5584c2e [analysis_server] Fix outdated desin Service->Server, use Service->Logger.
Also multiplex the service rather than the logger, so that we can
multiplex a crash reporting instrumentation service with a file logging
instrumentation service.

Change-Id: I7720c55e26225c27d2d9447a0156b2ca83da6598
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122100
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-11-04 21:31:26 +00:00
Mike Fairhurst 924ec34e01 Remove analysis logger, replace with calls to InstrumentationService
Change-Id: Ifddd58b731aa0af8f76a91261757997dc52a9fc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123328
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-31 21:26:44 +00:00
Konstantin Shcheglov 159e0b74bc Remove SourceContainer, Source_ContentReceiver.
Change-Id: I6e801382605d412f1f24d09ee58009c249439d46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122300
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2019-10-22 05:28:28 +00:00
Konstantin Shcheglov 2bd2392e2a Remove EngineTestCase.
R=brianwilkerson@google.com

Change-Id: Ica78c0dfef239e15b3f7d8d624422017d5b8375e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118600
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-09-25 17:53:16 +00:00
Konstantin Shcheglov fc56445218 Remove EngineTestCase.getGetter()/getMethod().
R=brianwilkerson@google.com

Change-Id: I89cde7189f33b6a4e0cd7c3a9542232dc8f2d134
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118506
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-09-24 15:45:07 +00:00
Konstantin Shcheglov 5a84f09a26 Remove EngineTestCase.findSimpleIdentifier()
R=brianwilkerson@google.com

Change-Id: I96dd3d62f2df4e433c79afdc41156e522a779d8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-09-24 14:12:59 +00:00
Konstantin Shcheglov 2c219ddb07 Replace AnalysisContextFactory with TestAnalysisContext.
R=brianwilkerson@google.com

Change-Id: I45ac78530061478e4835bd78355ab9f089f80879
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116047
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-09-06 22:47:36 +00:00
Brian Wilkerson e80f779914 Add context messages for equal map keys and set elements
Change-Id: If1a2af91f35f869f7a9df89d0729949d5098c3b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109181
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-07-16 13:14:02 +00:00
pq 8f90265176 de-lint collection size checks
Change-Id: Id8e7ce2ec59ad7cd2b0b9c961594a37d4fef621a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108522
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2019-07-10 13:46:43 +00:00
Brian Wilkerson 6941d04a6e Add support for testing the context messages for diagnostics
Change-Id: I33d4abc0dcc969f3beecfdc7cbc814e8a486ad1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107142
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-06-24 18:15:38 +00:00
Brian Wilkerson ec0447db5d Add support for using ExpectedError and convert a couple of tests over to use it
Change-Id: I04a89cc922e0046dee4d7e9f964f272cfc60a055
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99320
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-04-15 02:17:44 +00:00
Konstantin Shcheglov eeb19b0416 Remove usages of ExtensionManager and package:plugin in general.
R=brianwilkerson@google.com

Change-Id: I489e72464474b3d40d7678f44562f65934f93288
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96863
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-03-14 15:31:08 +00:00
Konstantin Shcheglov 162d0d12b0 Remove EngineTestCase.assertInstanceOf and extract ast/element TypeMatcher(s).
R=brianwilkerson@google.com

Change-Id: I9c47b4a7426dccafb8d3ffc1b0652da0106f2184
Reviewed-on: https://dart-review.googlesource.com/c/87302
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-12-14 17:51:27 +00:00
Brian Wilkerson 235da6f45d Rename AstNode.getAncestor by deprecating it and adding the new method (analyzer)
Change-Id: Ia00d8cb7153bd9db798352aab00b2431ba709671
Reviewed-on: https://dart-review.googlesource.com/c/85540
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-28 21:04:57 +00:00
Konstantin Shcheglov 749cf15dcf Fix tests failing on Windows.
R=brianwilkerson@google.com

Change-Id: I72f01b89e03a3269cab9c8a33cbfb45c0bd13d72
Reviewed-on: https://dart-review.googlesource.com/77223
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-28 20:20:36 +00:00
danrubel a53b585498 Fix more Analyzer tests
* Add "usingFastaParser" accessor for Analyzer engine tests
* Update Analyzer compile time error code tests
* Add additional checks for async/await/yield as identifiers
* Update built-in as type variable error message
* Check for "this." in local declaration parameters
* Remove unnecessary asserts

and address comment in https://dart-review.googlesource.com/c/sdk/+/57022

Change-Id: I54b5ac22f912289dad6360646fae7eca717bbd98
Reviewed-on: https://dart-review.googlesource.com/57220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-31 00:25:03 +00:00
Paul Berry 105b170ddb Roll package test to 0.12.29+1 and stack_trace to 1.9.0
This required some changes to analysis_server, since analysis_server
used to have its own version of pumpEventQueue().  Since
pumpEventQueue() is now provided by the test package, I've removed
analysis_server's version, and I've updated some of the call sites to
pass in "times: 5000" to replicate the old analysis_server behavior.

This also required some changes to analyzer, since the fail() method
is now marked as @alwaysThrows, so no code may follow it without
producing a dead code hint.

Change-Id: Ie5ef3a5cc685c18da02de699e59f63f3bb8865f7
Reviewed-on: https://dart-review.googlesource.com/32683
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-01-07 14:22:23 +00:00
Brian Wilkerson b8f870c524 Add support for testing the highlight range of errors
Change-Id: I077ee8318756450271b68c70ed304807a1dfb240
Reviewed-on: https://dart-review.googlesource.com/16640
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-10-25 20:00:26 +00:00
Brian Wilkerson 86c62a6bad Remove the command-line plugin
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2565993002 .
2016-12-11 10:59:19 -08:00
Brian Wilkerson a01afcd1d1 Remove the options plugin
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2569603002 .
2016-12-11 08:38:29 -08:00
Paul Berry 0c928771fc Revert "Connect analyzer's AnalysisError object to front_end's CompilationError."
This reverts commit fc5270df72.

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

Review URL: https://codereview.chromium.org/2503803003 .
2016-11-15 10:00:34 -08:00
Paul Berry fc5270df72 Connect analyzer's AnalysisError object to front_end's CompilationError.
AnalysisError implements CompilationError but provides additional
services, such as extensibility via the `getProperty` method.

Note: CompilationError.location has been renamed to
CompilationError.span to avoid confusion (since its type is
`SourceSpan`, not `SourceLocation`).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2498133002 .
2016-11-14 15:30:10 -08:00
Paul Berry 0a1fb8d248 Move scanner into pkg/front_end/lib/src/scanner.
Several support classes also had to move to front_end along with the
scanner.  Some of these support classes arguably don't belong to the
scanner itself, since they have other uses (e.g. SyntacticEntity,
ErrorCode, ErrorSeverity, ErrorType, and StringUtilities).  They will
be reorganized into a more appropriate location in future CLs, at the
time that they become needed by other components of the front end.

In order to avoid dragging in a lot of dependencies, the following
changes were made:

1. Scanner no longer reports errors through Source and
AnalysisErrorListener objects passed to the constructor.  Instead, it
provides an abstract reportError() method which clients may override
to perform error reporting in any way they wish.  Analyzer contains an
override of Scanner that mimics the old behavior in order to maintain
compatibility.

2. Static members of ErrorCode (`values` and `byUniqueName`) have been
moved to top level, and remain in analyzer.  To maintain
compatibility, these static members remain in ErrorCode (as deprecated
members that simply wrap the implementations in analyzer).  This means
we have a reverse dependency (front_end depends on analyzer), but this
dependency will go away as soon as we publish the next breaking change
release of analyzer.

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

Review URL: https://codereview.chromium.org/2486873003 .
2016-11-08 13:47:17 -08:00
Konstantin Shcheglov 175dad4f15 Switch 'analyzer' to 'package:test' and test_reflective_loader ^0.1.0.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2391423003 .
2016-10-06 08:46:35 -07:00
Brian Wilkerson 57f1193c01 First steps toward removing MethodTrampoline
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2348353002 .
2016-09-19 08:24:29 -07:00
Brian Wilkerson ecc84b26a4 Break up another large file
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2342733002 .
2016-09-15 07:49:27 -07:00
Brian Wilkerson 6c448b6938 Move exception support to its own library
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2328043002 .
2016-09-10 11:04:19 -07:00
Konstantin Shcheglov e976e692be Replace and remove JavaException(s).
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2326813002 .
2016-09-08 15:56:33 -07:00
Konstantin Shcheglov e187e33923 Remove StringUtils from java_core.
It is used almost only in analyzer and analysis_server.
There are two places where it is used internally - I'm fixing them.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2317113005 .
2016-09-08 13:26:56 -07:00
Brian Wilkerson f183ec3a45 Fix equality between subclasses of Source
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2050083002 .
2016-06-09 07:42:32 -07:00
Paul Berry 9e52ab17e0 Consolidate duplicate code for resloving URIs.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1831133005 .
2016-03-25 10:37:36 -07:00
Bob Nystrom 8defa5f77c Split resolver_test.dart into smaller files.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1782463002 .
2016-03-09 10:42:09 -08:00
Konstantin Shcheglov 918582490e Fix the 'Unused import' hint when using package summaries.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1722383002 .
2016-02-24 08:16:37 -08:00
Brian Wilkerson eca9d45bd8 Fix source used in tests
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1698733002 .
2016-02-13 11:13:57 -08:00
William Hesse b201036951 Remove import of AnalysisException from wrong library.
The class comes from generated/java_engine.dart, not generated/engine.dart

BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1680703002 .
2016-02-08 17:27:24 +01:00
Brian Wilkerson 21ecb14548 Clean-up imports
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1602803002 .
2016-01-18 15:42:16 -08:00
Brian Slesinsky 5cc87405aa Don't log stack trace for a bad package URL in a source file.
BUG=https://github.com/dart-lang/sdk/issues/25367
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1572073003 .
2016-01-11 15:53:49 -08:00
Konstantin Shcheglov e5e1dc77bd Replace using '_commentBeforeFunction' with visitXyzInScope().
Otherwise it gets really ugly with using FunctionTypeAlias which does not have
a body, and getters not having a FormalParameterList, and with parameters for
function typed parameters...

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1526973005 .
2015-12-17 10:52:23 -08:00
Brian Wilkerson 2a190aa11a Fix imports within the analyzer package
R=paulberry@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1524893002 .
2015-12-14 12:25:41 -08:00
Brian Wilkerson f0d249e269 Clean up package imports and library names
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1513643009 .
2015-12-10 08:11:56 -08:00