Commit graph

8081 commits

Author SHA1 Message Date
Stephen Adams 8a7c3331df dart2js: Make String.split return List<String>
Two follow-on optimization would reduce the generated code to closer to the original size:

- It would be profitable to write an optimization the removes the type
  information from any list when it can be proven the type information
  is not used.

- Provided the split result list is not modified, we can strengthen
  accesses to be non-null Strings.

Bug: https://github.com/dart-lang/sdk/issues/30548
Change-Id: I87ecdd129ec0227f982bd2e1f34193b3d6b0d81b
Reviewed-on: https://dart-review.googlesource.com/35081
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-18 02:02:24 +00:00
Alexander Markov 7bd5093f83 [corelib] Fix type argument of Iterable from EmptyIterable.map
Change-Id: Ifee26537d05848e4ea6d354f5d57e0f14574d050
Reviewed-on: https://dart-review.googlesource.com/35460
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-01-17 22:31:18 +00:00
Kevin Moore 0d785569d1 Fix library dartdoc references
Change-Id: Idf83e7f5dfb95e0097fa73fa0a0ecd68c76d2ac9
Reviewed-on: https://dart-review.googlesource.com/35381
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2018-01-17 20:01:18 +00:00
Lasse R.H. Nielsen 6178cc17ed Change the static castTo methods to be named castFrom.
It's just a better name.

Bug:
Change-Id: I0bf42b53fb5041faa307d288ffe12fb4b1ac7068
Reviewed-on: https://dart-review.googlesource.com/34180
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-01-15 08:59:31 +00:00
Paul Berry 45b02f8216 Use the new spec for Future flattening for type inference
Change Fasta type inference and Kernel type checking to use the new
definition for Future flattening, which is really unwrapping (peeling
off one layer of Future or FutureOr).  Use this for inferring types of
`await` expressions and return types from `async` functions.

Ensure that we are using the same notion of flattening for inference
and checking.  (Maybe it was a red flag that we weren't.)

This fixes await_test so that it produces a runtime error rather than
a compile time error - see #31541.

A similar change will need to be made to the analyzer - see #31887.

Change-Id: I7d936e9788969a48fdc216628eaa793389fb5e30
Reviewed-on: https://dart-review.googlesource.com/34504
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-01-15 07:09:36 +00:00
Ryan Macnak 9cf7d6fa93 Partial static mode changes for vm-service and tests (part 4).
Bug: https://github.com/dart-lang/sdk/issues/31587
Bug: https://github.com/dart-lang/sdk/issues/31696
Change-Id: I2b37ad97da0520db08f43981fdbc48b094942a0e
Reviewed-on: https://dart-review.googlesource.com/34306
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-01-12 20:12:41 +00:00
Ryan Macnak a4f3b53fe8 Reapply "Partial static mode changes for vm-service and tests (part 3)."
Remove use of castTo, which is not yet available in the prebuilt SDK used to build Observatory.

Bug: https://github.com/dart-lang/sdk/issues/31587
Change-Id: Ia118710a2c4dca1851935d284e1a78a9c6517256
Reviewed-on: https://dart-review.googlesource.com/34022
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-01-11 01:31:17 +00:00
Stephen Adams f756c5e71d Print names for generic method type parameters in function type
- Added JS_GET_FLAG('STRONG_MODE') allow the code to be tailored to
the type system version.

 - Split type stringifying code into V1 (existing logic) and V2
(strong mode Dart 2.0 logic).

The V1 code will eventually be deleted.

Change-Id: I78db91796040b6ecfa1bd5d6a9d64bd4c2bc4bcf
Reviewed-on: https://dart-review.googlesource.com/33680
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-01-10 21:00:48 +00:00
Devon Carew 8a60ff77d3 Documentation updates for dart:developer.
Bug:
Change-Id: Ib866d4eb347938aebb6f0dca8a8b1ec2827830d8
Reviewed-on: https://dart-review.googlesource.com/32900
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-01-10 17:24:09 +00:00
Jens Johansen 37c28f8661 Revert "Reapply "Partial static mode changes for vm-service and tests (part 3).""
This reverts commit c9f6e8695d.

Reason for revert: Change brakes Observatory:

```
$ out/ReleaseX64/dart --observe hello.dart
Observatory listening on http://127.0.0.1:8181/
Hello, world!
vm-service: isolate(348927110)  'hello.dart:main()' has no debugger attached and is paused at exit.  Connect to Observatory at http://127.0.0.1:8181/ to debug.
```

Going to the website I get
```
Unexpected exception:

NoSuchMethodError: method not found: 'castTo'
Receiver: ""
Arguments: [Instance of 'it']

StackTrace:

main.dart.js 2017:3     Object.f
main.dart.js 2203:30    Object.qn
main.dart.js 21316:11   b3.aQ
main.dart.js 20634:6    b3.c2
main.dart.js 20643:8    TZ.$1
main.dart.js 36992:29   UB.$0
main.dart.js 36982:9    Ux.nq
main.dart.js 36990:30   UC.$1
main.dart.js 36992:29   UB.$0
main.dart.js 36982:9    Ux.nq
===== asynchronous gap ===========================
main.dart.js 4840:12    Zh.e4
main.dart.js 3930:17    L.lK
main.dart.js 3932:28    L.ad
main.dart.js 20621:12   b3.dart.ba.lE
main.dart.js 20621:112  b3.dart.ba.lE
main.dart.js 20603:22   b3.cD
===== asynchronous gap ===========================
main.dart.js 4840:12    Zh.e4
main.dart.js 3930:17    L.lK
main.dart.js 3932:28    L.ad
main.dart.js 20621:12   ms.dart.ba.lE
main.dart.js 20621:112  ms.dart.ba.lE
main.dart.js 15829:10   Y4.bs
```

and Observatory is completely broken.

From https://github.com/dart-lang/sdk/issues/31397 it seems that Observatory uses an "old" sdk, i.e. we cannot use new stuff as castTo.

Original change's description:
> Reapply "Partial static mode changes for vm-service and tests (part 3)."
>
> Fix dynamic mode static warnings.
>
> Bug: https://github.com/dart-lang/sdk/issues/31587
> Change-Id: I966349f5409f911efacd11f08ffd469373bcd434
> Reviewed-on: https://dart-review.googlesource.com/33540
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=rmacnak@google.com,asiva@google.com

Change-Id: I775544cb5ab212cc836bc63181bdce31d19380b8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/31587
Reviewed-on: https://dart-review.googlesource.com/33800
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-01-10 12:21:53 +00:00
Ryan Macnak c9f6e8695d Reapply "Partial static mode changes for vm-service and tests (part 3)."
Fix dynamic mode static warnings.

Bug: https://github.com/dart-lang/sdk/issues/31587
Change-Id: I966349f5409f911efacd11f08ffd469373bcd434
Reviewed-on: https://dart-review.googlesource.com/33540
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-01-10 01:28:39 +00:00
Stephen Adams 8e3da7df7c js_runtime: Make CastErrorImplementation more like TypeErrorImplementation
I also added safe-printed irritant to the message, which in the case
of a primitive value or closure would tell you what value is causing
the problem.

Bug:
Change-Id: I530f5185f06d54ddc2ad4d45e11fa08b71213338
Reviewed-on: https://dart-review.googlesource.com/33260
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-01-09 20:49:09 +00:00
Ryan Macnak e8d9d945f3 Revert "Partial static mode changes for vm-service and tests (part 3)."
This reverts commit 6ccd7b8ac2.

Reason for revert: analyzer failures

Original change's description:
> Partial static mode changes for vm-service and tests (part 3).
> 
> Bug: https://github.com/dart-lang/sdk/issues/31587
> Change-Id: I812fd4cd8e74875ce7ada9886035137af2fef73a
> Reviewed-on: https://dart-review.googlesource.com/33100
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=rmacnak@google.com,asiva@google.com

Change-Id: Ic368fc23f58e02cafbaf6ae81dbcbffc3dcced13
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/31587
Reviewed-on: https://dart-review.googlesource.com/33240
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-01-09 02:37:56 +00:00
Ryan Macnak 6ccd7b8ac2 Partial static mode changes for vm-service and tests (part 3).
Bug: https://github.com/dart-lang/sdk/issues/31587
Change-Id: I812fd4cd8e74875ce7ada9886035137af2fef73a
Reviewed-on: https://dart-review.googlesource.com/33100
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-01-09 01:40:10 +00:00
Lasse R.H. Nielsen 4dd367c652 Fix return type of Base64Codec.decode to say Uint8List.
Update some documentation.

Change-Id: I4e05d89e84bd35068ca57917e752af235c62b647
Reviewed-on: https://dart-review.googlesource.com/32762
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2018-01-08 13:27:02 +00:00
Stephen Adams 31cd4e1457 Factor deferred loading data
'Normalize' the data used for loading deferred libraries.  Replace
URIs and SHA1 hashes with indexes so that the URIs and hashes occur
once.

Bug: https://github.com/dart-lang/sdk/issues/29635
Change-Id: I3ac8791ad44ca588cbb1bd7d86f18243c956a04a
Reviewed-on: https://dart-review.googlesource.com/32505
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-05 22:02:49 +00:00
Stephen Adams 6ceb6ce00e Emit type representation for generic function types
Change-Id: I0a10f5316b3e3c633c34f2a9e184de01ed9cf7de
Reviewed-on: https://dart-review.googlesource.com/32004
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-04 02:45:15 +00:00
Lasse R.H. Nielsen d1382f983c Initial steps to add cast operation.
Start by adding static castTo method to the interfaces. This provides everybody with the
desired implementation without exposing the classes.
When implementing the cast method, the recommended way is to (extend the base class,
but if you choose not to ...) use the castTo method.

If we ever get a language feature, we can implement the castTo method using that,
without being stuck with an unnecessary class.

Change-Id: I53274e60c88a4de519bead85d2ca44c1065a9c1a
Reviewed-on: https://dart-review.googlesource.com/26620
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-01-03 12:16:24 +00:00
Terry Lucas 476b1e02a9 Updated PYTHON code to correctly generate web_sql and re-wrote/re-enabled async web_sql test.
Also, updated status files to correctly fix failures in FF, IE and removed other spurious status entries.

R=alanknight@google.com,vsm@google.com

Change-Id: Ic965103d892ff4d5d119712e3187e829f57cd022
Reviewed-on: https://dart-review.googlesource.com/31800
Reviewed-by: Terry Lucas <terry@google.com>
2017-12-29 23:51:02 +00:00
Stephen Adams f937039bd6 Remove unused JS_BUILTIN
Became unused at:
1ae1ec7df4
Change-Id: I92c167dc2a071a45b2635b9b1d907015043d60ab
Reviewed-on: https://dart-review.googlesource.com/31560
Reviewed-by: Emily Fortuna <efortuna@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2017-12-28 01:16:02 +00:00
Terry Lucas 0af98266ab Revert "Updated PYTHON code to correctly generate web_sql and re-wrote/re-enabled async web_sql test."
This reverts commit 0c8294e4a0.

Bug:
Change-Id: Idb35c64fd5365f2669e8aff45765fed74e0f0766
Reviewed-on: https://dart-review.googlesource.com/31440
Commit-Queue: Terry Lucas <terry@google.com>
Reviewed-by: Terry Lucas <terry@google.com>
2017-12-23 01:59:38 +00:00
Terry Lucas 0c8294e4a0 Updated PYTHON code to correctly generate web_sql and re-wrote/re-enabled async web_sql test.
R=alanknight@google.com,vsm@google.com

Change-Id: I80e82f5aaa3c9748740031d8da139f79e2c0ab70
Reviewed-on: https://dart-review.googlesource.com/31080
Commit-Queue: Terry Lucas <terry@google.com>
Reviewed-by: Alan Knight <alanknight@google.com>
2017-12-22 22:57:34 +00:00
Ryan Macnak 9f4ffb64ef Partial static mode changes for vm-service and tests (part 2).
Bug: https://github.com/dart-lang/sdk/issues/31587
Change-Id: Ie2605f5043b9f5d2f9156928e3cd39f74e726853
Reviewed-on: https://dart-review.googlesource.com/30681
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2017-12-20 00:45:28 +00:00
Sigmund Cherem b280922064 Fix patch location for isolate library
Change-Id: Ie1f0913eb61dfd77e73d483fd48f235c58ded523
Reviewed-on: https://dart-review.googlesource.com/30626
Reviewed-by: Emily Fortuna <efortuna@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2017-12-20 00:15:43 +00:00
Ryan Macnak d528e1651f Reapply "Misc "strong" mode fixes for dart:io."
Remove changes to Socket.flush and Socket.done.

Split socket_test and socket_exceptions_test so we can minimize suppressions.

Bug: https://github.com/dart-lang/sdk/issues/31587
Bug: https://github.com/dart-lang/sdk/issues/31685
Bug: https://github.com/dart-lang/sdk/issues/27453
Change-Id: I3c44223480554f57d66be048c0361f6d0c699be2
Reviewed-on: https://dart-review.googlesource.com/30389
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2017-12-19 21:41:47 +00:00
Sigmund Cherem 414bad86df Directly create dart2js platform files using its patch files
Change-Id: I1c7d59968bfafeeb5a8b5252fa2d47e3c05b893e
Reviewed-on: https://dart-review.googlesource.com/27404
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2017-12-19 20:31:57 +00:00
Zachary Anderson 3cd62c4b74 [dart:core] Adds @Provisional annotation
@Experimental is already defined in dart:html. Adding the same
annotation to dart:core breaks the build. Removing the annotation from
dart:html and adding it to dart:core is a breaking change, e.g.
if someone has said "import 'dart:html' show Experimental".

This annotation is for use in the upcoming dart:standalone with
the waitFor(Future f) function:

https://dart-review.googlesource.com/c/sdk/+/29449
Change-Id: Iea2f537a2ae89a6097c4284084a2a168e833bb04
Reviewed-on: https://dart-review.googlesource.com/30261
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2017-12-19 19:00:22 +00:00
Ryan Macnak a51b45870c Revert "Misc "strong" mode fixes for dart:io."
This reverts commit c6f1ce24f3.

Reason for revert: standalone_2/io/socket_exception_test failing

Original change's description:
> Misc "strong" mode fixes for dart:io.
> 
> Bug: https://github.com/dart-lang/sdk/issues/31587
> Change-Id: I032be8e25aa8d6a851f0bf00ec12b1a3578308c6
> Reviewed-on: https://dart-review.googlesource.com/30080
> Reviewed-by: Zach Anderson <zra@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,zra@google.com,asiva@google.com

Change-Id: I9af0570577009b54e3a43f083008d65c4c3f9ba3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/31587
Reviewed-on: https://dart-review.googlesource.com/30420
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2017-12-19 00:04:10 +00:00
Zachary Anderson 971a15795e [dart:io] Allow setting overrides in the root Zone
Otherwise there is no way to install overrides that affect the whole
program.

related https://github.com/flutter/flutter/issues/13602

Change-Id: I905b7067e79f11051e8204ebb296915d495fd13f
Reviewed-on: https://dart-review.googlesource.com/30100
Reviewed-by: Florian Loitsch <floitsch@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2017-12-18 22:46:07 +00:00
Ryan Macnak c6f1ce24f3 Misc "strong" mode fixes for dart:io.
Bug: https://github.com/dart-lang/sdk/issues/31587
Change-Id: I032be8e25aa8d6a851f0bf00ec12b1a3578308c6
Reviewed-on: https://dart-review.googlesource.com/30080
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2017-12-18 22:15:06 +00:00
Vyacheslav Egorov b2eab8b96e [VM/Service] Restore zero-copying handling of JSON messages in vmservice.
In 5a44162c97 in attempt to adhere to declared
method signatures we lost zero-copying JSON decoding of responses from
VM: `Message.sendToVM` was changed to always decode the response into
string before passing it to the caller and the logic to use fused
JSON decoding was removed. This increased peak memory consumption by
the VM Service.

This commit addresses the issue by restoring the zero-copying JSON decoding
logic while adding a wrapper around responses that make it clear what kind
of data is passed around and how that data is encoded and handled.

We introduce a class `Response` which can contain either a Dart string, a
binary data (represented as a Uint8List) or utf8 encoded string (represented
as a Uint8List). This class is used in all places where previously a String
or dynamic were used, e.g. MessageRouter.routeRequest is changed to return
Future<Response> rather than Future<String>. This allows callees to
decode JSON responses without copying them into Dart heap while
maintaining sufficient level of typing to make the code easy to reason about.

This commit also removes some dead code from the VM service related to old
Service API and TAR assets unpacking (which has been long done in C++).

Bug: https://github.com/flutter/flutter/issues/13626
Change-Id: Ifbba56944a552034a0f802a965a313326a1236e7
Reviewed-on: https://dart-review.googlesource.com/30280
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-12-18 19:06:06 +00:00
Sam Rawlins eaa6790ef2 Clean up HttpClient docs
In particular, fix typos, and update many comments to begin with a one-sentence
summary, for better readability at api.dartlang.org.

Fixes #31608, #29460, #31538, #31449, #31505

Bug: https://github.com/dart-lang/sdk/issues/31608
Bug: https://github.com/dart-lang/sdk/issues/29460
Bug: https://github.com/dart-lang/sdk/issues/31538
Bug: https://github.com/dart-lang/sdk/issues/31449
Bug: https://github.com/dart-lang/sdk/issues/31505
Change-Id: If00726ef3636479f0613c91e48ff9f0e24b12502
Reviewed-on: https://dart-review.googlesource.com/30120
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-12-18 18:50:46 +00:00
Paul Berry 2822fbadea Fix the interface definition for Socket.close and Socket.done.
These members were defined as returning Future<Socket>, but the
implementation in _Socket didn't conform to the interface.  There's no
reason these members need to return Future<Socket> anyway, so just
change them to return Future<dynamic>.

Avoids a strong mode error in socket_patch.dart.

Change-Id: Icdda5c7880daf0241e36f1d35e61d171f1694409
Reviewed-on: https://dart-review.googlesource.com/29741
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-12-15 16:16:14 +00:00
Ryan Macnak 5554382135 Get a better stack trace from conversion errors in File.readAsString.
Bug: https://github.com/dart-lang/sdk/issues/31619
Change-Id: I79ae0337e35c8dd44aeff0613edaad620e82848e
Reviewed-on: https://dart-review.googlesource.com/29447
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2017-12-15 01:36:02 +00:00
Vijay Menon e0f5891850 Merge ddc type fixes to html_common
Change-Id: If8583c824989c9729ae2c29c718a514f24be0d2d
Reviewed-on: https://dart-review.googlesource.com/26840
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2017-12-14 22:04:05 +00:00
Terry Lucas bfea069823 Test possible keyevent fix.
Change-Id: I3f90979fad2681775cae56d499f3ff5968ea6485
Reviewed-on: https://dart-review.googlesource.com/29545
Commit-Queue: Terry Lucas <terry@google.com>
Reviewed-by: Terry Lucas <terry@google.com>
2017-12-14 21:22:39 +00:00
Terry Lucas 642b768e87 Fixed default parameter messagePorts for MessageEvent factory.
R=vsm@google.com

Change-Id: Ic94ccbe4c29302e44c58791658ce75dff86d9ac2
Reviewed-on: https://dart-review.googlesource.com/29544
Commit-Queue: Terry Lucas <terry@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2017-12-14 18:21:25 +00:00
Florian Loitsch 1a61b425d1 Reland BigInt class.
Moved `parseRadix` into a separate test where it doesn't do 10 iterations.
This reverts commit ab4061471b.

Change-Id: Ie48216c2f4f077dc86f915a54021c39706c432e8
Reviewed-on: https://dart-review.googlesource.com/29593
Reviewed-by: Florian Loitsch <floitsch@google.com>
Commit-Queue: Florian Loitsch <floitsch@google.com>
2017-12-14 15:44:15 +00:00
Florian Loitsch f3e845cf48 Revert "Reland: [dart:io] Adds waitForEventSync"
This reverts commit 3ea5e13ad7.

Change-Id: Ic9fae69f3b7ef6e41aac3c7ebca3e1d288dbffb1
Reviewed-on: https://dart-review.googlesource.com/29589
Reviewed-by: Florian Loitsch <floitsch@google.com>
2017-12-14 14:10:45 +00:00
pq ab4061471b Revert "Add BigInt class." [TBR].
This reverts commit f189bb57a4.

Bug:
Change-Id: I7b1cc4ab69adb5142ff7b5abd563d3bf7371ebb9
Reviewed-on: https://dart-review.googlesource.com/29442
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2017-12-13 21:12:02 +00:00
Florian Loitsch f189bb57a4 Add BigInt class.
Change-Id: I6e7fed3913cdb8e69ea15f0c69e060cccd91a356
Reviewed-on: https://dart-review.googlesource.com/9820
Commit-Queue: Florian Loitsch <floitsch@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2017-12-13 18:23:51 +00:00
Terry Lucas 529add3834 DDC fix to expose classes which are only created inside of the browser.
R=vsm@google.com

Change-Id: I27ede73ac84a72ee9b5e8b3b0a706ade82b2aa59
Reviewed-on: https://dart-review.googlesource.com/25500
Commit-Queue: Terry Lucas <terry@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2017-12-13 03:03:09 +00:00
Zachary Anderson 3ea5e13ad7 Reland: [dart:io] Adds waitForEventSync
The only fix needed for relanding is adding _ensureScheduleImmediate
to the list of vm entrypoints in //runtime/vm/compiler/aot/precompiler.cc

Original commit message:

Adds a top-level call waitForEventSync to dart:io that blocks the
thread an Isolate is running on until messages are available.
Before the thread blocks, the microtask queue is drained.
Before waitForEventSync returns, all messages are handled.

Lifting this up from a comment:

This is apropos of the request that nweiz@ sent to the mailing list a
couple weeks back. I'm not sure we should land this. We certainly
shouldn't land it without some annotations that will make the analyzer
complain a lot in most configurations, but I don't know what those
annotations are.

fixes #31102

Change-Id: Id96de46cc5f10e1847045cfafb7cfed6a38bce16
Reviewed-on: https://dart-review.googlesource.com/28920
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2017-12-12 23:16:50 +00:00
Natalie Weizenbaum acdd2adbdf Make sure that _StreamSinkImpl._isBound is kept up-to-date
There were two situations where this could get into a bad state:

* If the sink already had an error, _isBound would be set to true and
  never unset. This is fixed by not setting it at all if an error
  already exists.

* If _controllerCompleter completed to an error, _isBound would never
  get set back to false. This is fixed by refactoring the code so that
  the appropriate whenComplete() is always run.

Change-Id: Ia511fa3e2345213ff8e56dc4fae6f397b84257d1
Reviewed-on: https://dart-review.googlesource.com/26981
Commit-Queue: Natalie Weizenbaum <nweiz@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2017-12-12 22:41:29 +00:00
Zach Anderson 9d8e6453d2 Revert "[dart:io] Adds waitForEventSync"
This reverts commit 2aed87a133.

Reverting for failures on precompiled bots.

Change-Id: I758bfc72d8f5e67b0e5e12a7367a47f1df9364e2
Reviewed-on: https://dart-review.googlesource.com/28900
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2017-12-12 21:05:01 +00:00
Zachary Anderson 2aed87a133 [dart:io] Adds waitForEventSync
Adds a top-level call waitForEventSync to dart:io that blocks the
thread an Isolate is running on until messages are available.
Before the thread blocks, the microtask queue is drained.
Before waitForEventSync returns, all messages are handled.

Lifting this up from a comment:

This is apropos of the request that nweiz@ sent to the mailing list a
couple weeks back. I'm not sure we should land this. We certainly
shouldn't land it without some annotations that will make the analyzer
complain a lot in most configurations, but I don't know what those
annotations are.

Change-Id: If8286f4525994a162dd4f4563fefccb9d0984f7c
Reviewed-on: https://dart-review.googlesource.com/25281
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-12-12 19:12:58 +00:00
Bob Nystrom 650c9dcc8e Support extractTypeArguments() in 1.0 mode on the VM and dart2js.
Without strong mode, a "good enough" implementation is to simply call
the generic method with "dynamic" for the type arguments, which is what
this does. That should be enough to unblock our internal users.

We also need to not report a compile error when
dart_internal/extract_type_arguments.dart imports the hidden
"dart:_internal" library.

This patch does both of those for the VM and dart2js (using its old
front end).

Note that the test still fails because the test is more particular than
most actual user code would be -- it validates that the instantiated
type arguments are *exactly* correct, and not that the returned object
is merely subtype compatible.

Bug:
Change-Id: I0343beace4991861b29712b3fd7067ec8dc8f8ba
Reviewed-on: https://dart-review.googlesource.com/28020
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-12 19:04:18 +00:00
Vyacheslav Egorov 5a44162c97 [vm] Fix incorrect override in vmservice source
VMService.routeRequest of type Future Function(Message) overrides
MessageRouter.routeRequest of type Future<String> Function(Message).

It not enough to just fix VMService.routeRequest's return type because
Message.sendToVM() violates its type signature: it declares to
return Future<String> but in reality it returns Future<dynamic>
which can complete with either String or List. This CL addresses
this issue as well.

Bug:
Change-Id: I8240113d3e13d67c4e9a59db4250132a2077a4ec
Reviewed-on: https://dart-review.googlesource.com/26701
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2017-12-12 18:54:58 +00:00
Paul Berry ba2417fdc0 Fix SDK errors due to inconsistent inheritance of Operator==.
The informal spec for strong mode top level inference
(https://github.com/dart-lang/sdk/pull/28218) says "If there are
multiple overridden/implemented methods, and any two of them have
non-equal types (declared or inferred) for a parameter position which
is being inferred for the overriding method, it is an error."

This CL fixes several SDK errors that arise from this rule.  For
example, the classes _Closure, Function, and Object contained members
declared as follows:

    class _Closure implements Function {
      bool operator ==(other) ...
    }
    class Function {
      bool operator ==(Object other) ...
    }
    class Object {
      bool operator ==(other) ...
    }

The type of Object's operator == was (dynamic) -> bool; the type of
Function's operator == was (Object) -> bool; therefore the type of
_Closure's operator == (which overrides both, since _Closure extends
Object and implements Function) cannot be inferred and must be
specified.

A similar situation exists for _Double and _IntegerImplementation
(both implement num, which declares operator == to have type (Object)
-> bool), and _Uri (which implements Uri, which declares operator ==
to have type (Object) -> bool).

This CL fixes the error by specifying the type explicitly in the
classes _Closure, _Double, _IntegerImplementation, and _Uri.

Change-Id: I91f7ceef8549399d438ba4be8c408493b3f338db
Reviewed-on: https://dart-review.googlesource.com/28100
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-12-11 13:02:19 +00:00
Zachary Anderson 9344c79eff [dart:io] Allow the embedder to override Platform.localeName
We don't have a good place to pull this from on Android, but the
Flutter engine gets notifications when it is updated, etc., so don't
cache the value, and let the embedder supply a closure.

fixes #29211

Change-Id: I18e322fffb5212d9dbe154bc8628f817ba070237
Reviewed-on: https://dart-review.googlesource.com/27924
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2017-12-08 22:58:30 +00:00