Commit Graph

8489 Commits

Author SHA1 Message Date
Konstantin Shcheglov 878f3b9b1b Validate that (actual) resynthesized elements have the same runtimeType as originals.
Also some tweaks for the found inconsistencies.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1688233004 .
2016-02-12 11:32:04 -08:00
Bob Nystrom b0719aa402 Remove unused or unneeded stuff from java_core.dart.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1688113004 .
2016-02-12 11:10:48 -08:00
Paul Berry cc3d54e1ea Make "Unbound type parameter" bugs easier to investigate.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1688343003 .
2016-02-12 10:59:20 -08:00
Paul Berry 92ad0e0cba Store enums in summary file as bytes.
Reduces SDK summary file size by about 1%.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1690183003 .
2016-02-12 10:57:14 -08:00
Konstantin Shcheglov b61c5c06b1 Don't use _inFieldContext tracking.
For any practicaly purpose it was useless because we casted to
FieldDeclaration anyway to get documentation and isStatic field.

One additional change is that we now create ConstFieldElementImpl only
for non-static final fields. This corresponds to the logic in
ResolverVisitor.visitVariableDeclaration(), which clones initializers
only for final non-static fields.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1696793003 .
2016-02-12 10:38:37 -08:00
John Messerly d15416bdca change static method types to not have the class type parameters
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1683343005 .
2016-02-12 09:39:28 -08:00
Konstantin Shcheglov 1f5f2bc14f Resynthesize positional/named parameters as DefaultParameterElementImpl.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1695773002 .
2016-02-12 08:56:54 -08:00
Konstantin Shcheglov ea249124fe Mark FunctionExpression elements as used in DeclarationResolver.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1692533004 .
2016-02-12 07:05:49 -08:00
Bob Nystrom 1fb9cebd6e Get rid of redundant MockSdk.
The two in src/mock_sdk.dart and src/context/mock_sdk.dart were almost
identical. The former was only used in one place, so I made the latter
support that case.

Also cleaned up a few other minor things I noticed along the way.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1691603002 .
2016-02-11 15:20:04 -08:00
Paul Berry 5a58e09639 Make summary format stable when adding getters to idl.
This mechanism is the same as the "id" mechanism described in
http://google.github.io/flatbuffers/flatbuffers_guide_writing_schema.html,
except that for us the ids are always mandatory.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1691923002 .
2016-02-11 14:38:24 -08:00
Konstantin Shcheglov 9184f3862e Issue 25385. Set documentation comment for enum constants.
R=brianwilkerson@google.com, paulberry@google.com
BUG= https://github.com/dart-lang/sdk/issues/25385

Review URL: https://codereview.chromium.org/1689303002 .
2016-02-11 14:37:23 -08:00
Konstantin Shcheglov 6038ea770c Serialize parameters visible ranges.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1689283002 .
2016-02-11 14:26:54 -08:00
Konstantin Shcheglov d846e36373 Resynthesize local variables and functions.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1687403003 .
2016-02-11 13:54:11 -08:00
John Messerly f97640745e fix part of #25200, we now reject non-generic fn subtype of generic fn
A few other fixes:
* inference of generic function expressions now works. It was broken because they ignored type parameters.

* fixes subtype of generic functions in the "normal" type system. These types are only possible if generic methods support is enabled, which can be accessed via a flag. The generic methods DEP is designed to work with the normal Dart type system, too, so we try to keep these code paths working. ("normal" type equality for function types already handled this correctly.) This is also needed because strong mode delegates to normal type system for some cases, e.g. to pick warning vs error.

* also refactors structural comparison of two generic function types, along the lines of recent changes, so there is less code duplication. This was my original motivation, but reviewing the code led to the discovery of the other issues.

* refactors strong_test_helper. The existing way of matching up errors did not work with generic function expressions like: /*<T>*/(x) => x. Simplified it to just look for the right offset. This also exposed a bug in a test -- previously, it was possible to have an error that wasn't validated.

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

Review URL: https://codereview.chromium.org/1678313002 .
2016-02-11 13:42:49 -08:00
Konstantin Shcheglov c4602b0c8b Don't use Set when collecting constant targets in a unit.
This forces location / hashCode computation and caching, and the unit
is not linked to its library, so the cached values are not valid.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1691943002 .
2016-02-11 12:35:33 -08:00
Paul Berry 71b593f89e Minor improvements to list representation in flatbuffers.
This CL makes the following changes:

- Renames _FbInt32List to _FbGenericList, and makes it able to
  represent lists of entities whose size isn't 4.

- Adds Uint32ListReader and _FbUint32List classes, which are
  specialized to handle lists of 32-bit unsigned ints.

- Moves common elements of all _Fb*List classes to the _FbList base
  class.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1685263003 .
2016-02-11 12:14:29 -08:00
John Messerly 66e1a1d5f2 fixes #25740, substitute type parameter bound taking into account outer scope type params
FunctionTypeImpl's "typeFormals" now works like its "parameters". typeFormals now propagates the substitution down to the List<TypeParameterElement>, like we already did for List<ParameterElement>.

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

Review URL: https://codereview.chromium.org/1685273002 .
2016-02-11 12:13:21 -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 201a8d5570 Serialize local functions and variables.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1691693002 .
2016-02-11 11:20:34 -08:00
Paul Berry 4726810f05 Fix table size in flatbuffers.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1691033002 .
2016-02-11 11:05: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
John Messerly 6bf029a5c7 fixes #25641, error message when type arguments do not match
R=rnystrom@google.com

Review URL: https://codereview.chromium.org/1683203002 .
2016-02-10 14:46:31 -08:00
Paul Berry 9edfb4ad1a Refactor one more use of serializeUnlinkedReference
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1687963003 .
2016-02-10 14:12:20 -08:00
Paul Berry b18cdd3f77 Ensure that element handles never refer to Member objects.
This is necessary in order for "is" checks (e.g. `element is
ConstructorMember`) to function properly in the presence of element
handles.

To make this possible, it was necessary to lazify the `type` getter in
ExecutableMember, so that attempting to wrap an element handle inside
an ExecutableMember doesn't force the actual element to be
resynthesized.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1686283002 .
2016-02-10 14:11:13 -08:00
Konstantin Shcheglov e71080901f Remove only local variables/functions from the cache.
This is a temporary measure to restore incremental resolution in most
cases. In the future we should avoid putting constant variables into
cache at all and enforce this on the cache.put() level.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1682333003 .
2016-02-10 12:58:30 -08:00
Paul Berry 1f4d5390b9 Fix summarization of generic redirecting constructors (again).
In the previous fix (4b5d30abba) I
neglected to account for the fact that
ConstructorElement.redirectedConstructor is sometimes a
ConstructorMember, not a ConstructorElementImpl.

Fixing this required properly storing the redirected constructor's
type arguments in the summary.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1683813005 .
2016-02-10 12:55:10 -08:00
Konstantin Shcheglov da0a022962 Incrementally update incompletely resolved units.
When the context A uses unit U from the context B, we don't resolve U
in A to RESOLVED_UNIT, we usually stop somewhere before. But we still
want to update U in A incrementally. We don't put RESOLVED_UNITx
results into cache, so we don't write a less resolved unit as a more
resolved result.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1680403003 .
2016-02-10 11:35:00 -08:00
Paul Berry 8d130d1e09 Consolidate strings in summary output.
This reduces the size of the SDK summary by about 15.5%.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1687053002 .
2016-02-10 09:25:43 -08:00
Brian Wilkerson ec04f012f7 Move Token into the public API
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1690523002 .
2016-02-10 09:12:26 -08:00
Konstantin Shcheglov 6be32fee2d Fix for recording 'null' as a defined element.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1681493005 .
2016-02-10 08:50:10 -08:00
Paul Berry 9717305de4 Remove irrelevant TODOs from summary code.
Also remove the annotation `private` from idl.dart (it was never used).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1687793003 .
2016-02-10 08:34:05 -08:00
Paul Berry 4b5d30abba Fix summarization of generic redirecting constructors.
This should allow the SDK to be summarized again.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1687513003 .
2016-02-10 08:31:54 -08:00
Konstantin Shcheglov 135be23107 Issue dev_compiler@443. Clone beginToken.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/dev_compiler/issues/443

Review URL: https://codereview.chromium.org/1686653003 .
2016-02-09 19:24:14 -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
Paul Berry d3caa1342a Refactor code that populates the references table.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1681353002 .
2016-02-09 14:45:51 -08:00
Paul Berry e3f246c696 Add support for redirectedConstructor to summaries.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1686713002 .
2016-02-09 14:07:41 -08:00
Konstantin Shcheglov 85512a85f5 Use spec.sum SDK summary and CONSTANT_EXPRESSION_RESOLVED.
This lets us pass most of the shared tests even if we enable using
SDK summary.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1684773002 .
2016-02-09 13:25:25 -08:00
Konstantin Shcheglov abc69cb232 Add DirectoryBasedDartSdk.useSummary property.
R=paulberry@google.com, brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1687583002 .
2016-02-09 12:49:29 -08:00
Konstantin Shcheglov 4a99fe9e18 Collect defined elements together with used elements.
We cannot visit CompilationUnitElement and reach local variables and
functions. So, we need another way to know them while generating hints.

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

Review URL: https://codereview.chromium.org/1687573002 .
2016-02-09 12:44:58 -08:00
Paul Berry 8797494885 Rework UnlinkedPublicName.constMembers.
This CL makes the following changes to UnlinkedPublicName.constMembers:

- Includes non-const constructors in it.  This will allow a future CL
  to make use of it for redirected constructors.

- Omits unnamed constructors from it--they were never used, and just
  took up extra space.

- Renames it to UnlinkedPublicName.members to be consistent with the
  fact that it no longer just stores const members.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1685713002 .
2016-02-09 12:38:47 -08:00
Brian Wilkerson bdd0d637fe We need to perform analysis differently based on some option settings (such as strong mode), but there is currently a single SDK that is shared across all contexts no matter which option values are being used. This causes us to inconsistently analyze different portions of the SDK depending on which outer context was the first to request the analysis.
This is at least a first step toward solving this problem by allowing multiple SDKs to be created, one for each unique set of options.

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

Review URL: https://codereview.chromium.org/1686613002 .
2016-02-09 11:05:34 -08:00
pq fa08150ca6 Support for embedder dependency changes (#25606).
Adds logic to detect when a library embedder is added as a dependency and reconfigures the `SourceFactory` appropriately.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1653733002 .
2016-02-09 09:39:59 -08:00
Konstantin Shcheglov 854890836c Include dart/test_all into src/test_all and fix element tests.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1681153002 .
2016-02-09 08:41:23 -08:00
Konstantin Shcheglov 20d31ea8c3 Compute ElementImpl.hashCode using location.
We need this to ensure that Impl and Handle have the same hash.

This reduces number of shared test failures from 267 to 67 when using
SDK summaries.

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

Review URL: https://codereview.chromium.org/1677213003 .
2016-02-09 07:06:22 -08:00
Konstantin Shcheglov 5c58d884aa Fix for constant instance creation without type arguments.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1686453002 .
2016-02-08 18:26:09 -08:00
Bob Nystrom 3f3b242f39 Probably don't need an unused re-implementation of addAll(). :)
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1674963002 .
2016-02-08 15:12:10 -08:00
Konstantin Shcheglov f2a3a6ef8e Materialize ConstructorElementImpl as we analyze constants.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1674403002 .
2016-02-08 14:48:55 -08:00
Paul Berry d8f73358b9 Sort members in idl.dart.
I neglected to sort members when converting the idl format from fields
to getters; this rectifies the problem.

Note that sorting members changes the format of summary files, since
data is indexed according to its order of appearance in the idl.  In a
future CL I will introduce a mechanism to keep the indexing stable so
that introducing new fields won't break backward compatibility.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1681733002 .
2016-02-08 13:29:18 -08:00
Konstantin Shcheglov 66117c9d0d Support for _DeferredConstructorElement.context property.
This is the only left property that requires ElementResynthesizer.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1681723002 .
2016-02-08 12:58:27 -08:00
Konstantin Shcheglov 1b7a84ce3e Resynthesize constructor initializers.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1679923002 .
2016-02-08 12:42:31 -08:00