Commit Graph

4276 Commits

Author SHA1 Message Date
Paul Berry b87556e00d Start copying resolution/inference data from front end to analyzer ASTs.
This CL lays the groundwork for integrating the front end with
analyzer by creating a mechanism to copy resolution and type inference
information (produced by the front end's type inference engine) into
analyzer ASTs (produced by AstBuilder).

The general technique is to parse each function twice: once with
BodyBuilder as a listener and once with AstBuilder as a listener.  The
BodyBuilder generates a kernel representation of the function, but
this isn't used; instead, type inference and resolution information is
captured using ResolutionStorer (which is a TypeInferenceListener).
Later, this information is applied to the analyzer AST generated by
AstBuilder using ResolutionApplier (which is an analyzer AST visitor).

At the moment the intermediate data exchanged between ResolutionStorer
and ResolutionApplier is simply a list of types (one for each
subexpression, in a post-order traversal of the program syntax).  For
debugging and validation purposes, this is augmented with a list of
file offsets, so that if the ResolutionStorer and ResolutionApplier
get out of sync we can diagnose the problem easily.

In later CLs, more data will need to be exchanged between
ResolutionStorer and ResolutionApplier (e.g. a list of elements to
which identifiers are resolved).

This CL doesn't tackle the problem of translating between the kernel
and analyzer representation of types; for now we simply map each type
to `dynamic`.  This is sufficient for early development, since it is
still enough to let us verify that ResolutionStorer and
ResolutionApplier stay in sync.

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

Review-Url: https://codereview.chromium.org/2981693002 .
2017-07-13 08:55:29 -07:00
Konstantin Shcheglov b985f3c000 Rename TranslateUri to UriTranslator, rename files, extract Impl.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2982593002 .
2017-07-12 11:56:14 -07:00
Konstantin Shcheglov fe0dfe4b0f Deprecate UnlinkedVariable.visibleOffset/Length.
R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2982463002 .
2017-07-11 14:57:16 -07:00
Konstantin Shcheglov c393e9bbbd Store FunctionType(s) of local functions by value.
R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2974803002 .
2017-07-11 11:36:20 -07:00
Konstantin Shcheglov 3965995169 Remove references to not-exiting-anymore FrozenHashCodeException.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2979583002 .
2017-07-11 10:40:09 -07:00
Peter von der Ahé 99d637f581 Improve parsing of function expressions.
Fixes #29937
Fixes #29978
Fixes #29979

R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2968093003 .
2017-07-11 10:35:59 +02:00
Peter von der Ahé 710ddf02ff Remove all deprecated fasta message methods from analyzer.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2975823002 .
2017-07-11 09:26:27 +02:00
danrubel def1ee6604 add analysis server --flutter-repo startup flag
This adds a new flag used by `flutter analyze --watch` when analyzing
the flutter repository. When specified, this flag causes analysis server
to enable the public_member_api_docs lint even though it is not enabled
in the analysis_options file. `flutter analyze --watch` needs the results
of this lint to summarize the number of public members missing dartdoc,
but enabling it in the analysis_options causes too much noise in the IDE.

See https://github.com/flutter/flutter/issues/10721 for more background

R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2976473003 .
2017-07-10 16:50:04 -04: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
Peter von der Ahé b023d925ea Use FastaMessage instead of String. Part 1.
See #30080.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2965393002 .
2017-07-10 19:50:14 +02:00
Florian Loitsch 5d4a786f44 Revert "Don't use LinkedList in the core libraries anymore."
This reverts commit fe17b5b2bc.

Review-Url: https://codereview.chromium.org/2974073002 .
2017-07-10 14:58:04 +02:00
Florian Loitsch fe17b5b2bc Don't use LinkedList in the core libraries anymore.
R=lrn@google.com

Review-Url: https://codereview.chromium.org/2975443002 .
2017-07-10 14:09:24 +02:00
Peter von der Ahé 9236a3445e Deprecate all diagnostics methods that use strings.
See #30080.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2970273004 .
2017-07-10 11:23:09 +02:00
Konstantin Shcheglov 4323722416 Stop using ExecutableElement.functions in tests.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2965423002 .
2017-07-07 13:05:38 -07:00
Konstantin Shcheglov a673395664 Don't depend on visiting local functions.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2970403002 .
2017-07-07 13:01:23 -07:00
Konstantin Shcheglov a092694280 Don't summarize labels, remove resynthesis code for labels.
This removes UnlinkedLabel altogether, because it is not used anywhere
else. We need to keep the corresponding field, so I changed its type
to String.

R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2972233002 .
2017-07-07 10:22:18 -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
Jennifer Messerly 90380dfdfa fix #27259, implement covariance checking for strong mode and DDC
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2954523002 .
2017-07-06 14:31:35 -07:00
Paul Berry 9a669557d7 Remove code for computing summaries based on the Fasta parser.
This code was never completed, and since then we've decided to do
something different: summaries for the new front end will be based on
kernel format rather than analyzer summary format.

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2972093002 .
2017-07-06 13:42:54 -07:00
Konstantin Shcheglov 19265a82b4 Move findElementsByName() into shared analyzer/element_search.dart file.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2965133003 .
2017-07-06 11:51:17 -07:00
Konstantin Shcheglov 2c33abdca9 Remove resynthesizing constructors for LocalVariableElementImpl.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2968203002 .
2017-07-06 10:23:02 -07:00
Konstantin Shcheglov b1c79f3363 Add @override(s) for Fasta MockElement(s).
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2970813005 .
2017-07-06 10:14:37 -07:00
Konstantin Shcheglov 2bfde5a34e Don't serialize and resynthesize local variables.
It does not affect completion, because we create local variable
elements in a unit during resolution of this unit.

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

Review-Url: https://codereview.chromium.org/2963183002 .
2017-07-05 17:57:25 -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
Brian Wilkerson 9bb89bc026 Duplicate change from NodeLocator to NodeLocator2
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2968023002 .
2017-07-05 11:24:08 -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
Konstantin Shcheglov cfbf85c340 Remove unused PubVerifier.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2973683002 .
2017-07-05 10:33:21 -07:00
Konstantin Shcheglov e93566189f Fix for types of function-typed parameters in reified type of MethodElement.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2965053002 .
2017-07-05 10:32:31 -07:00
Konstantin Shcheglov cf66612116 Change UnusedLocalElementsVerifier to AST visitor.
We are moving to excluding local elements from the element model,
so we cannot use element visitor to visit and report local elements.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2967183002 .
2017-07-05 10:12:05 -07:00
Konstantin Shcheglov ec621a67c1 Remove HintGenerator.
It is not used neither by tasks, nor by the driver.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2971843002 .
2017-07-05 09:38:25 -07:00
Peter von der Ahé 5999f45148 Implement type variables on old style function-typed formal parameters.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2969053002 .
2017-07-05 14:54:21 +02:00
Brian Wilkerson f6a2fb0050 Clean up AstProvider hierarchy
Review-Url: https://codereview.chromium.org/2969793002 .
2017-07-01 12:06:33 -07:00
Konstantin Shcheglov e64c18435f Issue 30028. Fix for invoking loadLibrary() for deferred library with invalid URI.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/30028

Review-Url: https://codereview.chromium.org/2968763002 .
2017-06-30 10:32:25 -07:00
Leaf Petersen 24f9478550 Fix handling of inline JS types in DDC.
DDC was incorrectly interpreting inline JS types, and hence marking
some things as non-nullable which were nullable.  This fixes that, and
also slightly improves the analyzers treatment of inline JS types.
Also fixes some incorrect inline JS type annotations in DDC patch
files.

BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2965633002 .
2017-06-29 16:02:04 -07:00
Brian Wilkerson d29c5d3a72 Fix the resolution of uri-based part-of directives in the SDK (issue 29598)
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2967503002 .
2017-06-29 13:51:45 -07:00
Konstantin Shcheglov 077b6b687d Remove incremental: logger, validator, options.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2968473002 .
2017-06-29 11:51:12 -07:00
Konstantin Shcheglov b3fe985371 Use AnalysisDriver.getCachedResult() for 'implemented' notification.
In general case we cannot use getResult() in this notification.
We generate these notifications after analysis is complete in scheduler.
But if there is no cached result, getResult() will schedule analysis.
So, we might get into a loop.

In practice this worked, because IDEA always makes files priority,
so their results cached, and then subscribes for notifications.
But in general case we need this protection.

This also means that the 'implemented' notification works (and will
work) only for priority files.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2965533002 .
2017-06-29 09:57:20 -07:00
Konstantin Shcheglov 4484160ce9 Include types of ClassTypeAlias into subtyped names.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2963003002 .
2017-06-28 15:01:30 -07:00
Konstantin Shcheglov ef45b380fc Record ClassTypeAlias(s) as subtypes.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2956403002 .
2017-06-28 14:26:16 -07:00
Konstantin Shcheglov e0f4c7b467 Report only private members in the same library as overrides.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2959273002 .
2017-06-28 13:47:33 -07:00
Konstantin Shcheglov f09be80615 Record only names of instance members in subtypes.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2961143002 .
2017-06-28 12:55:07 -07:00
Konstantin Shcheglov 2b64bbed6a Add SearchEngine.membersOfSubtypes().
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2962023002 .
2017-06-28 11:44:48 -07:00
Konstantin Shcheglov 166c47d771 Issue 29968. When a file is added, and it is already known, refresh it.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/29968

Review-Url: https://codereview.chromium.org/2959903005 .
2017-06-28 11:05:57 -07:00
Brian Wilkerson 563720617c Allow trailing comma in assert
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2961063002 .
2017-06-28 10:46:44 -07:00
Konstantin Shcheglov 7d7689ab5c Implement search for direct subtypes in a single AnalysisDriver.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2956193003 .
2017-06-28 10:35:16 -07:00
Konstantin Shcheglov c175f4bf75 Index subtypes with supertypes, and names of members they declare.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2957203002 .
2017-06-28 08:28:14 -07:00
Peter von der Ahé 616da7ea04 Generate type variable events before parsing return type.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2963473004 .
2017-06-28 10:08:10 +02:00
Peter von der Ahé 90fb88710f Rename handleFunctionType to endFunctionType.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2961813002 .
2017-06-28 10:00:57 +02:00
Konstantin Shcheglov dcc66e6fa9 Store subtyped names in Analysis Driver unlinked units.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2955163002 .
2017-06-27 12:38:36 -07:00