Commit Graph

4770 Commits

Author SHA1 Message Date
Konstantin Shcheglov 400c7a0cb5 Set main procedure for Program.
Why is it called main _method_ when it is actually Procedure?

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

Review-Url: https://codereview.chromium.org/2931603003 .
2017-06-07 10:59:32 -07:00
Konstantin Shcheglov 710af5af38 Measure time spent building graph of files.
It's about 1000 ms for analyzer_cli, which I use for benchmarking.

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

Review-Url: https://codereview.chromium.org/2932463002 .
2017-06-07 10:26:09 -07:00
Paul Berry 5c3dd4b11b Change MethodInvocation.interfaceTarget from a Procedure to a Member.
It's possible for the interface target to be a field, e.g.:

    typedef void F();
    class C {
      F f;
    }
    void g(C c) {
      c.f(); // Interface target is C::f
    }

Also, this CL fixes MethodInvocation.getStaticType() in the case where
the interface target is a getter.

R=dmitryas@google.com, kmillikin@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2923653003 .
2017-06-07 09:20:53 -07:00
Konstantin Shcheglov c569a4a8b8 Compute all canonical names only for libraries being serialized.
This makes compilation with Kernel Driver about 20% faster than Fasta,
about 5.8 seconds using Kernel Driver vs. 7.2 seconds using Fasta. Note
that this is initial compilation, i.e. nothing read from the cache yet.

R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2927463003 .
2017-06-07 08:50:04 -07:00
Dan Rubel b0374f214c update analyzer parser tests for fasta scanner
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2930453002 .
2017-06-07 11:05:44 -04:00
Peter von der Ahé c4a8b146e0 Semantic checks on switch cases and fall-through errors.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2926533004 .
2017-06-07 11:26:34 +02:00
Peter von der Ahé d6a766bb14 Improve NSM handling.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2927613002 .
2017-06-07 09:28:13 +02:00
Paul Berry 7ab22d7ad2 Properly flatten FutureOr types when inferring the type of an async method.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2923733004 .
2017-06-06 13:13:08 -07:00
Paul Berry f7f9d1766f Fix corner cases of type inference with implicit references to .call.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2928613003 .
2017-06-06 13:00:26 -07:00
Konstantin Shcheglov a0fb4d9aef Replace ClosedWorldClassHierarchy with IncrementalClassHierarchy in SourceLoader.
This does not cause any measurable performance changes for Fasta.

This speeds up initial compilation using Kernel Driver from 16 seconds
to about 7.6 seconds. Just using Fasta takes 7 seconds, so Kernel
Driver is just about 10% slower now.

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

Review-Url: https://codereview.chromium.org/2927523002 .
2017-06-06 12:38:23 -07:00
Paul Berry 32e78868bd Record method invocation targets that are not procedures.
We don't yet store the targets in the kernel representation, since
kernel currently requires method invocation targets to be procedures
(see https://codereview.chromium.org/2923653003/).  But we record the
target that we *would* store in the kernel to instrumentation so that
we can pass tests.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2920223008 .
2017-06-06 12:27:34 -07:00
Peter von der Ahé 470127ae46 Setup correct scope for initializers and complain about fields initialized more than once.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2916333002 .
2017-06-06 19:35:35 +02:00
Paul Berry 47d50e51a3 Add type inference for this expressions.
R=ahe@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2925603002 .
2017-06-06 09:54:19 -07:00
Peter von der Ahé 7df768af0d Restore invariant that stack is empty in parseFunctionBody.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2914373002 .
2017-06-06 16:58:31 +02:00
Dmitry Stefantsov 09e755196a Pass a Target instance to DillTarget instead of its name
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2924833002 .
2017-06-06 16:03:49 +02:00
Dan Rubel c36936f37f translate remaining fasta scanner error codes
This updates the fasta scanner to translate the remaining
previously untranslated error codes so that they will be seen
by the analyzer when the fasta scanner is used by analyzer.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2923113002 .
2017-06-06 09:08:13 -04:00
Paul Berry 3285dcf039 Remove type parameters from type promotion classes.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2923613002 .
2017-06-05 11:42:10 -07:00
Dan Rubel 32677b631f option to enable fasta scanner
* add cmdline option so that analyzer will use the fasta scanner
* refactor handling of unterminated strings

Use -DuseFastaScanner=true to use the fasta scanner
rather than the analyzer scanner

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2919163002 .
2017-06-05 14:13:08 -04:00
Dan Rubel c4449efa33 improve handling of missing interpolation identifier
When the fasta scanner finds a STRING_INTERPOLATION_IDENTIFIER token '$'
without an identifier, it now inserts a synthetic identifier

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

Review-Url: https://codereview.chromium.org/2922563002 .
2017-06-02 15:16:44 -04:00
Dan Rubel 5b6d7653fe fix unterminated interpolation expression handling
R=ahe@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2914213003 .
2017-06-02 13:47:08 -04:00
Paul Berry 506389a744 Remove an unnecessary TODO from PropertyGet type inference.
R=ahe@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2921913002 .
2017-06-02 08:57:48 -07:00
Dan Rubel b61f9f2343 improve fasta unterminated string recovery
This updates the fasta scanner
to append synthetic closing quotes to unterminated strings.

Rework of https://codereview.chromium.org/2912693002/

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

Review-Url: https://codereview.chromium.org/2915093002 .
2017-06-02 11:51:11 -04:00
Dmitry Stefantsov 1e2f06f8da Reapply "Use backend targets to run Kernel transformations in Fasta"
This reverts commit 0b424ca5d2

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2919003003 .
2017-06-02 16:10:28 +02:00
Peter von der Ahé a79a59d19c Improve position information.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2915123002 .
2017-06-02 15:14:53 +02:00
Peter von der Ahé cbcb7d4885 Clean up handling of types.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2915933004 .
2017-06-02 14:53:20 +02:00
Peter von der Ahé 696f00d96b Implement library access restrictions and privacy.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2916863003 .
2017-06-02 13:13:38 +02:00
Dmitry Stefantsov 0b424ca5d2 Revert "Use backend targets to run Kernel transformations in Fasta"
This reverts commit 8ff762067a.

TBR=ahe@google.com

Review-Url: https://codereview.chromium.org/2918923003 .
2017-06-02 12:45:34 +02:00
Dmitry Stefantsov ece423de17 Revert "Use 'outline.dill' instead of 'platform.dill' in kernel isolate"
This reverts commit 303ab0aa96.

TBR=sigmund@google.com

Review-Url: https://codereview.chromium.org/2919003002 .
2017-06-02 12:18:54 +02:00
Dmitry Stefantsov 303ab0aa96 Use 'outline.dill' instead of 'platform.dill' in kernel isolate
R=ahe@google.com, sigmund@google.com

Review-Url: https://codereview.chromium.org/2916083002 .
2017-06-02 10:53:40 +02:00
Dmitry Stefantsov 8ff762067a Use backend targets to run Kernel transformations in Fasta
R=ahe@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2918623004 .
2017-06-02 10:40:13 +02:00
Paul Berry eefdf15aa1 Perform type inference on default values of optional/named parameters.
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2915763008 .
2017-06-01 21:18:37 -07:00
Paul Berry 3babf830e7 Remove remaining references to defunct parameter --failure-summary.
As of db06324975, this parameter is no
longer supported by the test framework.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2915933005 .
2017-06-01 21:13:14 -07:00
Paul Berry 8ae9237efd Clean up type inference for PropertySet.
These changes are follow ups to
cd5bacbc54.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2916273002 .
2017-06-01 20:56:43 -07:00
Paul Berry 349f95f687 Fix a corner case of block closure inference.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2914983003 .
2017-06-01 16:07:59 -07:00
Paul Berry eec5e74188 Normalize URIs on entry to ValidatingInstrumentation.
This makes it possible to remove a type inferrer hack that wouldn't
have worked properly with part files.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2921683002 .
2017-06-01 09:54:56 -07:00
Konstantin Shcheglov 5bdfd1e69b Pass ClassHierarchy instead of creating it.
MixinFullResolution is also updated to create new ClassHierarchy
instance only if there are transformed classes. This improves
incremental kernel generator initial time from 22 to 16 seconds.

R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2918593003 .
2017-06-01 07:20:13 -07:00
Peter von der Ahé 5b94cfe33a Various infrastructure changes.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2917863003 .
2017-06-01 15:16:18 +02:00
Peter von der Ahé 984b13052d Compute correct return type for factory methods.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2917853002 .
2017-06-01 14:02:05 +02:00
Paul Berry 7cdf85da06 Fix a corner case of function type inference.
When an expression function's expression has type `dynamic` (or
`Null`, since `Null` is coerced to `dynamic`), the inferred return
type is taken from the context.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2921583002 .
2017-05-31 21:26:14 -07:00
Sigmund Cherem 2046d08c09 Fix error recovery for extracting native name.
I discovered this now that native is
enabled more widely (see bot failures here:
https://build.chromium.org/p/client.dart/builders/vm-kernel-linux-release-x64-be/builds/2731/steps/vm%20tests/logs/stdio)

Here is an example input that hit the problem:

  K() sync* {}; // //# 50: compile-time error

TBR=ahe@google.com

Review-Url: https://codereview.chromium.org/2916773002 .
2017-05-31 16:17:15 -07:00
Paul Berry a122a6409e Add some top level type inference rules for property gets.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2914113002 .
2017-05-31 15:17:16 -07:00
Paul Berry cd5bacbc54 Implement type inference for PropertySet.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2919623002 .
2017-05-31 15:09:28 -07:00
Sigmund Cherem 922326a91f Fix performance regression for checking that retricted types are not
extended/implemented.

BUG=
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2907333003 .
2017-05-31 14:07:17 -07:00
Sigmund Cherem 682011c7b2 Move enableNative to target, turn it on by default
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2913013003 .
2017-05-31 13:55:55 -07:00
Paul Berry f9c1cab33b Remove some bogus type promotion code.
This code was part of an attempt to prototype some possible extensions
to type promotion to handle `if (x is! Foo)`.  I thought I had
rendered it harmless, but it was having some buggy effects.

Also added a test case demonstrating the problem.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2914093002 .
2017-05-31 13:40:33 -07:00
Paul Berry 26c61e4d22 Implement type inference for PropertyGet.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2921443002 .
2017-05-31 12:26:10 -07:00
Paul Berry 54c57f0015 Remove TODOs from KernelConditionalExpression._inferExpression.
The code is correct as is (at least insofar as it matches analyzer's
behavior).  I've added a new test to verify this, and I've made a
comment on the spec asking for it to be updated to match analyzer's
behavior.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2916633002 .
2017-05-31 10:04:20 -07:00
Konstantin Shcheglov 3803374d32 Don't recreate CoreTypes in transformers. Pass it in.
The same will be done later for ClassHierarchy. So, it would be up to
the client to decide which flavour to create, and whether the same
instance can be reused.

R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2904203003 .
2017-05-31 09:54:27 -07:00
Paul Berry 2b561fe657 Clean up instrumentation of invocation targets.
We should be instrumenting at same the place we set the value of
`interfaceTarget`.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2917663002 .
2017-05-31 09:42:01 -07:00
Peter von der Ahé c0bf4eddbe Various checks for constant expressions.
Fixes https://github.com/dart-lang/sdk/issues/29379

R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2911023002 .
2017-05-31 15:57:03 +02:00