Commit Graph

73 Commits

Author SHA1 Message Date
Konstantin Shcheglov 8515d74332 Add ImportElement.namespace and use it in completion.
R=brianwilkerson@google.com

Change-Id: I58cadf0e3239ad4ae8584d79485f4d9ebda10eba
Reviewed-on: https://dart-review.googlesource.com/54064
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-07 21:23:48 +00:00
Konstantin Shcheglov b7a63c8d52 Use @isTest and @isTestGroup to understand executable element as a test/group.
R=brianwilkerson@google.com, devoncarew@google.com

Bug: https://github.com/flutter/flutter-intellij/issues/2055
Change-Id: I7c8e7639d111eca63df0780ebdec182573493047
Reviewed-on: https://dart-review.googlesource.com/53690
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-04 17:09:06 +00:00
Brian Wilkerson a865531f57 Remove two unused classes from the public API
Change-Id: I4d27bc95d3a3e0ffc3ad379ffd823abf4fff0db1
Reviewed-on: https://dart-review.googlesource.com/51244
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-16 19:15:29 +00:00
Brian Wilkerson dd897d35a2 Move the task API out of the public API
Change-Id: I0fbafb4965ced89fb9a063edb773c3f1cb3a39fa
Reviewed-on: https://dart-review.googlesource.com/51242
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-04-16 18:18:08 +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
Paul Berry 593273cf51 Finish implementing mixin type inference in the analyzer.
Fixes #32146.

Change-Id: Ia46b6a54757901681858e682bdd6f809c194999c
Reviewed-on: https://dart-review.googlesource.com/43944
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-02-27 17:49:59 +00:00
Sam Rawlins 14629098dd Enforce @visibleForTesting annotations.
In particular, enforce that a method annotated with @visibleForTesting can only
be referenced from within the declaring library, or within a file that has
"/test" in its path. This allows @visibleForTesting methods to be accessed from
test files, or files in "/testing" folders, etc.

Bug: https://github.com/dart-lang/sdk/issues/28273
Change-Id: I3c19f73be330c49face7e3203879742d514bca74
Reviewed-on: https://dart-review.googlesource.com/27201
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-12-14 00:17:24 +00:00
Sam Rawlins 0a6253312f Check for @alwaysThrows when evaluating for dead code.
The meta package version 1.1.0 includes a new `alwaysThrows`, which developers
can use to annotate methods that always throw. This helps to avoid erroneous
DEAD_CODE warnings from analyzer.

Bug: https://github.com/dart-lang/sdk/issues/31384
Change-Id: I70e2469b4f3a0d2c87064851160b268ea2259807
Reviewed-on: https://dart-review.googlesource.com/26563
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-12-07 19:29:18 +00:00
Konstantin Shcheglov e8fe137e94 Remove ExecutableElement.functions and don't resynthesize local functions.
As for all other local elements - variables and labels, we now
created them when we analyze the unit, but we don't export them
through the element model.

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

Bug:
Change-Id: I71eb567f58d6d710fc8a58d1653a66d95ef1ddcd
Reviewed-on: https://dart-review.googlesource.com/9861
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-10-01 21:08:04 +00:00
Brian Wilkerson 7afa1e2986 Deprecate MethodElement.getReifiedType
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2997333002 .
2017-08-21 16:21:43 -07:00
Konstantin Shcheglov ce4d7b1891 Restore UriReferencedElement and its uri/uriOffset/uriEnd properties.
This is a partial rollback of bdd69ccd6c,
it restores APIs and implementations, but does not restore its usages
in analyzer or analysis_server. Should be enough to make clients
temporary OK, but also keeps resynthesizing from Kernel working.

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

Review-Url: https://codereview.chromium.org/2991453002 .
2017-07-21 16:59:52 -07:00
Konstantin Shcheglov bdd69ccd6c Remove UriReferencedElement with its uri/uriOffset/uriEnd properties.
The 'Move File' refactoring does not work, so I comment out most
of its code.

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

Review-Url: https://codereview.chromium.org/2982993003 .
2017-07-19 09:31:03 -07:00
Konstantin Shcheglov 51b50f7710 Restore visitLabelElement() and visitLocalVariableElement().
Revert "Remove visitLabelElement() and visitLocalVariableElement()."

This reverts commit 2c064df145.

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

Review-Url: https://codereview.chromium.org/2977623002 .
2017-07-10 11:00:27 -07:00
Konstantin Shcheglov 2c064df145 Remove visitLabelElement() and visitLocalVariableElement().
These elements are not parts of the bigger element model, so it
does not make sense to implement these visit methods.

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

Review-Url: https://codereview.chromium.org/2971253002 .
2017-07-07 08:04:59 -07:00
Konstantin Shcheglov 49da688b0b Remove ExecutableElement.labels altogether.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2972103002 .
2017-07-06 14:32:07 -07:00
Konstantin Shcheglov 7ed5e1c433 Remove ExecutableElement.localVariables altogether.
It is not used in analyzer or analysis_server, and in packages in
internal codebase.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2966313002 .
2017-07-05 16:59:41 -07:00
Konstantin Shcheglov 7ea7324747 Remove CompilationUnitElement.getElementAt().
It is not used by any package we use internally.
It was added for search, but is not used anymore.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2967203002 .
2017-07-05 10:52:02 -07:00
Brian Wilkerson 4fab4a1f52 Clean up type parameters in comments
R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2948393002 .
2017-06-23 12:53:11 -07:00
Janice Collins 37330be1b9 Expose function contained in GenericTypeAliasImpl.
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2787513003 .
2017-03-30 09:08:46 -07:00
Brian Wilkerson 4f28d97ac2 Add error checking for the immutable annotation (issue 27750)
R=pquitslund@google.com

Review-Url: https://codereview.chromium.org/2775863004 .
2017-03-24 11:56:24 -07:00
Jacob Richman 6d1e3b4a90 Fix analyzer formatter errors.
BUG=
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2765153002 .
2017-03-21 21:42:40 -07:00
Brian Wilkerson c56210c294 Create a new element for generic function types
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2758123002 .
2017-03-19 10:45:50 -07:00
Brian Wilkerson 0fa6715bd8 More support for generic function types
Review-Url: https://codereview.chromium.org/2736643006 .
2017-03-07 08:04:01 -08:00
Janice Collins 05b00a9884 Add toSource() to ElementAnnotation, ElementAnnotationImpl (issue 28631)
This is the dartdoc-required case only.

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2713243003 .
2017-02-27 09:22:27 -08:00
Konstantin Shcheglov f47ebbcea3 Add CompilationUnitElement.lineInfo and resynthesize it.
One bit that is not quite straight is that UnlinkedUnit.lineInfo is
empty. Normally we would have [0] for empty files, which we pretend
missing files are. Should we fix this instead of checking in the
resynthesizer?

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

Review-Url: https://codereview.chromium.org/2694403003 .
2017-02-15 09:54:28 -08:00
Jennifer Messerly 0e00b3e5c8 fix #28008, fix #28009 implement FutureOr<T>
This implements FutureOr<T> in strong mode, otherwise it's ignored (treated as `dynamic`.

Also fixes strong mode's inference subtype function incorrectly treating `void` as a malformed type. This had the consequence of allowing `void` to be inferred as a type argument.

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

Review-Url: https://codereview.chromium.org/2647833002 .
2017-01-25 15:32:57 -08:00
Bob Nystrom 590a188066 Use "Object" as the reified type of covariant override parameters.
This ensures the runtime type is of the tear-off expression's static
type, even when accessed through a superclass.

I also moved the two tests into a subdirectory so they are easier to
find. (It is inscrutable to me why we would have a single directory
with 1,868 test files in it.) That involved enabling recursive
directory listing in codegen_test, which exposed a couple of things.

Fix #27484.

R=leafp@google.com

Review-Url: https://codereview.chromium.org/2641543003 .
2017-01-18 14:48:42 -08:00
Konstantin Shcheglov 24f61aef20 Report HintCode.MISSING_RETURN for async functions with return type that matters.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2630023003 .
2017-01-15 09:51:26 -08:00
Brian Wilkerson d1fcb1e986 Add visitors that throw by default
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2623453003 .
2017-01-09 10:08:53 -08:00
Paul Berry ae6fd961a1 Prepare for decoupling analyzer ASTs from element model.
This CL creates top level accessor functions which may be used to map from AST data structures to their corresponding elements and types, and begins using those accessor functions throughout the SDK.  It also adds empty interfaces ResolutionTarget and ResolutionType, which are implemented by Element and DartType respectively.

In a future CL, I will change the types stored in the AST to ResolutionTarget and ResolutionType, rather than specific element types; this will decouple the ASTs from the element model.  The presence of the accessor functions will allow clients to continue accessing elements and types in a type-safe way.

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

Review URL: https://codereview.chromium.org/2551023005 .
2016-12-07 11:08:14 -08:00
Andrew Lorenzen c9d7a5a5c8 Make Element.accept() generic. (#27690)
* Make Element.accept() generic.

* Update subclasses of Element.
2016-12-06 20:42:00 +01:00
Jennifer Messerly 4213059b74 fix #27040, promote the upper bound of a type parameter
also fixes #27210, by cleaning up TypeParameterMember equality TODO.

R=leafp@google.com

Review URL: https://codereview.chromium.org/2375373002 .
2016-11-01 18:14:59 -07:00
Brian Wilkerson f87e62ef14 Convert subclasses of Enum
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2365553004 .
2016-09-23 06:54:26 -07:00
John Messerly 865e808f15 support @virtual fields, fix #27384
R=leafp@google.com

Review URL: https://codereview.chromium.org/2352433002 .
2016-09-19 09:45:24 -07:00
John Messerly 28247a3daa fix #25578, implement @covariant parameter overrides
R=leafp@google.com

Review URL: https://codereview.chromium.org/2336503003 .
2016-09-13 14:57:22 -07:00
Konstantin Shcheglov 8c1d5a3b56 Remove LibraryElement.visibleLibraries.
It is not used now.
The only other is smoke, and its only in test, and it is actually
used incorrectly there.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2336913002 .
2016-09-13 07:45:53 -07:00
Konstantin Shcheglov 4e95a1b8b6 Remove LibraryElement.isUpToDate().
It is not used anywhere.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2335843003 .
2016-09-12 15:03:58 -07:00
Konstantin Shcheglov 663a3e810c Reapply abc5051854: Remove 'Element.docRange'.
I also marked the corresponding information in summaries as @deprecated
and made a small tweak to the generator so that it knows that the ids
of deprecated fields are still used.

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

Review URL: https://codereview.chromium.org/2330813002 .
2016-09-11 09:41:53 -07:00
pq b7f0ce083b Revert "Remove 'Element.docRange'."
This reverts commit abc5051854.

Background: required to keep `analyzer` version-compatible with `test`.

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

Review URL: https://codereview.chromium.org/2293143003 .
2016-08-30 13:10:15 -07:00
Konstantin Shcheglov abc5051854 Remove 'Element.docRange'.
I also marked the corresponding information in summaries as @deprecated
and made a small tweak to the generator so that it knows that the ids
of deprecated fields are still used.

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

Review URL: https://codereview.chromium.org/2270903002 .
2016-08-24 09:40:23 -07:00
Paul Berry 052a6c867d Fix summary handling of unresolved imports, exports, and parts.
Previously this was working for a few use cases by dumb luck, but it
wasn't well tested and became broken by
b29c6bf330.  This CL fixes it for real
and adds tests to verify the fix.

Note that there is a change to how we represent an unresolved
import/export: instead of storing a URI_EXISTS modifier in the element
model, we simply mark the imported library element as synthetic.
(This library element existed anyway; we just weren't marking it as
synthetic).  This makes it easy to tie in with summaries, since it is
easy for the resynthesizer to detect that the library doesn't exist at
the time the library handle is resolved.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2235373003 .
2016-08-12 13:59:51 -07:00
Brian Wilkerson b29c6bf330 Suppress follow-on errors when a file is imported with either a prefix or a show clause
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2226613004 .
2016-08-09 11:11:39 -07:00
pq f4c2a0faba Analyzer support for @factory methods (linter#253).
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2096103002 .

Fixes: https://github.com/dart-lang/linter/issues/253.
2016-06-24 14:41:00 -07:00
pq c07b21d03b Dangling comment reference cleanup in analyzer.
First pass with the new `comment_reference` lint.

BUG=
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1994243002 .
2016-05-19 10:24:53 -07:00
Brian Wilkerson 3024554b3c Improve type information and minor clean up
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1977413002 .
2016-05-16 08:43:58 -07:00
Brian Wilkerson f2356d0d33 Add API to force the computation of constant values
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1966323002 .
2016-05-12 07:37:08 -07:00
Konstantin Shcheglov 76f73c38cc Add 'ParameterizedType get type' to TypeParameterizedElement.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1968543002 .
2016-05-10 11:07:09 -07:00
pq ac48484a07 Support for @JS() validation (#26225).
See: https://github.com/dart-lang/sdk/issues/26225

BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1871103002 .
2016-04-08 13:45:46 -07:00
pq 6a430d0730 Validation of @required params (#26182).
See: https://github.com/dart-lang/sdk/issues/26182.

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

Review URL: https://codereview.chromium.org/1863803002 .
2016-04-06 06:09:44 -07:00