Commit graph

9716 commits

Author SHA1 Message Date
Devon Carew 2a273a60ec [api docs] make dart:ffi doc samples analysis clean
Change-Id: I70caf6543f231905dd45b78816f2fc8a4e7f4ea3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216600
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2021-10-13 16:32:14 +00:00
Michael Thomsen 914f100be4 Clarify that all of dart:isolate is native only
Change-Id: I7ab2ba3db7828d152c9b3a521389a2e04b0c644f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216660
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2021-10-13 15:03:26 +00:00
Michael Thomsen 523a84d4cc Proof reading on Isolate.exit() docs
Change-Id: I62b8dc76afa2ebcd0be395bd77b33156978e0dd8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216291
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2021-10-12 18:19:40 +00:00
Lasse R.H. Nielsen 2dcc064916 Add range-check to DateTime.fromMillisecondsSinceEpoch on VM.
The current constructor allowed large numbers which overflows
when multiplied by 1000 to get microseconds, which then hid the
fact that the original value was out of range.

Now checks directly in the `fromMillisecondsSinceEpoch` constructor,
before multiplying by 1000.

Fixes #46966

BUG= http://dartbug.com/46966
TEST= Regression test added to date_time_test.dart

Change-Id: I4c6448666a49d51c285bd538e05e51a141b3b0b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214641
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-10-11 14:31:37 +00:00
Nate Bosch 393b97a69e Remove duplicated FileMode fixes
These were unnecessarily added twice when I finished out the rest of the
constant rename fixes, but had already been implemented as the proof of
concept for core library fixes.

Change-Id: I4c5bb018ad344ccb4c393c656fed47aae2df4d16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214066
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-10-11 13:58:43 +00:00
Nicholas Shahan 52c0a7bfd1 [ddc] Refactor _isFunctionSubtype
Move the method body out of one giant JS foreign function and into
Dart code with small JS foreign function calls inside.

* Removes the confusion around what it actually means when we use
  Dart String interpolation within the JS function template.
* Highlights the operations that actually need the JS foreign
  function.
* Allows for syntax highlighting and automatic formatting of this
  code.
* Allows for IDE "jump to definition" for class members that were
  previously inside the template.

These changes were developed by diffing the compiled output to
ensure the changes were as minimal and inconsequential as possible.
Intentional diffs include:
* Add local variables for `args1Length`, `args2Length`,
  `optionals1Length` and `optionals2Length`.

The only other diff was the loop variable incrementing:
`++i` -> `i = i + 1`

Change-Id: I92c6857580e0653578ceec4bd76a8e74231085cd
Issue: https://github.com/dart-lang/sdk/issues/46002
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215246
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2021-10-08 22:33:48 +00:00
Alexander Aprelev e270bbe95c [io/unix-domain-sockets] Ensure runtime-looked up entry points are marked as such.
This is needed to ensure that entry points looked from native code are preserved, not tree-shaken.

This is follow-up to https://dart.googlesource.com/sdk/+/935ee25f3b72e7fe81047220cadae1f61c505da4

Fixes https://github.com/dart-lang/sdk/issues/47416

TEST=unix_socket_test on dartkp bots

Change-Id: I5cf3071507947b1c24b2808e46dc92186e4b9476
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216062
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-10-08 20:22:28 +00:00
Alexander Aprelev 935ee25f3b [io/unix_domain_socket] Add support for sending/receiving open files, sockets, std streams via sockets.
This adds [sendMessage] and [receiveMessage] methods to [RawSocket] class. They are only supported on Linux at the moment as they require connection opened as unix domain socket connection.

This introduces [SocketControlMessage] class that represents a message sent via socket and also introduces [ResourceHandle] class that wraps [RandomAccessFile], [Socket]/[RawSocket]/[RawDatagramSocket], [Stdin]/[Stdout] for
marshalling/unmarshalling purposes.

Underlying OS implementation supports various kinds of control messages that can be passed via sockets, this CL only adds support for sending/receiving opened file description handles.
When receiving a message recipient can attempt to extract handles out of it via [tryExtractHandles]. It returns [null] if message has no handles to extract.

This is continuation of the work started on https://dart-review.googlesource.com/c/sdk/+/205067.

Bug: https://github.com/dart-lang/sdk/issues/46328
TEST=unix_socket_test

Change-Id: Ic9125b51dc80b677452e454366bae4118c298081
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212036
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2021-10-08 15:46:23 +00:00
Devon Carew a1e2432679 support specifying templates when verifying docs
Change-Id: I76800141e8bac1b0c3953ec6012ee84c192070ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215280
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2021-10-07 16:45:43 +00:00
Srujan Gaddam 7990144bad [pkg:js] Disable @staticInterop until ready
Erasure and subtyping need to be handled before we're ready to
expose static interop classes.

Change-Id: Idf939ef196845e4e068276c326d3bfbec54fdd38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215012
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-10-06 19:04:02 +00:00
Srujan Gaddam 67be663490 [pkg:js] Add @staticInterop annotation to package:js
Adds @staticInterop annotation to allow users to declare static interop
classes. Also adds errors for erroneous usage of static interop
classes, like including instance members or using a non-static
supertype.

Change-Id: I21abafbf6ea6c2eb7cd0425f0a54c1ba35d6ec6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215010
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-10-06 19:04:02 +00:00
WonYoung Choi 1951cce55a typo: thin -> this in lib/async/zone.dart
Fix typos in comments of Zone.bindUnaryCallback() and Zone.bindBinaryCallback()

Change-Id: I359bdd3623399fae163e57453b52e97039859392
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215700
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-10-06 15:08:48 +00:00
Devon Carew ff7c693221 Several fixes to the core lib docs.
Change-Id: I09156b3b70eec90007a5295fddb0828bd3015995
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215180
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-10-05 21:29:02 +00:00
Srujan Gaddam 017850fe5b [dart:html] setAttribute value should be Object
Bug: b/195948110

`setAttribute` stringifies any non-string value. `setAttributeNS` is
also similarly modified for consistency.

Change-Id: I883516f5ed2c977cdc591b697594817378607e53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215621
Reviewed-by: Gary Roumanis <grouma@google.com>
Commit-Queue: Gary Roumanis <grouma@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2021-10-05 20:08:41 +00:00
Brian Quinlan c3171cf26e Add some more documentation for Platform.localeName.
Change-Id: I0b08cea81f47b03fcdf82fa378c37e28889113c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215153
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2021-10-01 22:00:06 +00:00
Brian Quinlan 8e6f639a7e Add some extra documentation for Platform.operatingSystem
Change-Id: I8918fd7476be72c426d6009122e7c90a2d078bc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215144
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2021-09-30 22:58:44 +00:00
Riley Porter 1332c63a4c Revert "Add a generic return type for js_util functions"
This reverts commit 46486cf260.

Reason for revert: Causes dart analyzer and dart linter to find
issues within google3 and flutter, causing breakages and blocking
the roll.

Original change's description:
> Add a generic return type for js_util functions
>
> Allows further optimization to pass along return type
> information and remove extra AsExpression casts.
>
> Change-Id: I87aef171887e3f9af4c80003ff284eb2503d0cdb
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214460
> Reviewed-by: Srujan Gaddam <srujzs@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Riley Porter <rileyporter@google.com>

TBR=sigmund@google.com,srujzs@google.com,rileyporter@google.com

Change-Id: I6f4ff8f51f44d3e2eb1a140c93485ebe28189984
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215160
Reviewed-by: Riley Porter <rileyporter@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2021-09-30 22:52:12 +00:00
Alexander Aprelev 56403a0d35 [vm/sendandexit] Introduce Isolate.exit([port, message]).
This exits current isolate immediately. If [port] is provided, then [message] is verified and sent out as isolate exits.

TEST=ci
Fixes https://github.com/dart-lang/sdk/issues/47164

Change-Id: I513f4d7ceb5d74820f4aee60f5799b7b5193f2e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214312
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-09-30 20:20:24 +00:00
Riley Porter 46486cf260 Add a generic return type for js_util functions
Allows further optimization to pass along return type
information and remove extra AsExpression casts.

Change-Id: I87aef171887e3f9af4c80003ff284eb2503d0cdb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214460
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2021-09-30 17:13:49 +00:00
Devon Carew bafa71a8ae Add the ability to specify additional imports for doc samples.
Change-Id: I1c9592d4ce66d08aafacd5ae9722defa114c9953
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214867
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2021-09-30 16:35:59 +00:00
Stephen Adams c74dd07a4a Use interpolation in print and writeAll
Using interpolation ensures that a `null` returned from `o.toString()`
in a non-sound application is treated consistently.

The error message has been upgraded to include the receiver to make
it easier to find the method. Since this error values are reported using
`Error.safeToString`, this will be reported using the class name:

```
ArgumentError (object): toString method returned 'null': Instance of 'BadToString'
```

VM, DDC and dart2js runtimes are updated to make the handling consistent
on VM and web.

TEST=added

Change-Id: I48d8f721dfb3a431dbeacdaa39a9f3a8273e902c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214741
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-09-29 02:45:32 +00:00
Alexander Aprelev f5383bd08a [io/win] Ensure blank paths in file operations are handled gracefully.
Fixes https://github.com/dart-lang/sdk/issues/47287

TEST=standalone\io\file_error_test

Change-Id: I1a8de2da6ed87110bde21769fcae6faf39b65599
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214860
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-09-29 00:24:12 +00:00
Brian Quinlan ab453e64b0 Add some more details to the documentation for operatingSystemVersion
Change-Id: Ib3647e19feca8258dd654da690db2599e2195929
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214423
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-09-27 18:50:23 +00:00
Lasse R.H. Nielsen bdbd3c0602 Make unawaited accept a nullable argument.
The associated `unawaited_futures` lint triggers for expressions
of type `Future?` as well, so we should allow the workaround to
handle such expressions.

This change makes a static function more permissive, and is not expected
to be breaking in any way.
(It does mean that you need Dart 2.15.0 to use the function with
nullable arguments. I've changed the annotation to say `@Since("2.15")`.
That means anyone using a 2.15 SDK should assume that they need a 2.15
SDK to use it, and someone using a 2.14 SDK will not see the argument
as nullable. If anyone uses `@Since` annotations for anything at all.)

Change-Id: Ib2da4b353104cc88a834208a6ebd788ae55b4544
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214406
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-09-27 11:58:16 +00:00
Devon Carew 1d43ec2a99 Add an initial version of a script to validate the code samples in the dart: doc comments.
Change-Id: If74a11ffee8130963c37c9bd8ad74da4211f61d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214307
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-09-26 03:07:11 +00:00
Clement Skau 22652a3b49 [vm/ffi] Privatizes dart:nativewrappers' getNativeField(..)
TEST=Updated dart_api_impl_test.

Change-Id: Ib72667b2a20adc342f724a6eff7d326e2e106257
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214401
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-09-24 13:13:55 +00:00
Lasse R.H. Nielsen e4f12438a4 Add documentation on Future and Stream showing async programming.
The documentation on `Future` and `Stream` was only showing
the class API, not `async` programming.
Added examples of using `async`, `async*`, `await`, `await for`,
`yield` and `yield*`.

Fixes #47082

Bug: http://dartbug.com/47082
Change-Id: Ib8b4e8642412073e9e6124429d66747c277f89a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212470
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-09-24 13:07:40 +00:00
Lasse R.H. Nielsen 651d6e076b Add null-unsoundness check to print's object.toString() result.
This makes it an *earlier* error if a `toString` method returns `null`
when passed to `print`, possibly a new error if the underlying platform's
print implementation let `null` through.
Returning `null` is something `toString` was never supposed to do,
and with null safety, it's enforced by the type system,
so only pre-null-safety legacy code can actually return `null`.

Makes the error message from `NotNullableError` not assume a parameter,
so it can be used in more places.

Bug: https://github.com/dart-lang/sdk/issues/47196
Change-Id: I7f10156330994d31e44384fa952dd88385e2628d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214043
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-09-23 15:36:23 +00:00
Kevin Moore 4d82adb91f dart:html: use Object.hash
Drop custom hash class

Related to https://github.com/dart-lang/sdk/issues/27698

Change-Id: I7f5fb3a642e5ae461a00ed1b5d307adb4ef448df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214181
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-09-22 20:47:17 +00:00
Lasse R.H. Nielsen 18f37dd8f3 Add extension name getter on Enum.
We use an extension getter instead of an instance getter because
it doesn't conflict with any potential existing or future enums
which want an element named `name`.
Keeping the namespace for enum elements open is a priority.
We currently only reserve `index` and `values`.

BUG: https://github.com/dart-lang/language/issues/1511

Fixes language issue #1511, which is a long-standing request,
and should replace a number of alternative implementations
which are based on parsing the `toString()`.


This version has two fields on the shared superclass, the index
and private name, and has a separate `toString` for each `enum` class
which hard-codes that enum's class name.

An earlier version had both `"name"` and `"ClassName.name"` as fields
to be able to reuse the same `toString` method on all enum classes,
but that cost too much for JS compiled code.
Even having just `ClassName.` as a field and then combining inside
`toString` requires more code to create the enum instances.
Instead this version hardcodes the `ClassName.` string once
in the `toString` method, which means each enum class has its own
toString (which can *potentially* be tree-shaken then.)

This still tree-shakes slightly worse than the previous implementation
where every enum class had its own `index` and `_name` fields
independent of each other, which could then be tree-shaken independently.
However, the `index` was already made an interface member with the
addition of the `Enum` interface, so code which accesses `.index`
on something of the `Enum` supertype could prevent tree-shaking of
all enum classes' `index` fields.
Likewise any general access to the "name" of an enum would necessarily
do the same for the name.
This CL makes up for some of that by sharing more implementation
between enum classes.

DartVM AOT CodeSize impact: ~0.15% regression on gallery (little less on big g3 app)

TEST= New tests added to enum_test.dart

Change-Id: Id25334e6c987f470f558de3c141d0e3ff542b020
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210480
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-09-22 14:20:16 +00:00
Nate Bosch bcaa2a320c Add fixes for Remaining renames
Add fix definitions and tests for renamed class and top level constants in
`dart:developer` and `dart:io`.

Change-Id: I6851bd61c68fdcff461117fe8f2ab1c3890cb9df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214000
Auto-Submit: Nate Bosch <nbosch@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2021-09-21 16:07:30 +00:00
Nicholas Shahan 85a12eac55 [ddc] Fix missing type variable bounds subtype check
When testing the subtype relation between two generic function types,
uninstantiated type variables can appear as an argument or return type
of one function while a concrete type appears in corresponding
position of the other function. A subtype relation can be established
if the bound of the type variable is a subtype of the concrete type.
For example given a type variable T with bound B and a concrete type
C we can say:

T <: C when T <: B <: C holds.

T <: B is true by the definition of interface subtypes `T extends B`.
This change adds a test for B <: C.

Add a new class used only when it appears we may need to test these
subtype relations. The class is used to plumb the bound information
of type variables further into the subtype check algorithm where it
is now tested.

Add a top level variable to index the total number of type arguments
seen during a subtype check through nested function types.

Change-Id: If6aa13e7b758f7fedcb5dbd8e09d366082198e61
Fixes: https://github.com/dart-lang/sdk/issues/38816
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213527
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-09-20 23:29:45 +00:00
Nicholas Shahan e8cd9f0c44 [ddc] Refactor _isInterfaceSubtype
Move the method body out of one giant JS foreign function and into
Dart code with small JS foreign function calls inside.

* Removes the confusion around what it actually means when we use
  Dart String interpolation within the JS function template.
* Highlights the operations that actually need the JS foreign
  function.
* Allows for syntax highlighting and automatic formatting of this
  code.
* Allows for IDE "jump to definition" for class members that were
  previously inside the template.

These changes were developed by diffing the compiled output to
ensure the changes were as minimal and inconsequential as possible.
Intentional diffs include:
* Add a required message argument to `dart.assertFailed()`.
* Add local variables for `varianceType`, `typeArg1`, and
  `typeArg2`.

The only other diff was the loop variable incrementing:
`++i` -> `i = i + 1`

Change-Id: I76a1522fa4950f05748f905e1aec32c8b7dd4670
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213526
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2021-09-20 23:06:55 +00:00
Nicholas Shahan cf7d46097b [ddc] Refactor _isSubtype
Move the method body out of one giant JS foreign function and into
Dart code with small JS foreign function calls inside.

* Removes the confusion around what it actually means when we use
  Dart String interpolation within the JS function template.
* Highlights the operations that actually need the JS foreign
  function.
* Allows for syntax highlighting and automatic formatting of this
  code.
* Allows for IDE "jump to definition" for class members that were
  previously inside the template.

These changes were developed by diffing the compiled output to
ensure the changes were as minimal and inconsequential as possible.
The only diffs that appeared beyond the intentional addition of
the `t1Bound` and `t2Bound` local variables were:

* Using the top level variable for a type:
  `dart.nullable(core.Object)` -> `T$.ObjectN()`
* Loop variable incrementing:
  `i++` -> `i = i + 1`

Change-Id: I55fa3fa94b984c67b18a744837843d458231c4d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213525
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-09-20 21:28:29 +00:00
Ben Konyi dc58616486 [ Timeline ] Don't try to log async timeline events when Dart stream is
disabled

Related to https://github.com/flutter/flutter/issues/90061

Change-Id: Ic59cf60fe7d861109647be1a6c193fd4b63a211d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213780
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-09-17 18:49:21 +00:00
Sushant Chandla 2eb37e56ca Api Docs[core/int.dart]
The unsigned right shift was [implemented](https://github.com/dart-lang/language/issues/478#issuecomment-889181121)

Closes https://github.com/dart-lang/sdk/pull/47227
https://github.com/dart-lang/sdk/pull/47227

GitOrigin-RevId: ec84d6886204a05906c11b6b1ebab023b8b33e38
Change-Id: Iafc195c8df212c8f78330f6ebef230daa6a6d280
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213560
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2021-09-15 22:47:04 +00:00
rnewquist 2917c1cb8f [io/http] Add a HTTP Client parameter on WebSocket.connect to allow a custom HTTP Client for web socket connections.
The WebSocket abstract class was changed to allow an optional parameter called customClient that takes in a HTTPClient and passes it to the WebSocket Implementation.
The WebSocket implementation takes the customClient, checks if its null, if its not null, it uses the customClient in place of the static HTTPClient that the WebSocket Implementation offers.
This custom client does not override the static HTTPClient, so all previous functionality remains the same when the customClient is not present.

TEST=testStaticClientUserAgentStaysTheSame() in web_socket_test.dart in standalone_2/standalone
TEST=new SecurityConfiguration(secure: true).runTests(); in web_socket_error_test.dart and web_socket_test.dart in standalone_2/standalone

Bug: https://github.com/dart-lang/sdk/issues/34284

Closes https://github.com/dart-lang/sdk/pull/46040
https://github.com/dart-lang/sdk/pull/46040

GitOrigin-RevId: 58fed38baa606a8a492d3729190afa5009cc2409
Change-Id: I042b1e3fa7a4effed076c0deeec1f86af0dfe26d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200262
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-09-15 18:06:42 +00:00
Clement Skau cd7c9922eb [vm/ffi] Adds FFI transform for Handle -> Pointer.
This will automatically desugar FfiNative calls passing
NativeFieldWrapperClass1 handles to use Pointer when
the underlying native function expects a pointer.
E.g.:

```
class ClassWithNativeField extends NativeFieldWrapperClass1 {}

@FfiNative<IntPtr Function(Pointer<Void>)>('PassAsPointer')
external int passAsPointer(ClassWithNativeField obj);

passAsPointer(ClassWithNativeField());
// Becomes roughly:
// #t0 = PointerClassWithNativeField();
// passAsPointer(Pointer.fromAddress(getNativeField(#t0)));
// reachabilityFence(#t0);
```

TEST=Adds new tests in tests/ffi/ffi_native_test.dart.
Change-Id: I4460f9249803054f12be5d5ff34dbdf7c96567fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213260
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-09-15 12:47:35 +00:00
Riley Porter 0dd3c97147 Optimize js_util callConstructor for 0-4 arguments.
Some usages of `callConstructor` will have unnecessary checks
removed, when checks on the arguments can be elided. The
compilers will optimize further if they can.

Example optimizations: https://paste.googleplex.com/4594240957972480

Change-Id: I0e6e7e4d1268580cbfab84599b1c9da6fc64e7c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213114
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2021-09-13 22:43:10 +00:00
Mayank Patke a6c90f1601 [dart2js] Fix some unnecessary bailouts in inference.
Change-Id: If60fe11871da062c52265d821cbf0d7a1185e643
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209845
Reviewed-by: Stephen Adams <sra@google.com>
2021-09-13 21:59:20 +00:00
Stephen Adams 089bebcae7 Tweak Duration.toString to be more web-friendly
Change-Id: I588e089124d5c2fc62caa19cc2206c81666d6e8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213183
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-09-13 18:19:00 +00:00
Clement Skau 7d467e8933 [vm] Adds args_n to FFI resolver.
This makes it more closely mirror the Dart_NativeEntryResolver,
and acts as an extra sanity check that signatures (roughly)
align between the FfiNative decl. and the native function.

TEST=Updated runtime/vm/dart_api_impl_test.cc

Change-Id: I40799dc583ec14db14dc453afed4e2d1eb06fced
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212566
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-09-13 07:57:00 +00:00
Murtaza Raja 7c7f6623a9 typo: patter -> pattern in lib/core/pattern.dart
Closes https://github.com/dart-lang/sdk/pull/47198
https://github.com/dart-lang/sdk/pull/47198

GitOrigin-RevId: 647929b9ed24826261d37f60bd2180d79917e954
Change-Id: Ic857fffa8232e29f8ae5248bc7c4ce9264a090b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213220
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2021-09-12 18:23:08 +00:00
Lasse R.H. Nielsen 64f06ac544 Fix bug in Duration.toString().
The `toString` called `(-this).toString()` recursively
for negative durations.
If instantiated with the minimal integer on native,
that call would recurse infinitely.

The code has been wrong since we removed arbitrary precision integers.

TEST= Add test for regression case, otherwise covered by existing tests.

Change-Id: Ifb58bbc5aee38ef760f9352aede1694b79bae931
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212300
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-09-10 14:58:47 +00:00
Nate Bosch 828d1904e5 Rephrase bool getter doc
We want to avoid the "Returns" phrasing for getters.

Change-Id: Ia738c1566f720200a7b65a4ff441e1196129a6f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210286
Auto-Submit: Nate Bosch <nbosch@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-09-10 14:35:28 +00:00
Jens Johansen 48d8225b17 [VM] [CFE]: Expression compilation inside extension method
This CL handles expression compilation inside extension methods better.
It is now possible to evaluate "this" and other methods defined in the
extension.

https://github.com/dart-lang/sdk/issues/46757

TEST=service tests added.

Change-Id: I3c71eb23117e26b01961f32103f4046f0b537976
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212286
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-10 12:02:57 +00:00
Albert Mañosa 67ff459606 fix: typo in Object.hash equality operator docs
Fix doc comments regarding equality operators in the newly added `Object.hash` and `Object.hashAll` methods.

Closes https://github.com/dart-lang/sdk/pull/47167
https://github.com/dart-lang/sdk/pull/47167

GitOrigin-RevId: 4e168df4b4e4ad932e12d8a90f73d724d830a9e3
Change-Id: I4b3902cbece98ee31d977882196f0c8ffc210694
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212868
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2021-09-09 16:40:33 +00:00
Bruno Leroux ffe3ee691c Call _profileData.finishRequest after request finalisation
Bug : request headers were not captured because finishRequest was
called to early (before headers was fully initialised)
Fixes #47115

TEST=pkg/vm_service/test/get_http_profile_test.dart

Change-Id: I544101c6f37d20e2ddfe7086698c0925f8f5bd09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212561
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-09-09 14:16:21 +00:00
Lasse R.H. Nielsen 39a165647a Add compareByIndex helper function to Enum.
Fixes https://github.com/dart-lang/language/issues/1836

Bug: https://github.com/dart-lang/language/issues/1836
Change-Id: I43ef26403a379c795a0bdcdeb470b4818ffb721e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212573
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-09-09 12:02:15 +00:00
Srujan Gaddam f34eef5b91 [dart:html] Migrate python scripts to python 3
Migrates syntax and semantics from python 2.7.

Major changes include:

- filters
- sorting
- print statements
- higher-order functions
- hashing and comparison

and other misc changes. go.sh consistently gives the libraries
in this and the previous commits with these changes.

Change-Id: I66365739887158d8f321015d36e556447da1bcd3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211542
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
2021-09-08 22:10:53 +00:00