Commit Graph

8489 Commits

Author SHA1 Message Date
Konstantin Shcheglov 83c1106ffe Compute values of elements a unit constant expressions depend on.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1539623002 .
2015-12-17 11:47:54 -08:00
Konstantin Shcheglov e5e1dc77bd Replace using '_commentBeforeFunction' with visitXyzInScope().
Otherwise it gets really ugly with using FunctionTypeAlias which does not have
a body, and getters not having a FormalParameterList, and with parameters for
function typed parameters...

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1526973005 .
2015-12-17 10:52:23 -08:00
Konstantin Shcheglov 9801d58eb7 Compute all default values of parameters.
Look at the following code.

main([p = double.INFINITY]) {}

In ConstantVerifier we validate the value of "p" and while doing this validate
the value of the ConstFieldElementImpl that corresponds to "double.INFINITY".

The problem is that we compute "double.INFINITY" in the task that requires
RESOLVED_UNIT_n, where "n" is too high. What we really need is just one value,
not all values, and of course not the resolved unit. And when we will use
summaries, we will be able to provide these values without using AST at all.

So, we need to explicitly require computation of the default value of "p",
an explicit dependency on "double.INFINITY" and its explicit computation.
Currently it still causes using ASTs, but we will change this soon.

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

Review URL: https://codereview.chromium.org/1531233002 .
2015-12-17 08:06:09 -08:00
Paul Berry 80fc29cecd Fixes to mock SDK to enable dart:core to be summarized.
This CL makes the following changes to the mock SDK used by
AnalysisContextFactory.initContextWithCore:

- Getters created by the ElementFactory have their `synthetic`
  property set correctly, and their corresponding synthetic fields
  have their `final` property set correctly.

- The following class elements all have at least one constructor:
  Function, Iterable, Iterator, Map, Null, StackTrace, Type, num,
  double, _Proxy.

This allows resynthesize_test.dart's `test_core` to pass.

Also, some minor improvements are made to resynthesize_test.dart to
allow failures to be diagnosed more easily.

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

Review URL: https://codereview.chromium.org/1532763002 .
2015-12-17 07:19:47 -08:00
Paul Berry 493a03a0ed Add UnlinkedClass.hasNoSupertype property to summaries.
This is necessary in order to properly summarize the core type `Object`,
which lacks a supertype.

Note that there is no test for this functionality in
resynthesize_test.dart.  It will be covered as soon as the test
`fail_core` is enabled.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1531913002 .
2015-12-16 15:18:49 -08:00
Konstantin Shcheglov 9cb4fc5f1d Resolve comment references before function type aliases.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1535533002 .
2015-12-16 15:13:12 -08:00
Konstantin Shcheglov 5eb20232e3 Skip comments code blocks indented with 4 spaces.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1536483002 .
2015-12-16 14:28:30 -08:00
Paul Berry 7adf62209d Fix summary resynthesis for operators ending in '='.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1530363002 .
2015-12-16 13:59:16 -08:00
Paul Berry ac170168dd Add support for the "external" keyword to summaries.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1528983004 .
2015-12-16 13:32:19 -08:00
Paul Berry 7e1abb6cbc Remove an unused import
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1531063002 .
2015-12-16 13:13:40 -08:00
Paul Berry 98e8b0a118 Fix resynthesis of operator[]= from summary.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1533563003 .
2015-12-16 11:29:54 -08:00
Paul Berry 5ef4929ae2 Replace uses of setModifier with ElementImpl setters.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1524303004 .
2015-12-16 11:28:24 -08:00
Konstantin Shcheglov c19e958822 Don't produce [references] in GitHub-like code blocks in comments.
Mostly for the cases when we would like to demonstrate use or
lists or maps: `a[i] == b[i]`.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1527393002 .
2015-12-16 10:32:10 -08:00
Brian Wilkerson fa73d7e552 Restore auto-processing of plugins
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1523343004 .
2015-12-16 09:19:16 -08:00
Konstantin Shcheglov ea922ef7f4 Fix for recording static elements of a prefixed comment reference.
I notied during reading idl.dart that I'd like to see highlighting and
search for type names in comment references like [PrelinkedLibrary.dependencies].

With this change we get highlighting, search and refactoring for both.
Navigation also works (*).

(*) does not work in IntelliJ - it does not parse Dart comments for reference expressions.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1531613002 .
2015-12-16 09:03:25 -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
Paul Berry b22d7d532f Merge the prefix and references tables.
This makes the UnlinkedLibrary type go away, which means that we no
longer have any unlinked summary data which is spread across the
compilation units constituting a library.  That in turn means that we
should be able to safely re-link summaries even in the (pathological)
case where a change to URI resolution affects the relationship between a
library and its parts.

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

Review URL: https://codereview.chromium.org/1528113002 .
2015-12-15 12:33:25 -08:00
Paul Berry ceecfe862b Reserve element 0 in the references table for dynamic.
In addition to simplifying some serialization/deserialization code, this
paves the way for merging the references table with the prefixes table
by allowing the zeroth entry in both tables to act as a sentinel value.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1528083002 .
2015-12-15 11:25:11 -08:00
Paul Berry 518ae623d6 Move summary references into UnlinkedUnit and PrelinkedUnit.
This is a follow up to commit
f85684604b, which reorganized the
declarations by compilation unit to pave the way for allowing
summaries to be "re-linked" if the relationship between part files
changes.  Organizing references by compilation unit is another
necessary step to make that possible.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1523093003 .
2015-12-15 10:55:45 -08:00
Brian Wilkerson 56fe38f0ab Clean up imports in analysis_server and analyzer_cli (and one missed in analyzer)
R=paulberry@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1527793003 .
2015-12-14 19:31:46 -08:00
Paul Berry f85684604b Organize summary declarations by unit rather than by library.
In the initial implementation of summaries, all declarations for a
given library were thrown together into a single bucket, regardless of
the compilation unit in which they appeared.  This was done on the
grounds that semantically, the compilation unit in which a declaration
appears is irrelevant.

However, it turns out that this conflicts with one of the design goals
of summaries, which is to allow summaries to be quickly "re-linked"
when URI resolution changes.  Since "part" declarations use URIs to
refer to part files, this means that URI resolution may affect the
relationship among compilation units within a library; thus, the
declarations for each compilation unit need to be in their own data
structure.

A side benefit of this reorganization is to make the structure of the
summary more similar to the structure of the element model; this
should in turn make it simpler (and possibly more performant) to
convert between element models and summaries.

This CL reorganizes the declarations themselves; future CLs will
reorganize the dependency and resolution information to match.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1530503002 .
2015-12-14 16:30:15 -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
Konstantin Shcheglov 6824bd9b32 Fix for enum signatures.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1529593002 .
2015-12-14 10:53:08 -08:00
Brian Wilkerson e057af83d8 Move the remainder of generated/element.dart into better locations. There are no other changes to the code.
Clean-up of imports and moving of related tests will follow.

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

Review URL: https://codereview.chromium.org/1525663003 .
2015-12-14 09:54:24 -08:00
Paul Berry 9cff7ca404 Ensure that summary builders aren't used after call to finish()
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1522123002 .
2015-12-14 08:59:20 -08:00
Brian Wilkerson 1f3dabd9c7 Ensure that a complete library element has constants evaluated (issue 24890)
R=danrubel@google.com, eernst@google.com, paulberry@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1486663003 .
2015-12-14 07:51:07 -08:00
Konstantin Shcheglov 2f0f398c73 Fix lints: unnecessary_brace_in_string_interp
Also fixes two cases of empty_constructor_bodies.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1521883002 .
2015-12-13 13:05:00 -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
Paul Berry 5117400c2b Fix dead code hints in summary code.
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1523563002 .
2015-12-13 07:54:38 -08:00
Konstantin Shcheglov 56f0adf9bf Issue 25238. Update LoclaElement(s) visible ranges during incremental resolution.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/25238

Review URL: https://codereview.chromium.org/1522583005 .
2015-12-12 17:15:06 -08:00
Brian Wilkerson 51c3d1d523 Clean up a couple of hints
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1518183003 .
2015-12-11 16:46:56 -08:00
Konstantin Shcheglov 168556a3e4 Tweaks for hover.
1. Include full signature of classes - extends, with and implements clauses.

2. Provide statis type only for variables - for all other elements the static type is always the same as in the signature.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1513943005 .
2015-12-11 14:25:46 -08:00
Paul Berry 45068f01ed Track implicit vs explicit types in summaries.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1524443002 .
2015-12-11 13:49:14 -08:00
pq 9f91ef8080 ErrorCode enum update.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1518923002 .
2015-12-11 10:11:49 -08:00
John Messerly b2d7ebe56c fix #25171, clear "hasBeenInferred" flag when re-running resolution
TypeResolverVisitor undoes the work of InstanceMemberInferrer, so it should also unset the flag.

R=leafp@google.com

Review URL: https://codereview.chromium.org/1513143004 .
2015-12-10 16:16:52 -08:00
Brian Slesinsky f0eb582d49 A class that's only used as a field type should be considered used
BUG=https://github.com/dart-lang/sdk/issues/25184
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1512833007 .
2015-12-10 13:52:41 -08:00
Konstantin Shcheglov e94ec76865 Parse HTML files with keeping original attributes case.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1516073002 .
2015-12-10 13:51:48 -08:00
pq 62656833d4 Wraps up the server-side of the 'Allow a user to configure which hints are "fatal"' ask (#24452).
* migrates error filtering from a predicate to a process that can customize severities.
* moves filtering/processing from the `dart` task into the `getErrors` request and the errors notification.

See: https://github.com/dart-lang/sdk/issues/24452

(Pending a thumbs-up, support for CLI to follow.)

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1517723002 .
2015-12-10 13:35:11 -08:00
Konstantin Shcheglov eb6da55838 Paths where '..' is not right between separators are normalized.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1512363002 .
2015-12-10 10:39:53 -08:00
Konstantin Shcheglov 0f95992770 Issue 25218. The reference type of 'A' in 'A..foo' is 'Type'.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/25218

Review URL: https://codereview.chromium.org/1519583002 .
2015-12-10 10:20:40 -08:00
Brian Wilkerson 1a5a9a7247 Clean up syntax in generic method comments
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1515533004 .
2015-12-10 10:19:15 -08:00
Brian Wilkerson f0d249e269 Clean up package imports and library names
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1513643009 .
2015-12-10 08:11:56 -08:00
John Messerly 0e09465f0c fix #25183, add support to ErrorVerifier for generic methods
R=brianwilkerson@google.com, leafp@google.com

Review URL: https://codereview.chromium.org/1514683002 .
2015-12-09 15:16:00 -08:00
Konstantin Shcheglov e48f962af1 Validate that root paths are absolute and normalized.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/25203

Review URL: https://codereview.chromium.org/1511833004 .
2015-12-09 15:05:22 -08:00
John Messerly 7de1d190b9 fix #25182, downwards inference for calls to fields/getters/vars/params/locals
R=leafp@google.com

Review URL: https://codereview.chromium.org/1513603002 .
2015-12-08 16:17:06 -08:00
Leaf Petersen 9ea88b3e55 Generic method subtyping.
Fixes #25176 .

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1509263002 .
2015-12-08 14:56:47 -08:00
John Messerly c985c599ed fixes #25094, type params in static methods shouldn't always be an error
R=leafp@google.com

Review URL: https://codereview.chromium.org/1508183002 .
2015-12-08 14:08:24 -08:00
John Messerly e90e905978 fixes #25174, downward inference on list and map initializers with explicit type args
R=leafp@google.com

Review URL: https://codereview.chromium.org/1507883003 .
2015-12-08 14:02:56 -08:00
Brian Wilkerson 9b474c4fde Remove informational message
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1507353003 .
2015-12-08 11:39:25 -08:00
Konstantin Shcheglov 1b0a5c313f Issue 24648. Report HintCode.UNNECESSARY_NO_SUCH_METHOD.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/24648

Review URL: https://codereview.chromium.org/1506903005 .
2015-12-08 10:28:38 -08:00