Commit Graph

4835 Commits

Author SHA1 Message Date
Johnni Winther f2d609f522 Register type variables of is/as expressions in closures
Closes #32770

Change-Id: Id0fcb7731a9b3a1caaf4ad854c55d0a292b443dc
Reviewed-on: https://dart-review.googlesource.com/49640
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-04-05 20:05:33 +00:00
Johnni Winther 4d7327b7b7 Run inference test in strong mode
Change-Id: Iacfe794fe3303fd94574f6761389cce5f34e82da
Reviewed-on: https://dart-review.googlesource.com/49483
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-05 11:07:21 +00:00
Johnni Winther 7ed7e57aaa Assert that inference isn't expected on abstract methods.
This fixes the root cause of the bad inference on NativeTypedArrayOfDouble.[] in strong mode.

Change-Id: I6436ef1d49780cd0f931ab38120fbcba90380e7c
Reviewed-on: https://dart-review.googlesource.com/49420
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-04-05 09:32:25 +00:00
Sigmund Cherem 211b79f858 Fix printing of error messages when using bazel-root.
Temporary fix for printing error messages in bazel. When using bazel-root, we
currently present error messages by offset as:

  path/to/file@offset+length:

This change will fix it to show line and column numbers, as:

  path/to/file:line:column:

Soon I'll look into adopting the multi-root approach instead of using
bazel-root, so we should be able to delete this logic when we no longer support
the old frontend in bazel.

Change-Id: I2a44b87815ca85b4958adc2ac9a8d8289536b12f
Reviewed-on: https://dart-review.googlesource.com/49580
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-04-04 23:39:45 +00:00
Johnni Winther 1dfb1c2f64 Implement Dart 2 static subtyping
Change-Id: I8b61b30d036e4e89d04b2704c265b5f6ebea9f47
Reviewed-on: https://dart-review.googlesource.com/49120
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-04 08:02:51 +00:00
Stephen Adams c5caf7e294 dart2js: Pass through type arguments in parameter defaulting stubs
This fixes a problem where a defaulted optional argument
would cause the passed type parameters to be replace with dynamic.

Change-Id: I32cf327b3a4b6176f199164c840a1114fc302205
Reviewed-on: https://dart-review.googlesource.com/49081
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-04 00:20:41 +00:00
Sigmund Cherem ddbe2eece1 Change assertions in SSA so that it checks up to 100 instructions. This cuts
down compilation time for some very slow tests by a third.

Change-Id: Ic9886f4e8548262ea04208d97c93e54a3425b016
Reviewed-on: https://dart-review.googlesource.com/49260
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-04-03 20:42:10 +00:00
Stephen Adams 0c892a8bc8 Improve signatures of tear-offs
Signatures for static tear-offs cannot have free variables, so we can
always generate them in the types table.

Signatures for instance tear-offs can always use the existing
mechanism, since the type must be parameterized only by the class
instance type parameters.

Change-Id: I3ccfe8fc9220c57cfee07e1f7d9afbd5674b2b92
Reviewed-on: https://dart-review.googlesource.com/48841
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2018-03-31 01:30:21 +00:00
Stephen Adams 9858ea1f8d Explicitly store isIntercepted in full emitter tearoffs
The trick of detecting isIntercepted from the number of arguments does
not work with function type arguments. We fixed this in other places,
now fix it in the full emitter.

Change-Id: I35fcda11db1df0e7442b66317c9ea20674514722
Reviewed-on: https://dart-review.googlesource.com/48922
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2018-03-31 00:02:11 +00:00
Johnni Winther b970d834e1 Update type_representation_test to test strong mode types
Change-Id: Id2d88952f802796f3d7e4ff21593e0aec83eeee2
Reviewed-on: https://dart-review.googlesource.com/48620
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-30 12:12:00 +00:00
Johnni Winther a6a2152482 Add runtime type representation for void
Change-Id: Id4eff63656fc5eacfa7aada6120d85acec735cad
Reviewed-on: https://dart-review.googlesource.com/48426
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-30 11:05:43 +00:00
Sigmund Cherem 8d689fcca7 step 4 of ??: add omit-implicit-checks and preview-dart-2 flags, strong-mode
defaults to include implicit checks.

Closes https://github.com/dart-lang/sdk/issues/32332

Change-Id: Iad5311234dec50a3f8dbd6557264b3feeb92afc8
Reviewed-on: https://dart-review.googlesource.com/48459
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-29 22:13:09 +00:00
Sigmund Cherem d7a540bfe7 Document --enable-asserts in dart2js's help, and remove --checked.
Closes #32648

Change-Id: I0d4cc8dd7117909b484be4119c0f5e7627cf3f85
Reviewed-on: https://dart-review.googlesource.com/48708
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-03-29 00:20:18 +00:00
Sigmund Cherem 577b168c39 Fix jsinterop bug: we incorrectly added null values for js-interop constructor
calls.

Closes https://github.com/dart-lang/sdk/issues/32697

Change-Id: I7f372e9f32ec415f5d0e1472c04085029f41d5b9
Reviewed-on: https://dart-review.googlesource.com/48522
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-03-28 00:06:04 +00:00
Sigmund Cherem f9e12f1116 step 3 of ??: ignore old options from old FE
* preserve-comments: unused, only used for source-mirrors & dartdoc long long ago
* preserve-uris: ignored, mirrors-only flag
* allow-native-extensions: error, was only used for analyze-only with the old FE

Change-Id: Ic93c31edf188cdab3aa658c13018a432baf14742
Reviewed-on: https://dart-review.googlesource.com/48457
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-27 20:18:37 +00:00
Sigmund Cherem c0fa4e2fe3 step 2 of ??: remove unnecessary pattern in -m option
Change-Id: I58757a0988c2275a617e2fa13903de66585b8dd4
Reviewed-on: https://dart-review.googlesource.com/48454
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-27 20:18:32 +00:00
Sigmund Cherem 51867f28a2 step 1 of ??: cleaning up options...
* remove serialization options
* remove checks that are only for the old FE (e.g. checks about imply compilation and --analyze-*)

Change-Id: I148025a7158340339bba4205f3b961b3c9902e47
Reviewed-on: https://dart-review.googlesource.com/48453
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-27 20:18:26 +00:00
Johnni Winther 36c2a71fcf Handle FutureOr in RuntimeTypeNeed/Checks computations.
Change-Id: I3b5b3f3feb665ff2f34b0975fb0062515a7b6ffd
Reviewed-on: https://dart-review.googlesource.com/48400
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-27 08:03:32 +00:00
Sigmund Cherem 5d7820e68a Simplify option processing
Using immutable options objects was nice, but it came with a tax every time we added or modified
options (often having to edit 5 locations). I'm now using a mutable object and
default values are inline with the field declaration.

Change-Id: I92768f0ff50a4140271dc0ebfa3b615c94a57e4d
Reviewed-on: https://dart-review.googlesource.com/48446
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-03-26 21:55:32 +00:00
Johnni Winther 1c8c84fcfd Update kernel impact to match Dart 2 semantics.
Change-Id: Ia360bc42bd52ca9d81224a3ab1c4e4571451638f
Reviewed-on: https://dart-review.googlesource.com/48280
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-26 13:42:05 +00:00
Johnni Winther 5271cc4e81 Support FutureOr at runtime
Change-Id: I6d442ac160739490c2591367055aaa0ba0c00047
Reviewed-on: https://dart-review.googlesource.com/48143
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-26 12:54:58 +00:00
Sigmund Cherem 751357d630 Make dart.library.isolate false in consts and config imports
Closes #30539

Change-Id: I037ae91d66ad32059d096d3db8890c456230bb96
Reviewed-on: https://dart-review.googlesource.com/48062
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-23 20:21:19 +00:00
Emily Fortuna 36e3dd0ca1 Fix for not adding unnecessary arguments for $signature functions https://github.com/dart-lang/sdk/issues/32480
Fix for: https://github.com/dart-lang/sdk/issues/32480

Change-Id: I546205415514e60c691af0ffff5522d92aef4247
Reviewed-on: https://dart-review.googlesource.com/47662
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-23 19:46:46 +00:00
Sigmund Cherem 07d2c9f287 Add server category for dart2js
Change-Id: I077da86aff4420aba1323e98d6cde08ac871f6f1
Reviewed-on: https://dart-review.googlesource.com/47721
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-23 00:40:55 +00:00
Sigmund Cherem b66971a45d Fix config specific imports to dart.io and dart.mirrors in dart2js
This uses the environment_overrides section that I'm adding to the libraries
specification files.

Change-Id: I95c175533f21320dd44eab9988afe2644ed0c9d3
Reviewed-on: https://dart-review.googlesource.com/47406
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-23 00:02:54 +00:00
Sigmund Cherem 898260a998 Split dependency on dart:html from dart:js
This change is needed to be able to introduce a new platform "dart2js_server"
that represents compiling to dart2js for non-browser targets (like nodejs). Some
users (like Dart Sass) depend on this feature.

The old front-end made this work by using "--categories=all", this change should
make it possible to compile with "--categories=Server".

Change-Id: I41bf25ab19016154206c419a48884bdc4afbd444
Reviewed-on: https://dart-review.googlesource.com/47700
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-22 22:15:05 +00:00
Dan Rubel 7450e2ad60 Fix parsing of invalid interpolation in string literal
Change-Id: I7151cee5f97a5a43314885326e4806a0314af544
Reviewed-on: https://dart-review.googlesource.com/47582
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-22 18:50:13 +00:00
Sigmund Cherem 2fd9969c96 extend unstable API to pass in the location of the libraries-specification
For now I'm just passing null, in a future CL I will pass a valid library
specification uri. This is needed in order to provide a library specification
that fasta will use to determine the result of a config-specific import.

Change-Id: I5e6babb0eb11bd1037262ea1260bc67188ef4649
Reviewed-on: https://dart-review.googlesource.com/47405
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-22 18:03:04 +00:00
Dan Rubel 587e4f8723 Parse local function metadata
Change-Id: I6b578b295e645cf270126de93b03232acd302101
Reviewed-on: https://dart-review.googlesource.com/47400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-21 14:21:09 +00:00
Johnni Winther 1fc73bf1a6 Compute ClassFunctionType from signature function in Dart 2
- and reinsert assertion.

Change-Id: I2edd119dc53c46e764c07d095213183a186d9a22
Reviewed-on: https://dart-review.googlesource.com/47042
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2018-03-21 10:48:39 +00:00
Sigmund Cherem 996277d427 Entity-fy the non-frequence minifier so it can be supported under the CFE.
This minifier is used only when passing --no-frequency-based-minification.

Closes #32600

Bug: https://github.com/dart-lang/sdk/issues/32600
Change-Id: I91ae293c78f4cfe3dd0421493162d9e5744a9217
Reviewed-on: https://dart-review.googlesource.com/47303
Reviewed-by: Emily Fortuna <efortuna@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-03-20 20:28:53 +00:00
danrubel 08d305bbd7 Inline modifiers into endTopLevelFields and endFields events
Change-Id: I9681e22ae96c43626558ff567cbf4a12117095fa
Reviewed-on: https://dart-review.googlesource.com/47240
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-20 15:00:35 +00:00
Dan Rubel adb9f8cc0b Inline modifiers into beginClassDeclaration and beginNamedMixinApplication
Change-Id: I0d95029c203a77d4a9e9dc2d8f1b40bced7535c5
Reviewed-on: https://dart-review.googlesource.com/47186
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-20 13:28:17 +00:00
Johnni Winther 8eb749e032 Fix sourcemaps/name_test for kernel
Change-Id: I77e60ae236cf8a17edc3854496fc900d67915bd0
Reviewed-on: https://dart-review.googlesource.com/47040
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-20 11:35:49 +00:00
Dan Rubel 06949dc985 Inline modifiers into beginFactoryMethod event
Change-Id: Ibc1053126b020577625279f4fab0bcff71aa5d15
Reviewed-on: https://dart-review.googlesource.com/47182
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-19 22:04:37 +00:00
Dan Rubel 8fde515354 Inline modifiers into beginTopLevelMethod event
Change-Id: I40423fcd53dc6a374a1c5be280d1806c31f34a6d
Reviewed-on: https://dart-review.googlesource.com/47120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-19 20:20:37 +00:00
Sigmund Cherem 0c75857ad8 Fix old2new API conversion to use utf8.encode
Pub still uses the old API to provide inputs. Source files are provided as
String, which were were incorrectly provided as codeunits. The FE expected the
binary input to be utf8 encoded.

As a separate follow up, I can update pub to provide binary data directly, or
even move it to use the new API instead so we can delete the old API soon.
Because pub-build is being replaced, I'm inclined to only do a small fix there.
Closes #32561

Bug= dartbug.com/32561
R=johnniwinther@google.com

Change-Id: I69d9ac896d534427a918ded721ee946aa5c0fc34
Reviewed-on: https://dart-review.googlesource.com/46945
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-03-19 19:55:16 +00:00
Johnni Winther c3f177b8cc Add FutureOr to dart2js static type system
Change-Id: I0e26c82fffaa41d2e3fc02ba4d2b253c3673ce1a
Reviewed-on: https://dart-review.googlesource.com/46260
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-19 11:50:55 +00:00
Emily Fortuna db21add40c Adding test for async closures with type variables, and fixing how we emit stubs
with type parameters in the meanwhile.

Change-Id: I5fe1e94e7423af30adf4020b46269b8ea81ac07f
Reviewed-on: https://dart-review.googlesource.com/46700
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-16 17:46:18 +00:00
Dan Rubel b2dd274e08 Remove modifiers from local function event structures
This removes pushing and popping modifiers when parsing a local function
declaration since they cannot have modifiers.

Change-Id: Iabbc6bb050d7006d07d4ec5d2220947593d62fd6
Reviewed-on: https://dart-review.googlesource.com/46880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-16 16:05:07 +00:00
Peter von der Ahé e5c84938f2 Update names derived from Program
Change-Id: Ifdb072506fef909ccf5ad2e5270b1976ae61e3cc
Reviewed-on: https://dart-review.googlesource.com/31143
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-16 09:33:07 +00:00
Peter von der Ahé 4f2bdff90b Rename Program to Component
Change-Id: I1a3cc03fba9783807fa637a9d42fdbad68ee7686
Reviewed-on: https://dart-review.googlesource.com/31040
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-15 12:22:23 +00:00
Emily Fortuna ecdd7df091 Correctly return type signature on async closures.
Change-Id: Icd7472185a08245e9b8e7c0b7adb1132e384c43c
Reviewed-on: https://dart-review.googlesource.com/46400
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Emily Fortuna <efortuna@google.com>
2018-03-14 01:03:38 +00:00
Sigmund Cherem c438f8b3f4 Dart2js defaults to the new common front-end
Change-Id: Id0f69d258b010a746b56e259335185bcca7dafec
Reviewed-on: https://dart-review.googlesource.com/45143
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-13 19:25:59 +00:00
Johnni Winther b08bedee7e Update RuntimeTypesNeed to disable rti optimization
- for local signatures in strong mode.

Change-Id: I0cafead24b24a534813449b6bf710eeafcb569bd
Reviewed-on: https://dart-review.googlesource.com/46064
Reviewed-by: Emily Fortuna <efortuna@google.com>
2018-03-13 10:09:26 +00:00
Johnni Winther 42e7598f5d Don't emit function signatures for non-closure classes in Dart 2
Change-Id: I144ddd60abebe41549c1f5304d73cb56042c7289
Reviewed-on: https://dart-review.googlesource.com/46043
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-13 09:50:39 +00:00
Peter von der Ahé 8a9956d4a7 [dart2js] Handle Windows file names correctly.
Closes https://github.com/dart-lang/sdk/issues/31899

Change-Id: I0577e9cd5bab7083df53ccbee7ffb2258f08a442
Reviewed-on: https://dart-review.googlesource.com/46080
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-03-13 09:15:48 +00:00
Johnni Winther 1df3150d05 Compute emitted function signatures in RuntimeChecksBuilder
Change-Id: I9801df4e14ca70ac17bbec3d7fb5b53a138582f0
Reviewed-on: https://dart-review.googlesource.com/45702
Reviewed-by: Emily Fortuna <efortuna@google.com>
2018-03-13 09:14:36 +00:00
Stephen Adams 70d715f115 Substitute return type too
TBR=johnniwinther@google.com

Change-Id: I82cc6d6e7af8fb42956fbe538d770de66a449bd3
Reviewed-on: https://dart-review.googlesource.com/45924
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-03-10 03:44:28 +00:00
Stephen Adams b8093e3323 Generate signature of instantiated generic function from uninstantiated function
Change-Id: I8c02404e5a17f577d831f3a3b58ff075ad73e878
Reviewed-on: https://dart-review.googlesource.com/45755
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-09 21:05:38 +00:00