Commit Graph

4770 Commits

Author SHA1 Message Date
Konstantin Shcheglov ba189d1fd3 Fix for mismatch between existing FileState data and UnlinkedUnit.
I started implementing using of UnlinkedUnit, and found that I like
isShow and names better. Also, parts are always only URIs. And I think
that we are not going to need setters.

R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2936833003 .
2017-06-13 13:33:23 -07:00
Paul Berry a1ecb46a4c Fix top level type inference for binary operators.
Multiple changes were required:

- The analyzer's mock SDK had an incorrect return type for
  `num.operator/`.

- We weren't considering the RHS of the binary operators `+`, `-`,
  `*`, and `%` to be an inference dependency (we need to, since the
  special overload rules for int depend on the type of the RHS).

- We weren't executing the overload logic when doing top level type
  inference.

- The logic for deciding what operators are overloaded was incorrect.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2940703002 .
2017-06-13 13:07:00 -07:00
Konstantin Shcheglov 0912f3c640 Use API signatures for library cycle signatures when possible.
If there are mixin applications, we still have to use full content hashes.

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

Review-Url: https://codereview.chromium.org/2939743002 .
2017-06-13 11:39:29 -07:00
Konstantin Shcheglov 751c71f034 Store also 'hasMixinApplication' flag with UnlinkedUnit.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2940673002 .
2017-06-13 11:20:04 -07:00
Konstantin Shcheglov fbaa7d45c4 FlatBuffers formats for storing unlinked units.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2939653002 .
2017-06-13 08:50:49 -07:00
Peter von der Ahé db2e915aac Improve recovery from compile-time errors.
R=danrubel@google.com, paulberry@google.com

Review-Url: https://codereview.chromium.org/2938573002 .
2017-06-13 16:00:15 +02:00
Peter von der Ahé 14e9d0bd89 Prepare for improved error recovery from compile-time errors.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2931423002 .
2017-06-13 15:59:18 +02:00
Peter von der Ahé ea30fb6a0d Follow-up to CLs 2933723002 and 2932973003.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2933813002 .
2017-06-13 09:45:41 +02:00
Peter von der Ahé 5095646191 Apply transformations after comparing to golden files.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2939533002 .
2017-06-13 09:40:35 +02:00
Peter von der Ahé a78250d931 Support metadata on local variables.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2936503002 .
2017-06-13 09:15:54 +02:00
Peter von der Ahé 092ef81f95 Complain about cyclic typedefs.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2931303002 .
2017-06-13 09:13:23 +02:00
Peter von der Ahé 8da7993d63 Attempt to instantiate an enum class is a compile-time error.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2935593002 .
2017-06-13 09:12:51 +02:00
Peter von der Ahé f559a6d1e9 Throw NSM on unresolved factory redirection.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2933733002 .
2017-06-13 09:12:20 +02:00
Paul Berry 24bb748bc7 Implement type inference for "not" expressions.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2935763004 .
2017-06-12 17:44:25 -07:00
Konstantin Shcheglov c4de2886b1 Build reverse dependencies between LibraryCycle(s).
I plan using it for adding libraries that have not been affected by
the changed files, but must be sent to VM because of possible inlining.
We will find affected libraries and then climb up until we reach the
entry point.

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

Review-Url: https://codereview.chromium.org/2934933002 .
2017-06-12 17:30:52 -07:00
Paul Berry 31e2b4ac84 Add offsets to the == null calls inserted by null-aware desugaring.
This makes it possible to close a gap in testing instrumentation:
previously any annotations that were missing a file offset got
silently dropped.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2940453002 .
2017-06-12 14:06:51 -07:00
Paul Berry d4a64e52e7 Add type inference for assignments to this[...]
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2938443003 .
2017-06-12 14:00:59 -07:00
Paul Berry 5d58191948 Add type inference for assignments to super[...]
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2935783003 .
2017-06-12 13:34:38 -07:00
Konstantin Shcheglov 16833bce7c Add FileState.hasMixin/hasMixinLibrary properties.
We will use them to decide which kind of key to use for cache.

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

Review-Url: https://codereview.chromium.org/2928393004 .
2017-06-12 12:43:31 -07:00
Paul Berry cdb1e858d2 Add type inference for assignments to properties.
This covers explicit property accesses (using both `.` and `?.`) as
well as implicit properties of `this`.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2931363003 .
2017-06-12 11:33:06 -07:00
Konstantin Shcheglov e92aadb72f Report unused files to watch.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2933153002 .
2017-06-12 10:01:31 -07:00
Konstantin Shcheglov 5e8ceb60ab Implement GC for FileState(s).
Also fix for invoking watch().

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

Review-Url: https://codereview.chromium.org/2929363002 .
2017-06-12 08:48:03 -07:00
Dmitry Stefantsov 1c544012c3 Re-validate command line options after changing them in fasta
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2934763002 .
2017-06-12 11:30:42 +02:00
Peter von der Ahé 080a25f3a6 Various semantic checks on field initializers.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2929383002 .
2017-06-12 11:15:49 +02:00
Peter von der Ahé 2867303232 Various issues with duplicated names.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2934713002 .
2017-06-12 11:11:45 +02:00
Peter von der Ahé 0c7d657333 Complain about duplicated defer.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2933723002 .
2017-06-12 10:33:40 +02:00
Peter von der Ahé 35d77460e4 Various semantic checks regarding const and final.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2932973003 .
2017-06-12 10:27:22 +02:00
Peter von der Ahé 4e8203f9cd Improve error messages and recovery.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2924363002 .
2017-06-10 10:43:03 +02:00
Peter von der Ahé 202655ebb6 Add option for printing tokens produced by the scanner.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2933533002 .
2017-06-10 10:14:36 +02:00
Peter von der Ahé 96e494d534 Complain about external methods with a body.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2930093002 .
2017-06-10 10:13:04 +02:00
Peter von der Ahé 043c0096ad Complain about use before declaration.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2924423003 .
2017-06-10 10:12:18 +02:00
Peter von der Ahé dcbac2be00 Complain about incorrect use of null-aware operations.
R=danrubel@google.com, johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2932723003 .
2017-06-10 10:11:36 +02:00
Peter von der Ahé fd9716fa95 Various semantic checks on formal parameters.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2926953004 .
2017-06-10 10:10:07 +02:00
Paul Berry 6b65fc22f7 Annotate targets of implicit this property gets/sets in inference tests.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2933663002 .
2017-06-09 17:41:13 -07:00
Paul Berry 8f5bcddc31 Implement type inference for assignments to a static variable.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2933643002 .
2017-06-09 17:36:20 -07:00
Paul Berry ef94f715a9 Add type inference for assignment to local variables.
Also fix some upwards inference cases for assignment to index
expressions.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2928033005 .
2017-06-09 15:13:14 -07:00
Konstantin Shcheglov c2f18fc930 Implement promised watch behaviour.
1. There are no reasons to use different watch function between
   computeDelta() invocations, so I moved it to the constructor.

2. We need to call it, and await, before reading files, not after.

3. Added tests.

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

Review-Url: https://codereview.chromium.org/2931183003 .
2017-06-09 15:04:30 -07:00
Konstantin Shcheglov 6f4bba5f03 Compute API signatures of files.
Note, that in non-incemental case this change has negative performance
implications - compilation is 10% slower. Computing MD5 hashes is very
expensive.

In real life scenarios we will cache API signatures and URIs as
part of unlinked information for each file.

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

Review-Url: https://codereview.chromium.org/2926883003 .
2017-06-09 11:41:29 -07:00
Paul Berry 4abff2291b Rework type inference of assignments to index expressions.
The approach from the las CL (try to figure out the structure of the
assignment expression from the desugared result) turned out to be
unsustainably complex.  In this version we keep track of the structure
while doing the desugaring, and then store the result in a wrapper
object the kernel AST.  The wrapper object defers visit methods to the
object it wraps, so when the kernel objects are serialized to disk,
the wrapper disappears.

I also took the liberty of removing the code that inserts types
into the temporary variables and conditional expressions
introduced by desugaring.  I will add this in a later CL if it
proves to be necessary.

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

Review-Url: https://codereview.chromium.org/2927013004 .
2017-06-09 10:48:07 -07:00
Peter von der Ahé d9f14d6a2b Add --sdk option.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2929783002 .
2017-06-09 15:52:14 +02:00
Johnni Winther 2042128817 Include uriToSource from dill-based libraries in output.
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2929103002 .
2017-06-09 14:11:43 +02:00
Dmitry Stefantsov aa8ca9244a Add getTarget method to CompilerCommandLine
The method is used to create an instance of a backend target class.
CompilerCommandLine already has the necessary information for this ("target"
name string and "strongMode" flag).  Additionally, a backed target instance is
now not created in fasta.dart/parseScriptInFileSystem, but should be passed at
the call site.

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

Review-Url: https://codereview.chromium.org/2932513003 .
2017-06-09 11:04:44 +02:00
Dan Rubel 56402976cd more fixes for fasta analyzer integration
* fix scanner adapter setSourceStart
* fix fasta token copy() methods
* replace "is TokenWithComment" with "?.preceedingComments != null"
* update scanner test

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2928773003 .
2017-06-08 18:02:09 -04:00
Paul Berry 029771d746 Add type inference for complex assignments whose LHS is an index expression.
In later CLs I will expand on this code to handle other kinds of
complex assignments.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2926763003 .
2017-06-08 09:25:24 -07:00
Peter von der Ahé 001ac97389 Implement initializer asserts.
Closes https://github.com/dart-lang/sdk/issues/29762

R=kasperl@google.com

Review-Url: https://codereview.chromium.org/2930673002 .
2017-06-08 13:46:26 +02:00
Sigmund Cherem 6e8155ae6f Follow up improvement for checking dart:_builtin
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2915153002 .
2017-06-07 15:38:18 -07:00
Sigmund Cherem cb5f3842c4 Skip directly to the last library to set the entry point and check importUri
instead of fileUri.

On some scenarios fileUri is relative and entryUri was absolute, but importUri
should match for the entry library.

BUG=
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2926933002 .
2017-06-07 14:50:01 -07:00
Sigmund Cherem aecfab68aa Add an incremental reloader example and a utility tool to trigger a reload by
hand.

The example includes:
 - an interactive UI that lets you trigger reloads without typing commands
 - a wrapper of the incremental kernel generator that invalidates files based on
 modification time stamps

BUG=
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2928483005 .
2017-06-07 13:44:56 -07:00
Sigmund Cherem ebdb0af64f Add integration test: hot reload + incremental compiler
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2925953002 .
2017-06-07 12:47:27 -07:00
Konstantin Shcheglov c510737b17 Make a copy of files to invalidate to avoid concurrent modifications.
In contrast to Analysis Driver, in Kernel Driver FileState.refresh()
is asynchronous, so we might (and actually do) get concurrent watch
events that update the set of invalidate files.

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

Review-Url: https://codereview.chromium.org/2924943005 .
2017-06-07 11:10:50 -07:00