Commit Graph

41 Commits

Author SHA1 Message Date
Paul Berry 53a905cde1 Introduce function parseFile2.
This is similar to the existing `parseFile` function, but it is more
efficient, and it supports the same parameters `featureSet` and
`throwIfDiagnostics` as `parseString`.

Change-Id: I4b9ecc36a137cc1c99e671e379f00afa3942c9ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105542
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-21 16:08:07 +00:00
Konstantin Shcheglov 143e5ef556 Revert 'Import Library' quick fix changes.
This basically reverts https://dart-review.googlesource.com/c/sdk/+/103921
because internally IntelliJ does not provide module dependencies yet.

Change-Id: I7717b2841bf3d6391b991875a594c6df9e246ff1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106482
Reviewed-by: Ari Aye <ariaye@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-06-18 17:31:56 +00:00
Paul Berry 9a2eecf67f Fix parseString: ensure that CompilationUnit.lineInfo is set properly.
Change-Id: Id81338c1021f9548f2c3f24931baf1e45ac1b18b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106320
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-06-17 16:10:29 +00:00
Paul Berry 686df33d99 Add parseString() to replace the deprecated parseCompilationUnit().
Change-Id: Ib272f6a281b09a02ba037049e76bf08dd78dbbab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105540
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-12 12:56:57 +00:00
Konstantin Shcheglov a332c414f1 Switch server to using DeclarationsTracker for 'Import Library' quick fixes.
We need this to stop using UnlinkedUnit with summary2.

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

Change-Id: Iaca2f19e6a168818e171f09e6eeda71a75854232
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103921
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-05-29 16:45:32 +00:00
danrubel b4611b9357 add extension-methods experimental feature
Change-Id: Iad76a6d0b91ff83fce3dbd963d0c341b3b62eeb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102880
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-05-17 13:15:30 +00:00
Paul Berry d50232a3f5 Plumb new FeatureSet class into AstBuilder.
And change clients of parser and AstBuilder (within the SDK) to use
it.

Long term, it would be better to store the FeatureSet object directly
in the AstBuilder and remove the existing flags `enableNonNullable`,
`enableSpreadCollections`, `enableControlFlowCollections`, and
`enableControlFlowCollections`.  However there are analyzer clients
that currently use these flags.  So for now, we simply plumb in the
FeatureSet as a new way of setting AstBuilder flags.  Once we've
updated clients to use FeatureSet, we'll publish a breaking version of
the analyzer that removes the old flag API.

Change-Id: I6d37177c40b1a1216956e95f473252aa218d10b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100000
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-04-22 13:38:59 +00:00
Paul Berry 63658b113c Proposed new API for tracking feature opt in/out
Change-Id: I777094da1301b525cd92cab1f9bf49d2f70a911b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99784
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-04-19 18:20:41 +00:00
Brian Wilkerson e6b0676f58 Change comment style in a few more files
Change-Id: I2c7a3e2a01e9db61ea9ca5f6a1156d6d8ce34f5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98282
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-03-31 15:28:53 +00:00
Brian Wilkerson 6c2ea4936a Clean up several deprecation hints
Change-Id: I6191ddc4bb4a98c4976d8bc281b084bfd5073547
Reviewed-on: https://dart-review.googlesource.com/c/89941
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-01-17 01:05:24 +00:00
Konstantin Shcheglov 3f431de188 Implement AnalysisSessionHelper.getElementDeclaration() using AnalysisSession.
Also adds parsedUnit / resolvedUnit to ElementDeclarationResult, because
Analysis Server use case shows that we need them.

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

Change-Id: I845e85f658bec8fdaf3378f879e3d986a0bc01eb
Reviewed-on: https://dart-review.googlesource.com/c/82712
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-02 22:52:49 +00:00
Brian Wilkerson 94b428a130 Add utilities to replace lib/analyzer.dart
Change-Id: I04d96cdc9c78390319b2a42c000dee92f5f5685d
Reviewed-on: https://dart-review.googlesource.com/c/82661
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-02 19:20:30 +00:00
Paul Berry 73a58c81d4 Merge commit '31d0896a8b8c7d2a8c0496c9d8d817356ef897ad' into analyzer 2018-11-02 10:44:56 -07:00
Paul Berry 31d0896a8b Introduce API so that the linter can be migrated away from Element.context.
The API change requires adding a "context" parameter to
NodeLintRule.registerNodeProcessors.  If we did this naively it would
be a breaking change since the existing linter code overrides this
method with an implementation that doesn't accept such a parameter.
So to avoid making this a breaking change, we introduce a new
interface NodeLintRuleWithContext that extends NodeLintRule, and adds
the context to the registerNodeProcessors method as an optional
parameter.  The analyzer will only pass in the new parameter if the
lint rule implements the new interface; otherwise it will call the
method in the old way.  This will allow the linter to be migrated to
use the new API at its pace.

The next breaking change version of the analyzer will change both
NodeLintRule and NodeLintRuleWithContext so that the context parameter
is required, and will pass in a context unconditionally.  At a later
date, after the linter has been fully migrated to the new analyzer
version, we will be able to switch back to NodeLintRule and deprecate
NodeLintRuleWithContext.

Change-Id: I75ada0e94e26f831d6f2cb82cddfa706100eb185
Reviewed-on: https://dart-review.googlesource.com/c/82522
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-11-02 14:22:12 +00:00
Konstantin Shcheglov e3c8774543 Add AnalysisSession.analysisContext, stop using AnalysisDriver's AnalysisResult outside the driver.
Change-Id: I63138e002d9e777f51d2d843f7ef2b1f32fed3e0
Reviewed-on: https://dart-review.googlesource.com/c/82529
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-11-02 14:16:31 +00:00
Konstantin Shcheglov ef91571cb8 Add ParsedLibraryResult, getParsedLibrary, getResolvedLibrary to AnalysisSession.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: Ia48233b0d72dd0a0673a6ca15817881feca7d26c
Reviewed-on: https://dart-review.googlesource.com/c/82471
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-01 21:25:35 +00:00
Paul Berry d47ef00253 Convert session.dart to triple-slash comment style
Change-Id: I9f80b1a79a7d24df660b6a926b347df81d397905
Reviewed-on: https://dart-review.googlesource.com/c/82467
Commit-Queue: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-01 17:50:10 +00:00
Konstantin Shcheglov 5711a1d539 Move implementations of analysis results into src/results.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I7527dfb597ff54802517093b4aa526b14e7b705c
Reviewed-on: https://dart-review.googlesource.com/c/82461
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-01 16:11:23 +00:00
Brian Wilkerson 4c61f68f9b Add support for summary files to the public analyzer API
Change-Id: I0d11e0481403c27de191c315f9e5d0bedc96a810
Reviewed-on: https://dart-review.googlesource.com/c/82340
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-11-01 14:21:44 +00:00
Paul Berry 57e631d661 Convert results.dart to triple-slash comment style
Change-Id: I9201d17d89c4ad9d51f50a974271ae32e6637908
Reviewed-on: https://dart-review.googlesource.com/c/82462
Commit-Queue: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-01 14:12:41 +00:00
Konstantin Shcheglov 2bb3dcf5df Add getResolvedLibrary() to AnalysisDriver.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I43fdf62bd6bb4c02e4b0cf97e324e6ca17c5d86c
Reviewed-on: https://dart-review.googlesource.com/c/82140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-30 19:30:12 +00:00
Brian Wilkerson 298d22f4ab remove async parse method
Change-Id: I7a2e633b43283221790fb88a12065fed3dcdabb7
Reviewed-on: https://dart-review.googlesource.com/c/82120
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-30 19:26:00 +00:00
Konstantin Shcheglov 1f52372bfa Remove CFE integration from analyzer, analysis_server, and analyzer_cli.
AnalysisDriverResolutionTest is partially updated, about 30 failing
tests added. I will get back to it in a following CL, it is not
directly CFE integration, but updated understanding how we want to
resolve. For example we don't need types for non-expression identifiers.

Change-Id: I3daddbb6c66ffad7a726f3313a1199fd7387aa04
Reviewed-on: https://dart-review.googlesource.com/71883
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-29 13:46:45 +00:00
Brian Wilkerson 55880dfeed Add support in the new API for CFE
Change-Id: I4e7a12b786a8774e92dd96a5f94d86e1d1a3564e
Reviewed-on: https://dart-review.googlesource.com/67701
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-08-01 04:24:28 +00:00
Brian Wilkerson 2e7b0a13f1 Add support for accessing all of the created contexts
Change-Id: I84284726dea1b12f8403456cbdb0a9a967624e0d
Reviewed-on: https://dart-review.googlesource.com/67380
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-07-30 17:47:12 +00:00
Konstantin Shcheglov 493c421f0d Add AnalysisContextCollection.
R=brianwilkerson@google.com

Change-Id: Id0c64648983129f5ecd46d784e978ce321ba2041
Reviewed-on: https://dart-review.googlesource.com/60404
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-06-18 15:53:36 +00:00
Konstantin Shcheglov a9fef15ff3 Add FileResult and AnalysisDriver.getFileSync().
I thought that getSourceKind() might be not the best API. We are moving
away from Source, and it seems that we should stop using SourceKind as well.

R=brianwilkerson@google.com

Change-Id: I0fcff8dc8cefcd6d8fb899badab8037bf8d67775
Reviewed-on: https://dart-review.googlesource.com/58442
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-06-05 20:51:37 +00:00
Brian Wilkerson 1f03109200 Proposed replacement for SourceFactory
Change-Id: Iadcb71a4f9682d4cb9636aea6bb0b91f3bf040f9
Reviewed-on: https://dart-review.googlesource.com/58160
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-06-05 16:09:49 +00:00
Konstantin Shcheglov f32509b849 Export 'resourceProvider' from AnalysisSession.
R=brianwilkerson@google.com

Change-Id: I0544be022a078f96be23c4e75923c32f70385589
Reviewed-on: https://dart-review.googlesource.com/55443
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-05-16 17:28:16 +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
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
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
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
Konstantin Shcheglov c90ca298ed Provide a message for InconsistentAnalysisException.
R=brianwilkerson@google.com

Change-Id: I1498c70c1c9d7cd43760ca2c620a3fb819a0c823
Reviewed-on: https://dart-review.googlesource.com/47903
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-22 17:54:59 +00:00
Brian Wilkerson 73eb8a37e0 Make ContextRoot part of the API to support the angular plugin, fix some bugs
Change-Id: I3f23d1712473c4e5522c441ac31e013516ae5f4d
Reviewed-on: https://dart-review.googlesource.com/43880
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-02-27 15:37:19 +00:00
Brian Wilkerson ceaac966fc Proposed analyzer API
Change-Id: I075a92a5e7f8dbdc0bb4827091c48c83c6272e0b
Reviewed-on: https://dart-review.googlesource.com/42083
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-02-20 22:43:35 +00:00
Brian Wilkerson de0b7a2f40 Add sourceFactory getter to AnalysisSession
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2989883002 .
2017-07-28 06:18:53 -07:00
Brian Wilkerson 5946ce552f Add AnalysisSession to analyzer
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2954153002 .
2017-06-26 09:16:11 -07:00
Brian Wilkerson e8a5e404c3 Move LocalDeclarationVisitor for use by contributors that will be moved to analyzer_plugin
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2918343002 .
2017-06-05 10:24:54 -07:00
Brian Wilkerson 50d0857f82 Add result interfaces used by AnalysisSession
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2908543002 .
2017-05-25 12:50:08 -07:00