Commit Graph

8489 Commits

Author SHA1 Message Date
Brian Wilkerson 0185ca70fd Fix bug when @protected is not on a class member (issue 25882)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1749753002 .
2016-02-29 08:40:37 -08:00
Florian Loitsch e17f2b98cf Support conditional directives in the options file.
BUG= http://dartbug.com/24579
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1744773002 .
2016-02-29 14:37:54 +01:00
Brian Slesinsky 41ce555c2e Update SOURCE_KIND when a missing source file appears
If the source kind isn't updated, we get a bogus error:
The imported library ... must not have a part-of directive.
This error is calculated in BuildDirectiveElementsTask.
based on SOURCE_KIND.

SOURCE_KIND is based on whether MODIFICATION_DATE is -1,
so make sure we invalidate MODIFICATION_DATE.

Also, fix an issue where _sourceChanged would have
no effect if incremental resolution isn't run, because
the content has already been updated and is therefore
equal.

Also, remove unused RelativeFileUriResolver and
clarify comments around missing Source handling.

BUG=https://github.com/dart-lang/sdk/issues/25808
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1737693004 .
2016-02-26 18:07:57 -08:00
Paul Berry d97c36b8df Properly resynthesize ClassElementImpl.hasBeenInferred.
In strong mode, this is set on all classes.  So there is no need to add
any data to the summary format.

Also found and fixed a bug causing a few resynthesis tests to fail to
set the "strongMode" option properly.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1737903005 .
2016-02-26 14:25:28 -08:00
Konstantin Shcheglov 88beb0d8ab Use separate relation kinds for qualified usages.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1738213003 .
2016-02-26 14:11:54 -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
Konstantin Shcheglov 9eb23db55e Test for duplicate referenced in index and clean up super types.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1738283002 .
2016-02-26 13:28:30 -08:00
Konstantin Shcheglov 057858a412 Fix for build and IDL formats.
TBR

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1740193003 .
2016-02-26 11:31:30 -08:00
Konstantin Shcheglov c106ad4033 Add tests for indexing.
No tests yet for multi-level constructor redirection and
qualified/unqualified references.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1733843007 .
2016-02-26 11:18:59 -08:00
Paul Berry e399f0f5a7 Generate a ".fbs" file representing the summary format.
This file can be consumed by standard flatbuffer tools, allowing
summaries to be consumed from other languages.  For example, a summary
file can now be converted to JSON using:

    flatc -o $outputDirectory -t \
        pkg/analyzer/lib/src/summary/format.fbs -- $inputFile

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1743713002 .
2016-02-26 10:53:33 -08:00
pq 51188b6601 Prettify ignore syntax (#25685).
Prettifies ignore syntax (`//# ignore:` => `//ignore:`).

More context: https://github.com/dart-lang/sdk/issues/25685

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

Review URL: https://codereview.chromium.org/1738203002 .
2016-02-26 10:21:03 -08:00
Paul Berry 293267db28 Propertly summarize LUB function types.
When a function type arises out of a LUB (least upper bound)
computation, it pionts to a synthetic FunctionElement that is not
connected to the element model, so we can't summarize it by simply
storing a reference to the FunctionElement.  We have to store the
FunctionElement's return type and type parameters.

This required reworking _CompilationUnitSerializer's mechanism for
tracking whether it is creating linked or unlinked references;
previously it kept track by passing a boolean around.  Now it uses a
bool field, which should be much less error prone.

Fixes generation of strong mode SDK summary (previously it failed with
an assertion error when in checked mode).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1740923002 .
2016-02-26 08:28:21 -08:00
Konstantin Shcheglov a09461a010 Initial package indexing implementation.
More tests will be added in following CLs.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1735243003 .
2016-02-26 08:24:05 -08:00
Paul Berry c6314577ff Move package summary reading code into analyzer.
This will allow it to be re-used by DDC.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1739923002 .
2016-02-25 13:13:52 -08:00
Paul Berry da6033a7e2 Fix library cycle computation in the presence of library handles.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1736013002 .
2016-02-25 13:11:58 -08:00
Brian Slesinsky b9e0319763 Move errors for bad imports and exports to the directive
This is to ensure that error.source matches the source of
the ChangeNotice it appears in and the analysis server will
report the error together with other errors for the same file.

(Moving the error seems easier than figuring out how to put it
on a different Source, and it might be that the import/export
is at fault anyway.)

BUG=https://github.com/dart-lang/sdk/issues/25826
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1739553003 .
2016-02-25 11:48:26 -08:00
Paul Berry 7481eff6a8 Add file identifiers to summaries.
These should make it easier for summary files to interoperate with
standard FlatBuffer tools.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1738833004 .
2016-02-25 10:36:42 -08:00
Konstantin Shcheglov 9aebcaa400 Don't throw exceptions for unresolved/not-existing URIs in directives.
These URIs were not resolved in the original unit and resported as
errors. So, in DeclarationResolver we also should not throw an
exception.

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

Review URL: https://codereview.chromium.org/1737203002 .
2016-02-25 10:20:43 -08:00
Brian Wilkerson c5410835a9 Improve parser recovery on missing semicolon (issue 25846)
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1736873002 .
2016-02-25 10:08:35 -08:00
Konstantin Shcheglov 160b721262 IDL for index.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1733853002 .
2016-02-25 09:40:37 -08:00
Konstantin Shcheglov 65b03d653c Modernize ElementAnnotationImpl.isX getters.
R=brianwilkerson@google.com, pquitslund@google.com
BUG=

Review URL: https://codereview.chromium.org/1732383002 .
2016-02-25 09:08:35 -08:00
Brian Wilkerson 70cbc0764d Fix dartdoc for AST nodes
R=keertip@google.com

Review URL: https://codereview.chromium.org/1738533003 .
2016-02-25 08:35:38 -08:00
Konstantin Shcheglov 3b97d01634 Fix for using the strong mode SDK summary.
I think the fix does the change needed to configure SDK for using
the strong mode summary, but I was not able to verify this fully
because of the exception with LibraryElementHandle.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1734773003 .
2016-02-24 14:50:22 -08:00
pq 212a058f13 Validation of @protected property accesses.
Follow-on to https://codereview.chromium.org/1723243002/, adding support for field/getter/setters.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1730993003 .
2016-02-24 12:37:53 -08:00
pq 268c35ae1d Regenerate ErrorCode enum.
BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1724283004 .
2016-02-24 10:23:17 -08:00
John Messerly 1f8aa2bdb0 fix #25487, infer block lambdas from return statements
R=leafp@google.com

Review URL: https://codereview.chromium.org/1724543002 .
2016-02-24 09:59:56 -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
Konstantin Shcheglov 8e9aac65ab Extract PackageBundleAssembler and use for SDK and package summary generation.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1722413002 .
2016-02-24 08:26:05 -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
Paul Berry 44f507bd05 Add file hashes to SdkBundle; rename to PackageBundle.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1725913002 .
2016-02-23 10:56:26 -08:00
Konstantin Shcheglov d9bd7f915d Revert collecting defined elements.
We decided to resynthesize local elements from summaries.
This CL rolls back the following CLs:

https://codereview.chromium.org/1687573002
https://codereview.chromium.org/1681493005

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1729523002 .
2016-02-23 09:55:14 -08:00
John Messerly 18ef4ba22b cleanup to InvocationExpression AST declaration
follow up to https://github.com/dart-lang/sdk/commit/0c4e64c8efafd9ac6d8fd004706ee69639b0d04f
splits getter/setter, fixes some sorting

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1717243003 .
2016-02-22 16:52:51 -08:00
John Messerly 0c4e64c8ef fixes #25477, downward inference of generic methods
* we now push the context return type down when inferring
* we also take this into account in our initial downards inference for arguments
* adds a common AST interface for FunctionExpressionInvocation and MethodInvocation, so we can handle these more uniformly

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

Review URL: https://codereview.chromium.org/1720433002 .
2016-02-22 14:48:39 -08:00
Bob Nystrom e9a6175489 Report a static warning if a for loop condition is non-boolean.
From 17.6.1: "It is a static warning if the static type of c may not be
assigned to bool."

Strong mode catches this case, but it looks like ErrorVerifier just
missed it. Since I'm working on making strong mode lean on ErrorVerifier
for finding sideways casts like this, the discrepancy popped up.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1720083002 .
2016-02-22 12:10:52 -08:00
Paul Berry b33be7dce0 In summaries, don't drop unsafe prefixes.
Previous to this CL, all prefixes were dropped during resynthesis,
causing constant ASTs like `x.length` to get resynthesized as simply
`length`, which did not retain enough information for constant
evaluation.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1718013002 .
2016-02-22 05:22:17 -08:00
Brian Wilkerson c8a3ede902 Make StringSource fully implement Source (issue 25822)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1718803002 .
2016-02-21 07:55:36 -08:00
John Messerly 0bf5456fcb partial fix for #25220, handles inference for list/map literals
R=leafp@google.com

Review URL: https://codereview.chromium.org/1717803003 .
2016-02-19 16:44:10 -08:00
Konstantin Shcheglov ee4b4b85bd Both unit and library sources must be isInSystemLibrary.
This fixes the last failure with shared tests and SDK summary.

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

Review URL: https://codereview.chromium.org/1709363003 .
2016-02-19 14:06:10 -08:00
Konstantin Shcheglov bfd8e7ba09 Get LibraryElement(s) and CompilationUnitElement(s) from summary.
With this change we fail just 2 shared tests when use SDK summary.

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

Review URL: https://codereview.chromium.org/1712313002 .
2016-02-19 13:10:29 -08:00
Paul Berry d7b6bc3865 Add summary support for ShowElementCombinator.end and .offset.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1714173002 .
2016-02-19 12:27:12 -08:00
Konstantin Shcheglov 576e6cbfc4 Different approach to fixing file to URI mapping.
Relay on other order of library declarations in the SDK.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1715003002 .
2016-02-19 12:12:44 -08:00
Paul Berry f36602ad03 Add summary support for ConstructorElement.nameEnd and .periodOffset.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1718603002 .
2016-02-19 11:35:45 -08:00
Paul Berry e5a8cdd557 Resynthesize parameter visible ranges.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1713763003 .
2016-02-19 10:56:22 -08:00
Paul Berry e78bc9386e Add summary support for ParameterElement.defaultValueCode.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1714113002 .
2016-02-19 10:35:02 -08:00
Paul Berry 677c01e88b Test and fix resynthesis of generic closures.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1712583004 .
2016-02-19 10:33:11 -08:00
Konstantin Shcheglov 1382982b60 First try to find the exact library for the given file URI.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1710393002 .
2016-02-19 10:19:55 -08:00
Paul Berry ce830bb3ca Fix inconsistency with LinkedReference.numTypeParameters
Sometimes it included parent type parameters, sometimes it did not.
Now it consistently does not.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1713083002 .
2016-02-19 09:25:34 -08:00
Konstantin Shcheglov d32b808fa8 Remove copies of ExportNamespaceBuilder and PublicNamespaceBuilder.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1717653002 .
2016-02-19 09:08:45 -08:00
Brian Wilkerson e46eaa3072 Fix node replacer to handle comments on variable declaration lists (issue 25818)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1715723002 .
2016-02-19 08:45:25 -08:00
Paul Berry 3896ab51e0 Avoid redundant computation of enclosingElement in _getElementReferenceId
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1714703002 .
2016-02-19 08:39:33 -08:00