Commit Graph

6018 Commits

Author SHA1 Message Date
Dan Rubel 14b76d6b22 cleanup fasta parser send and expression events
* remove unused beginSend
* rename endSend to handleSend

* remove unused beginThrowExpression
* remove unused beginExpression event
* rename endThrowExpression to handleThrowExpression

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

Review-Url: https://codereview.chromium.org/2976103002 .
2017-07-14 10:20:01 -04:00
Peter von der Ahé c94f8ef9ec Remove deprecated_wrapInCompileTimeError.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2983463002 .
2017-07-14 14:29:59 +02:00
Peter von der Ahé 18a41eba08 Report messages instead of just printing.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2977013002 .
2017-07-14 14:07:44 +02:00
Peter von der Ahé 5b38490530 Undeprecate buildCompileTimeError.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2975183002 .
2017-07-14 11:43:05 +02:00
Konstantin Shcheglov 00d5012906 Format analyzer, analysis_server, analyzer_plugin, front_end and kernel with the latest dartfmt.
...instead of mixing formatting with actual changes in many CLs.

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

Review-Url: https://codereview.chromium.org/2975253002 .
2017-07-13 16:28:18 -07:00
Paul Berry df91c79078 Further integration of front end type inference into analyzer.
This CL propagates types for simple variable declarations into analyzer ASTs.

Note that for a variable declaration like `int x` we need to store two
pieces of information: the element pointed to by `int`, and the type
of `x`.  This CL handles the latter.  The former will wait until we
have enough of the element model built that we have an element to
point to.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2980053002 .
2017-07-13 14:42:05 -07:00
Konstantin Shcheglov ebb3dea075 Set 'isSyntheticDefault' for default constructors.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2981783002 .
2017-07-13 14:06:11 -07:00
Paul Berry 04ad043f49 Remove code associated with the old "kompile" functionality.
This code is no longer needed because we no longer run the front end
in "kompile" mode.

Also remove the old expectations files used by the "kompile" tests.

I will remove more code in future CLs.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2980883003 .
2017-07-13 12:18:44 -07:00
Paul Berry c9b42f6a41 Remove the "kompile" mode of running the front end.
This mode was needed in the early days of the front end when we were
contemplating the idea of building the analyzer AST representation of
code first, and then converting it to kernel.  Now that we build
kernel directly, it is no longer needed.

Further CLs will follow to remove code that is no longer used after
this change.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2980013002 .
2017-07-13 10:52:55 -07:00
Konstantin Shcheglov bead5672c6 Pass backend Target into Kernel driver.
Mock SDK in analyzer does not include all the internal libraries that
VM requires, and probably does not have to for analysis. So, we might
use NoneTarget to avoid requiring extra libraries and transformations.

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

Review-Url: https://codereview.chromium.org/2980813002 .
2017-07-13 09:13:37 -07:00
Paul Berry b87556e00d Start copying resolution/inference data from front end to analyzer ASTs.
This CL lays the groundwork for integrating the front end with
analyzer by creating a mechanism to copy resolution and type inference
information (produced by the front end's type inference engine) into
analyzer ASTs (produced by AstBuilder).

The general technique is to parse each function twice: once with
BodyBuilder as a listener and once with AstBuilder as a listener.  The
BodyBuilder generates a kernel representation of the function, but
this isn't used; instead, type inference and resolution information is
captured using ResolutionStorer (which is a TypeInferenceListener).
Later, this information is applied to the analyzer AST generated by
AstBuilder using ResolutionApplier (which is an analyzer AST visitor).

At the moment the intermediate data exchanged between ResolutionStorer
and ResolutionApplier is simply a list of types (one for each
subexpression, in a post-order traversal of the program syntax).  For
debugging and validation purposes, this is augmented with a list of
file offsets, so that if the ResolutionStorer and ResolutionApplier
get out of sync we can diagnose the problem easily.

In later CLs, more data will need to be exchanged between
ResolutionStorer and ResolutionApplier (e.g. a list of elements to
which identifiers are resolved).

This CL doesn't tackle the problem of translating between the kernel
and analyzer representation of types; for now we simply map each type
to `dynamic`.  This is sufficient for early development, since it is
still enough to let us verify that ResolutionStorer and
ResolutionApplier stay in sync.

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

Review-Url: https://codereview.chromium.org/2981693002 .
2017-07-13 08:55:29 -07:00
Peter von der Ahé 6dbcd67e01 Remove deprecated API from scope.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2975163002 .
2017-07-13 16:52:07 +02:00
Peter von der Ahé 8a6cf606ed Remove deprecated_memberError
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2983443003 .
2017-07-13 15:42:21 +02:00
Peter von der Ahé 579a23d8ef Remove deprecated_addError.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2982673002 .
2017-07-13 14:52:23 +02:00
Peter von der Ahé 959470b6e6 Remove deprecated_warning.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2980823002 .
2017-07-13 14:11:40 +02:00
Peter von der Ahé 17dc720681 Remove deprecated_warningNotError.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2977903002 .
2017-07-13 13:51:43 +02:00
Peter von der Ahé c894d8b62c Undeprecate IncompleteError.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2977893002 .
2017-07-13 13:09:30 +02:00
Konstantin Shcheglov e08b72cab9 Remove KernelDriver/IKG.invalidateAll().
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2975143002 .
2017-07-12 21:59:04 -07:00
Sigmund Cherem a7865761d4 Use messages for (some) public API errors
not entirely ready - looking for comments.

BUG=
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2979623002 .
2017-07-12 14:55:17 -07:00
Peter von der Ahé 83e4138cd4 Remove deprecated api from LibraryBuilder.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2977713002 .
2017-07-12 22:31:13 +02:00
Konstantin Shcheglov a77f6adca7 Add tests for KernelDriver.
Partically move and adapt corresponding tests from IKG.

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

Review-Url: https://codereview.chromium.org/2975093002 .
2017-07-12 13:22:19 -07:00
Peter von der Ahé 59e9638232 Remove deprecated methods from ClassBuilder.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2977693002 .
2017-07-12 21:59:46 +02:00
Paul Berry 285a18dd23 Rename most "debug" methods in TypeInferenceListener classes to "generic".
In a future CL I'm going to start taking advantage of the fact that
these methods provide a fallback behavior when the listener doesn't
override a more specific method, so to avoid confusion I'm renaming
the methods to reflect that use case.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2981653002 .
2017-07-12 12:29:34 -07:00
Konstantin Shcheglov b985f3c000 Rename TranslateUri to UriTranslator, rename files, extract Impl.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2982593002 .
2017-07-12 11:56:14 -07:00
Konstantin Shcheglov a9a926a197 Implement IncrementalKernelGeneratorImpl using KernelDriver.
What is not done, and I'd like to do in following CLs.

1. Write documentation for KernelDriver.
2. Add separate tests for KernelDriver.

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

Review-Url: https://codereview.chromium.org/2976003002 .
2017-07-12 11:24:45 -07:00
Peter von der Ahé ca4ad3e65d Remove deprecated_addNit.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2976753002 .
2017-07-12 18:44:52 +02:00
Konstantin Shcheglov cb3a79f883 Refactorings for TranslateUri and its tests.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2977703002 .
2017-07-12 09:22:17 -07:00
Peter von der Ahé 619006eac3 Sort generated messages.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2976743002 .
2017-07-12 17:43:22 +02:00
Peter von der Ahé 20ffc179b7 Remove prefixes from messages and document why.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2974203002 .
2017-07-12 17:18:05 +02:00
Peter von der Ahé de891789da Remove deprecated_internalProblem.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2974933002 .
2017-07-12 16:27:52 +02:00
Peter von der Ahé a66d0c797a Implement more message argument kinds.
R=johnniwinther@google.com, sigmund@google.com

Review-Url: https://codereview.chromium.org/2977653003 .
2017-07-12 15:03:53 +02:00
Peter von der Ahé 8a1600b12e Add --set-exit-code-on-problem option.
Fixes https://github.com/dart-lang/sdk/issues/30127

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2979713002 .
2017-07-12 14:29:17 +02:00
Peter von der Ahé 42bcc10aa8 Correctly pass options to CompilerCommandLine.withGlobalOptions.
See #30127.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2982443002 .
2017-07-12 12:26:04 +02:00
Konstantin Shcheglov fac4d2d603 Fix incremental_reload example after VmReloader -> RemoteVm rename.
TBR

There were 2 compilation errors and 1 hint.
I prefer when my workspace is error free :-)

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

Review-Url: https://codereview.chromium.org/2975793005 .
2017-07-11 12:11:58 -07:00
Konstantin Shcheglov 53d23afd23 Use precomputed uriBytes while computing cycle signature.
This makes the "perfect" incremental case (when every library has its
kernel ready in the byte store) about 5% faster.

R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2980523003 .
2017-07-11 10:37:01 -07:00
Peter von der Ahé 99d637f581 Improve parsing of function expressions.
Fixes #29937
Fixes #29978
Fixes #29979

R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2968093003 .
2017-07-11 10:35:59 +02:00
Peter von der Ahé 2baaf0be13 Rename special dart2js error codes.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2973053002 .
2017-07-11 10:00:16 +02:00
Peter von der Ahé 710ddf02ff Remove all deprecated fasta message methods from analyzer.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2975823002 .
2017-07-11 09:26:27 +02:00
Sigmund Cherem 2b8ced2132 Fix hot reload test
The test is currently skipped because of some flaky issue (issue #29819). I
noticed the test got broken while it's been disabled. This makes the test be in
working condition, even though it can't be enabled until we fix the underlying
flakiness in the VM.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2976553002 .
2017-07-10 12:52:28 -07:00
Sigmund Cherem f422249fcd Add support for multi-roots
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2964323002 .
2017-07-10 11:48:54 -07:00
Peter von der Ahé b023d925ea Use FastaMessage instead of String. Part 1.
See #30080.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2965393002 .
2017-07-10 19:50:14 +02:00
Peter von der Ahé 9236a3445e Deprecate all diagnostics methods that use strings.
See #30080.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2970273004 .
2017-07-10 11:23:09 +02:00
Sigmund Cherem b71bd543a9 Reapply "Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service.""
Original CL had a bug that wasn't visible unless you delete your
out/ReleaseX64/patched_sdk folder.

Patchset #1 is the original CL, patchset #2 shows the fix.

This reverts commit 4aadfe09df.

BUG=

Review-Url: https://codereview.chromium.org/2976543002 .
2017-07-07 15:32:24 -07:00
Sigmund Cherem 4aadfe09df Revert "Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service."
Reason: broke VM bots, still investigating.

This reverts commit 610d081947.

TBR= paulberry@google.com

Review-Url: https://codereview.chromium.org/2979463002 .
2017-07-07 15:21:37 -07:00
Sigmund Cherem 610d081947 Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service.
This CL tweaks the public APIs in package:front_end, and
starts using those APIs outside the package. For example, this
removes 9 uses of DillTarget, so it is not longer mentioned
outside pkg/front_end and the analyzer_target.

Actual changes:
 - in package:front_end

   * added kernel_generator_impl: new file contains code that
     used to be in kernel_generator. Code has some modifications:
     it uses a single canonical-root when loading summaries, and
     it supports generating both outlines and kernel in one go.

   * removed code that didn't belong here:
     a. most of calculating deps for .GN moved to patch_sdk
     b. vm-specific outcomes moved to kernel-service

   * updated how `native` is implemented, so we can more easily
     support dart2js and ddc

   * updated how we check where `int`, `bool`, etc can be implemented.

   * added support "hermetic mode" in modular builds
     ('chaseDependencies = false' option)

   * moved `trim` step out of fasta, and for now call it only within
     the public API. This is not yet exposed, and I stopped covering it in
     most tests (now only covered in shaker tests). The plan is to add
     tests for the public API covering this in the future.

   * removed `uriToSource` when serializing outlines

   * added unit tests for public APIs

 - patch_sdk
   * use the public API to craete platform.dill, outline.dill (now
     500K insted of 3Mb because it excludes sources), and vmservice_io.dill
   * moved here logic internal to .GN

 - kernel service
   * use the public API
   * moved here logic that depends on VM internals (e.g. status enum,
     compilation results)

 - package:compiler
   * use the public API in tools and unit tests
   * simplified patched-sdk generation: no more extending fasta's internals

 - package:kernel
   * fix bug in deserialization: initializers and other lists were
     overwritten accidentally with external definitions.
   * updated unit tests, moved shared logic to frontend/src/fasta/testing

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

Review-Url: https://codereview.chromium.org/2953703002 .
2017-07-07 15:14:22 -07:00
Paul Berry b38e4d9a70 Create more synthetic kernel objects.
This CL creates synthetic kernel objects for two additional
BodyBuilder corner cases:

- The synthetic "throw" expression created when code attempts to
  construct an abstract class.

- The "throw" expression created when code attempts to assign to a
  read-only expression.

With this change, we now create a KernelComplexAssignment object for
all assignments; this has allowed me to streamline the code for
creating assignments slightly.

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

Review-Url: https://codereview.chromium.org/2972873002 .
2017-07-06 13:51:36 -07:00
Paul Berry d8a6cfa4c1 Fix greatest/least closure computation when there are multiple ?s.
Also add both a unit test and a strong mode inference test case.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2965123002 .
2017-07-06 12:13:07 -07:00
danrubel 76779e720d fix fasta scanner comment processing
fixes python tools/test.py -m release -c dart2analyzer -r none -a x64 --host-checked language/illegal_declaration_test/01

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2973073003 .
2017-07-06 15:08:08 -04:00
danrubel 4da09b06d0 enable fasta scanner in analyzer by default
* update test because fasta scanner correctly warns on 1.e+2
* fasta scanner correctly produces compile time error
    see dartbug.com/28664
    fix dartbug.com/28680
* update fasta AsciiControlCharacter error code
* enable fasta scanner in analyzer by default

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

Review-Url: https://codereview.chromium.org/2967363003 .
2017-07-06 13:35:50 -04:00
Konstantin Shcheglov 1bb532d854 Issue 30006. Don't flush on write to FileByteStore.
It turned out to be too expensive for some users.

R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/30006

Review-Url: https://codereview.chromium.org/2971063002 .
2017-07-05 15:33:28 -07:00