Commit graph

1142 commits

Author SHA1 Message Date
Paul Berry f1efb202d1 Implement AstBuilder integration for instance creation expressions.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2982323002 .
2017-07-20 12:52:10 -07:00
Konstantin Shcheglov 1170b117c9 Remember isFieldFormal informative flag in VariableDeclaration(s).
It is informative in the same way as documentation.

Yesterday I tried to make Analyzer and Analysis Server stop using
FieldFormalParameterElement(s) and found one important use case requested
by the Flutter team. We need to show documentation of a field when
user requests documentation on the corresponding field formal named
parameter. This happens outside of the file that declares the parameter
and the field, so we don't have AST available. Of course we could
resolve the unit, but it would cost us something. And if we decide
that it is OK, then maybe we don't need to have documenation comments
in elements at all.

This is of course more convenience, and we could store documentation
and parameter to field mappings outside, like we store index. Just a
compromise - convenience vs. purity.

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

Review-Url: https://codereview.chromium.org/2983173002 .
2017-07-20 09:53:04 -07:00
Paul Berry a93aee1a08 Further integration of front end type inference into analyzer.
This CL propagates types from top level variable declarations into
analyzer ASTs.

This required adding a finishFields method to parser listeners (and a
corresponding method DietListener.listenerFinishFields which calls
it); this allows AnalyzerDietListener to thread the types through from
the BodyBuilder to the AstBuilder.  This is similar to what we were
already doing for methods.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2987503003 .
2017-07-19 23:00:52 -07:00
Bob Nystrom 0947675d6d Migrate the language tests up to arithmetic_test.
This technically steals a few tests from the previous batch that spans
corelib and language, but I wanted to start from the top of the language
tests.

Removed application_test and application_negative_test because they are
useless and the latter has never actually worked correctly since the day
it was transliterated from the long-defunct application file syntax.

R=bkonyi@google.com, whesse@google.com

Review-Url: https://codereview.chromium.org/2984443003 .
2017-07-19 20:30:21 -07:00
Sigmund Cherem 84828cff89 Random improvements in error reporting.
R=ahe@google.com

This mainly addresses comments and suggestions from
https://codereview.chromium.org/2979623002/
Review-Url: https://codereview.chromium.org/2980273002 .
2017-07-19 10:45:31 -07:00
Konstantin Shcheglov a295f782c0 Include TypeEnvironment into KernelResult.
We need it to use kernel.Expression.getStaticType().

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

Review-Url: https://codereview.chromium.org/2978333002 .
2017-07-19 09:40:33 -07:00
Sigmund Cherem 2628d75c4b Fix bots, address duplicate error reporting later.
My CL broke dartk/vm tests because I stopped reporting some errors accidentaly.
I thought I was duplicating all error messages, but turns out that recoverable
errors were only reported in the line fixed here.

This reverts to the old behavior so we can address the reporting issues
separately. Added details to: https://github.com/dart-lang/sdk/issues/30194

BUG=

Review-Url: https://codereview.chromium.org/2977423002 .
2017-07-18 19:42:28 -07:00
Sigmund Cherem 1aa139bc94 Unifying compiler context
Changes in this CL:
 - Updated CompilerContext:
    - it now contains a ProcessedOptions object

    - it no longer depends on CompilerCommandLine/CommandLine

    - it delegates to ProcessedOptions.report so all error reporting
      goes to one single place.

    - use "withContext" term instead of "withGlobalOptions" to be
      more clear about the intent

 - Changes in public API
    - added more options that correspond to flags in command-line
      fasta tools

    - default onError is different: we now use the
      command_line_reporting report, which prints and throws
      on fatal messages, but doesn't throw eagerly on all messages
      as before.

    - introduced "printMessages" option: make it easy to have
      both onError + command_line_reporting  (kernel-service.dart
      is the main use case at this time, other ideas welcome!)

    - renamed CompilationError to CompilationMessage

 - Other changes

    - set exit code is done on report, not on format
    - fixed corner cases not covered in previous CL
        - error reporting with missing-main needs to happen with
          a context
        - missing error cases when inferring .packages and input
          URIs are not file:* URIs

Ideas for follow up after this CL:
 - combine ProcessedOptions and CompilerContext into a single class
   (or extend one from the other)
 - switch onError to a stream

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2982093003 .
2017-07-18 17:02:59 -07:00
Peter von der Ahé 4565719783 Remove number from operator mismatch message.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2978903002 .
2017-07-18 14:43:11 +02:00
Peter von der Ahé 3709ff5150 Add closeBraceTokenFor and use it instead of BeginToken.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2978073002 .
2017-07-18 13:57:10 +02:00
Peter von der Ahé 3216bda008 Move parser helper classes to own files and clean them up.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2978063002 .
2017-07-18 13:02:41 +02:00
Peter von der Ahé c348f019ec Rename FunctionDeclaration to LocalFunctionDeclaration.
R=danrubel@google.com, johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2982033002 .
2017-07-18 12:35:41 +02:00
Konstantin Shcheglov 58b3421f5c Issue 30179. Infer return type of static setters to 'void'.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG= https://github.com/dart-lang/sdk/issues/30179

Review-Url: https://codereview.chromium.org/2977303002 .
2017-07-17 16:24:21 -07:00
Sigmund Cherem 8ecb50d0de Throw if there is no compiler context available
BUG=
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2980033004 .
2017-07-17 13:16:18 -07:00
Vyacheslav Egorov c6815e8522 Reapply 0489249d29 with a fix for front_end tests.
Proper sequencing of _asyncStackTraceHelper in Kernel

This helper function was being called before its argument was
initialized so it was passing null.  Instead, it should be called
after its argument is initialized.

Because the initialization happens in Kernel code, it is simplest to
insert the call explicitly in Kernel code as well as part of the async
transformation.  This has the consequence that we now call the helper
function even when the flag causal_async_stacks is false.

Fixes issue #29771.
Fixes issue #30178
Fixes issue #30058

BUG=
R=aam@google.com, asiva@google.com

Review-Url: https://codereview.chromium.org/2936793003 .
Review-Url: https://codereview.chromium.org/2982943002 .
2017-07-17 20:56:28 +02:00
Peter von der Ahé efccdf7b1b Update expectations.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2976283002 .
2017-07-17 14:00:17 +02:00
Peter von der Ahé c50abfb1c4 Revert unrelated expectation changes.
This reverts a small fraction of ebb3dea075.

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

Review-Url: https://codereview.chromium.org/2981873002 .
2017-07-17 12:11:05 +02:00
Konstantin Shcheglov a9fbe224bc Add documentationComment for Class to Kernel. Parse it. Resynthesize in Analyzer.
R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2977133002 .
2017-07-15 09:53:48 -07:00
Sigmund Cherem 4ad4f985af Move reify to use fasta instead of dartk
Note the suite seemed to have a lot of tests crashing in verification.

With my change I'm noting other crashes, but I haven't investigated where they are from.

Also, to run the suite, before it used to be run as:

  dart pkg/kernel/test/reify/suite.dart

Now it needs to be run as:
  DART_CONFIGURATION=ReleaseX64 out/ReleaseX64/dart pkg/kernel/test/reify/suite.dart

BUG=
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2981813002 .
2017-07-14 15:04:43 -07:00
Sigmund Cherem ebd9440b18 support resolving .packages in FE
BUG=
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2979003002 .
2017-07-14 12:54:35 -07:00
Paul Berry 368055944c Reenable commented-out test.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2977973002 .
2017-07-14 10:11:09 -07:00
Sigmund Cherem 66b4efaa30 Disable printing in kernel-driver
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2980093002 .
2017-07-14 09:47:08 -07:00
Dan Rubel bb9ba11c6c translate more fasta error codes to analyzer error codes
R=ahe@google.com, paulberry@google.com

Review-Url: https://codereview.chromium.org/2978993002 .
2017-07-14 12:31:13 -04:00
Dan Rubel f12be9d64d more fasta event cleanup and testing
* make _end(optional: false) which uncovered unbalanced begin/end pairs
* update and document top level member events
* rename handleSwitchCase to endSwitchCase to better align with beginSwitchCase
* update and document begin/endFor/endForIn events
* cleanup test listener

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

Review-Url: https://codereview.chromium.org/2980043003 .
2017-07-14 12:28:09 -04:00
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
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