Commit Graph

237 Commits

Author SHA1 Message Date
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
Brian Wilkerson 50c9131702 Move DartObject into the public API
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1809013003 .
2016-03-18 07:41:58 -07:00
pq 4528052e98 Validation of @mustCallSuper overrides.
Carried over and refined from https://codereview.chromium.org/1767843002/.

BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1773803002 .
2016-03-07 13:37:35 -08:00
Leaf Petersen 7d2976c7d5 Add instantiate method on ParameterizedType and InterfaceType,
and deprecate the old substitute4 in favor of instantiate.

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

Review URL: https://codereview.chromium.org/1758913002 .
2016-03-02 15:06:38 -08:00
Paul Berry 5b78ff96b3 Expose LibraryElementImpl.libraryCycle through LibraryElement.
This ensures that `libraryCycle` will work properly when accessing an
element model resynthesized from summaries.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1744633002 .
2016-02-26 14:03:24 -08:00
pq 84f32fe5a6 Validation of @protected method invocations.
* Defines `isProtected` accessors.
* Adds a simple mechanism to our test `AnalysisContextFactory` allowing us to contribute package resolution to test cases.
* Adds `meta` awareness to `ResolverTest`.

NB: this *only* adds method invocation support.  I'll generalize to all members in a follow-up.  There's enough here though that I wanted to get some early feedback.

BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1723243002 .
2016-02-24 09:25:43 -08:00
Paul Berry 4eaafd3ee5 Deprecate old "isPotentiallyMutated..." API.
The getters are rewritten to return `true`.  Technically this is not a
breaking change, since all variables are "potentially mutated" in at
least a vacuous sense.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1711433002 .
2016-02-17 12:36:58 -08:00
Bob Nystrom e19c6dd79d Consolidate the code that replaces a TypeParameter with its bound.
In the process, I fixed a bug where one version of this same lump of
code wasn't correct anymore now that you can have arbitrarily long
chains of type parameters.

DartType isn't maybe the ideal place for resolveToBound(). I wanted it
somewhere that:

1. Would be obvious enough that someone coming along later would
   discover it instead of reinventing it again.
2. Had access to the various data it needs.
3. Wouldn't need a "is TypeParameterType" guard at every callsite
   before it could be used.

I could put it on TypeProvider instead, since it needs access to Object,
but that felt arbitrary.

It could be a top level function, but then I don't think it would be
very discoverable.

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

Review URL: https://codereview.chromium.org/1686893002 .
2016-02-11 11:27:01 -08:00
Konstantin Shcheglov 0f78186005 Set visible ranges for local variables/functions to the ranges of enclosing blocks.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1690783002 .
2016-02-10 16:16:56 -08:00
Paul Berry c5b3141564 Deprecate PrefixElement.importedLibraries.
It has never worked.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1686863002 .
2016-02-09 14:59:57 -08:00
Brian Wilkerson a9d0e2bf76 Add comments to public libraries
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1672383002 .
2016-02-06 16:27:54 -08:00
Paul Berry c43622e897 Use ElementAnnotation as the ConstantEvaluationTarget for annotations.
Previously, we had a special class,
ConstantEvaluationTarget_Annotation, for this purpose.  It held on to
a the AST node for the annotation.  This was bad because it meant that
the presence of any ConstantEvaluationTarget_Annotation referring to a
given compilation unit would keep the entire compilation unit's AST in
memory.

Now we copy just the portions of the AST we need into
ElementAnnotation, just as we do for all other constant evaluation
targets.  In addition to saving memory, this paves the way for
supporting annotations in summaries, by making it possible to compute
the constant value of an annotation without having to consult the full
AST.

Fixes #25285.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1665353002 .
2016-02-04 15:22:40 -08:00
Bob Nystrom 434f5bc922 Implement the spec's notion of LUB for function types.
Fixes #23381.

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

Review URL: https://codereview.chromium.org/1648063002 .
2016-01-29 10:37:58 -08:00
Brian Wilkerson 5d9274bd79 Move Modifier out of the public API
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1633823003 .
2016-01-26 09:27:44 -08:00
Paul Berry 4e86a006db Stop precomputing ClassElement.isValidMixin.
Previously, we would precompute the value of ClassElement.isValidMixin
and store it in the Modifier.MIXIN.  But this didn't really save any
time, because (a) isValidMixin isn't used inside analyzer, and (b) it
is easily derivable from other information already present in the
element model.

Also, we were computing it incorrectly when the `--supermixin` flag
was present.

This CL replaces the precomputation logic with a direct implementation
in ClassElement.isValidMixin which is correct regardless of the
presence of the `--supermixin` flag.  The tests are beefed up so that
(a) they validate correct behavior for both states of the flag, (b)
they validate correct behavior in the presence of factory
constructors, and (c) they validate that the behavior of
`isValidMixin` is consistent with the error messages produced by the
analyzer.

In addition to fixing bugs, the removal of Modifier.MIXIN means we
have one less piece of information to store in summaries.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1635063003 .
2016-01-26 07:29:48 -08:00
John Messerly 9a4b1c36ce fixes #25482, flatten futures in strong mode so Future.then works
Also fixes https://github.com/dart-lang/dev_compiler/issues/228

A few tweaks were made to the propagatedType inference for Future.then:
* only record type if better than static type
* only go down this path when strong mode is off

also renames tests: test_pseudoGeneric to test_genericMethod.

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

Review URL: https://codereview.chromium.org/1609093003 .
2016-01-22 13:29:58 -08: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
John Messerly 924f2f97b7 clean up generic methods in resolution
Introduces MethodInvocation.staticInvokeType to track the type of this invocation. This provides a natural place to store the instantiated generic function type. We then use this type when we are computing corresponding parameters or return types. As a result we do not need FunctionMember, and some of the code around generics becomes simpler/more uniform.

This approach should be a straightforward way to add support for generics in FunctionExpressionInvocation, in a follow up (see issue #25175).

Also renames "boundTypeParameters" to "typeFormals". "formals" and "actuals" is a pretty common way to describe these, I'm not sure why I didn't think of that better name originally. :)

Also removes broken ParameterMember.== that I had added in a previous CL. And the broken FunctionTypeImpl.originalFunction/instantiatedTypeArguments getters.

Finally, this fixes #23252 in the process of adding this. The return type of a "call" method was not being statically analyzed if the target was a VariableElement.

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

Review URL: https://codereview.chromium.org/1568643002 .
2016-01-07 14:51:36 -08:00
John Messerly e2fa77776c fix hints from analyzer in analyzer
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1559923006 .
2016-01-05 15:19:04 -08:00
Brian Wilkerson d86f7d29a8 Revert element hierarchy to its original form
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1555073002 .
2016-01-04 08:22:13 -08:00
pq 1f8eddcc21 Cache element docs (and add to completions) [#23694].
This does away with the expensive call to `computeDocumentationComment` in favor of cached comments.  Notably this makes adding doc content to code completion proposals performant (and so is done here).  It should also make `dartdoc` *much* faster for doc generation since there are no more trips to disk to fetch comments  for elements (still needed for source though).

For more on the desire for docs in completions see here: https://github.com/dart-lang/sdk/issues/23694

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

Review URL: https://codereview.chromium.org/1534043002 .
2015-12-17 21:07:42 -08:00
Paul Berry ea7e6b29ed Introduce code to resynthesize element models from summaries.
A lot of work remains to do (see TODO comments), but the basic
infrastructure is now in place.

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

Review URL: https://codereview.chromium.org/1526243002 .
2015-12-16 08:39:56 -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 86472f32ce Move public API for elements into a public location
R=paulberry@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1519283003 .
2015-12-13 10:48:56 -08:00