Commit Graph

4770 Commits

Author SHA1 Message Date
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 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
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
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
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 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 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 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
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