Commit Graph

6018 Commits

Author SHA1 Message Date
danrubel 56f07cf770 Revert "enable fasta scanner in analyzer by default"
This reverts commit d16163ca0b.

BUG=

Review-Url: https://codereview.chromium.org/2967253002 .
2017-07-05 16:18:13 -04:00
danrubel bf2b3e7061 modifiy insertTokenBefore to return the inserted token
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2970983003 .
2017-07-05 15:50:08 -04:00
danrubel d16163ca0b enable fasta scanner in analyzer by default
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2970883004 .
2017-07-05 15:47:33 -04:00
Peter von der Ahé f1f884011f Improve warnings related to incorrect 'part of' declarations.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2967143002 .
2017-07-05 15:22:57 +02:00
Paul Berry 6c769b39c9 Fix inference test expectations for generic function types.
The analyzer-based test code was incorrectly using typeArguments when
it should have been using typeFormals.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2965023002 .
2017-07-05 06:13:30 -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
Peter von der Ahé 6bb89e4fbf Use type variables on Typedef correctly.
R=johnniwinther@google.com, paulberry@google.com

Review-Url: https://codereview.chromium.org/2967923002 .
2017-07-05 13:12:27 +02:00
Peter von der Ahé fdd1073173 Add names to nested declaration to ease debugging.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2967903003 .
2017-07-04 15:33:40 +02:00
Peter von der Ahé 3fe6e76939 Implement toString on ModifierBuilder.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2972543003 .
2017-07-04 15:32:21 +02:00
Peter von der Ahé 83eede8ad4 Import message codes by prefix.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2964933002 .
2017-07-04 13:37:04 +02:00
Peter von der Ahé 3fd7bd1bdc Implement type variables on generalized function types.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2964013002 .
2017-07-04 13:29:23 +02:00
Lasse R.H. Nielsen 62bc61b367 Use relative URIs for core library part-of statements.
Reapply "Change some platform libraries to use `part of URI`."
Change to used relative URIs in the part-of declarations.

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

Review-Url: https://codereview.chromium.org/2911903002 .
2017-07-03 10:04:06 +02:00
Erik Corry 955a4b6e71 VM: Reland Inline instance object hash code into object header on 64bit.
Inline instance object hash code into object header on 64 bit.

64 bit objects have 32 bits of free space in the header word.
This is used for the hash code in string objects. We take it
for the default hash code on all objects that don't override
the hashCode getter.

This is both faster and a memory reduction. Eg it makes the
MegaHashCode part of the Megamorphic benchmark 6 times faster.

This is a reland of https://codereview.chromium.org/2954453002/
which fixes an issue that made script snapshots generated on
64 bit platforms incompatible with 32 bit VMs.

BUG=
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2965723002 .
2017-07-03 09:26:46 +02:00
Paul Berry d0a8b78576 Minor fixes to for-loop type inference
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2966603002 .
2017-06-29 14:35:12 -07:00
Paul Berry e2037dc9d1 Introduce a reusable mechanism for representing synthetic kernel objects.
We introduce a class KernelSyntheticExpression which can be used for
synthetic expressions introduced by the front end.  It is used for
expressions that represent errors detected by the front end, and it is
also the base class for KernelComplexAssignment.  By default, type
inference skips these synthetic expressions, inferring a type of
`dynamic`.  (Note, however, that classes dervied from
KernelComplexAssignment override this behavior).

We also introduce a class KernelSyntheticStatement which behaves
similarly, but is used for statements rather than expressions,
e.g. the synthetic assignment introduced at the top of a "for" loop
whose loop variable is defined elsewhere.

Finally, we modify KernelTypeInferrer.inferFieldTopLevel() so that it
deliberatly infers `dynamic` for fields that lack an initializer.
Previously this behavior happened as a result of the hack in
KernelTypeInferrer.inferExpression which caused type inference to
infer `dynamic` for anything that didn't implement KernelExpression.

All of these changes should help pave the way for removing the
aforementioned hack.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2968563002 .
2017-06-29 13:47:53 -07:00
Paul Berry 1e9c0d9722 Update expectations now that #30000 is fixed.
Test inference/unresolved_super now passes; it just needed an
expectation file.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2965513002 .
2017-06-29 10:44:56 -07:00
Paul Berry 7ee5d4b3a2 Create an option to disable type inference and type promotion.
This is intended for profiling, to ensure that type inference and type
promotion do not slow down compilation too much.

Currently the option is just plumbed through to the kernel Target
class since I'm not exactly sure how we'll want to enable/disable this
option; we can plumb it the rest of the way in a future CL.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2962913002 .
2017-06-29 05:31:06 -07:00
Peter von der Ahé ba84f801f4 Change how unresolved super sends are handled.
The mixin transformer is now responsible for adding no-such-method calls.

Fixes https://github.com/dart-lang/sdk/issues/30000

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

Review-Url: https://codereview.chromium.org/2963763002 .
2017-06-29 12:21:49 +02:00
Paul Berry 0958e40357 Adjust return types of spec-mode function expressions to match VM.
R=scheglov@google.com

The spec is unclear about what is supposed to happen here (see
https://github.com/dart-lang/sdk/issues/30044).  Matching the VM
behavior allows us to pass the existing tests.
Review-Url: https://codereview.chromium.org/2958363002 .
2017-06-28 14:36:00 -07:00
Paul Berry 0efe02372b In non-strong mode, don't infer the type of for-in loop variables.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2960003003 .
2017-06-28 12:43:05 -07:00
Paul Berry c99f11cf80 More fixes for missing interface targets when not in strong mode.
In my previous CL, I only addressed method invocation targets.  This
CL addresses getter and setter interface targets.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2963833002 .
2017-06-28 12:20:56 -07:00
Paul Berry 37a5c124ee Fix for missing interface targets when not in strong mode.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2959213002 .
2017-06-28 11:23:01 -07:00
Paul Berry 919d7965b7 Annotate remaining type inference failures with issue numbers.
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2958993005 .
2017-06-28 09:24:56 -07:00
Paul Berry 9fb886e709 Fix inferMethodInvocation in the case where interfaceMember is null.
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2956243003 .
2017-06-28 06:54:35 -07:00
Paul Berry 9994caf4e2 Add type inference of annotations.
Note that some locations where annotations can occur are not yet
supported by kernel and/or fasta, so there are some test failures.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2963703002 .
2017-06-28 05:30:23 -07:00
Peter von der Ahé 77683dcc2f Make all helper methods related to isValidMethodTypeArguments local functions.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2961803002 .
2017-06-28 10:11:03 +02:00
Peter von der Ahé 643b54f7a9 Remove unneeded arguments.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2959023002 .
2017-06-28 10:10:00 +02: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é 97454851b8 Remove all type-related peeking.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2958073002 .
2017-06-28 10:07:21 +02:00
Peter von der Ahé f10bdc6872 Reorganize parseType.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2961673003 .
2017-06-28 10:03:17 +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
Peter von der Ahé 08cfa29ec9 Use correct URI for field inference.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2955063003 .
2017-06-28 09:58:42 +02:00
Paul Berry 474d5e5d7f Test of type inference when super calls are unresolved.
See https://github.com/dart-lang/sdk/issues/30000 for an illustration
of why this is necessary.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2958113002 .
2017-06-27 14:10:05 -07:00
Paul Berry 12186bb40b Add a test to verify that variables declared in for-loops can be type promoted.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2960723003 .
2017-06-27 08:29:52 -07:00
Paul Berry fc32e0e72b Remove hack from KernelTypePromoter.isPromotionCandidate.
All variable declarations encountered by type inference are now of
type KernelVariableDeclaration, so we no longer need a hack to handle
ordinary VariableDeclaration objects.

Removing the hack avoids covering up bugs.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2961723002 .
2017-06-27 06:00:01 -07:00
Paul Berry 2f7c6d61f5 Add type inference for break and continue statements.
Note that no actual type inference needs to be performed, but we still
need to implement the _inferStatement() methods so that we can get rid
of the hack in KernelTypeInferrer.inferStatement.  Also, we need to
call into the listener so that once this logic is hooked into
AstBuilder, analyzer will stay in sync with type inference.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2962583002 .
2017-06-26 14:51:07 -07:00
Paul Berry 93ab0f107e Implement type inference for symbol literals.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2958813002 .
2017-06-26 14:28:48 -07:00
Erik Corry 3c543bb210 Revert "VM: Reland Inline instance object hash code into object header on 64bit."
This reverts commit 8378b8fdbf due to
mysterious crashes on 32 bit ARM with the Flutter Gallery app.

R=aam@google.com
BUG=

Review-Url: https://codereview.chromium.org/2962543002 .
2017-06-26 23:06:09 +02:00
Paul Berry d13f09c9e0 Add listener calls to ThisExpression and KernelTypeLiteral.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2961693002 .
2017-06-26 13:45:31 -07:00
Paul Berry 9f078625d4 Add type inference for super property gets.
I implemented the correct logic for both SuperPropertyGet and
DirectPropertyGet, since there are TODO comments in the code
indicating that the former will be replaced by the latter when
possible.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2959823002 .
2017-06-26 13:40:06 -07:00
Paul Berry e24eab66d9 Add type inference for super method invocations.
I implemented the correct logic for both SuperMethodInvocation and
DirectMethodInvocation, since there are TODO comments in the code
indicating that the former will be replaced by the latter when
possible.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2954403002 .
2017-06-26 12:42:46 -07:00
Paul Berry 5cd3c2c8dc Add type inference for assert statements.
Note that since the first argument of an assert statement may be
either of type `bool` or `() -> bool`, and the second argument may be
any object, no type context is passed down in downward inference; the
only inference we need to do is to recursively invoke
`inferExpression` to ensure that subexpressions are inferred properly.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2959763002 .
2017-06-26 10:05:08 -07:00
Paul Berry 213c2080a5 Add type inference for while and do loops.
Analyzer does not type infer these constructs correctly (it uses an
empty context for the loop condition, instead of bool), so the tests
are in inference_new.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2954253002 .
2017-06-26 09:07:27 -07:00
Paul Berry 7553b2e75c Implement type inference for try/catch blocks.
Note that the types of the exception and stack trace variables are set
in the BodyBuilder since they do not depend on inference of other
parts of the function.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2954823002 .
2017-06-26 08:57:00 -07:00
Paul Berry b94fdceadc Add type inference for switch statements.
Analyzer does not infer switch cases correctly (it uses an empty
context for the case expression, instead of the type of the switch
expression), so the tests are in inference_new.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2953423002 .
2017-06-26 08:49:01 -07:00
Peter von der Ahé 28084d1f85 Don't peek when parsing mixin applications.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2957503003 .
2017-06-26 14:13:37 +02:00
Peter von der Ahé a1ad4e4feb Remove peeking from parseTypedef and parseClassOrNamedMixinApplication.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2948383002 .
2017-06-26 13:15:47 +02:00
Peter von der Ahé 2c53bcbf12 Document where the parser uses peeking.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2950393003 .
2017-06-26 10:17:42 +02:00
Erik Corry 029b1cb948 Spelling fixes e to i.
R=kevmoo@google.com
BUG=

Review-Url: https://codereview.chromium.org/2957593002 .
2017-06-24 13:41:39 +02:00
Paul Berry 3b6f276c84 Implement inference tests for logical operators.
The tests for this are placed in inference_new because the analyzer
implemenation doesn't do proper downward inference.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2956723002 .
2017-06-23 14:47:41 -07:00