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>
This adds a third reference to Field declaration, so that we know have
three references, one for each use case:
1) fieldReference used for initialization; in FieldInitializer and as
the key in the InstanceConstant.fieldValues map.
2) getterReference used for reading; in InstanceGet, StaticGet and
SuperPropertyGet
3) setterReference used for writing; in InstanceSet, StaticSet and
SuperPropertySet
TEST=existing
Change-Id: I223f130e808e7f19a831c1fe5e3a4725d1bcdc3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203770
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
This change moves tests out of the older-style test file. In addition:
* additional tests for uninstantiated function tearoff identity.
* additional tests for using a type parameter as a type argument in a
function tearoff in a const expression.
Change-Id: I6c6a6db13144e02794a62d78337013b4a525549a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214139
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Removing usage of the foreign JS function from the js_util
CFE optimizations. Keeps foreign JS calls only injected by
the compilers. There will be no change in generated JavaScript
for dart2js, it was already inlining getProperty calls. There
will be a small change for generated JavaScript for ddc, but
we will work on adding a simple ddc inliner to account for it.
Change-Id: Iadcc81a6798a8af397205bf6bb89d0bfbd095432
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214306
Commit-Queue: Riley Porter <rileyporter@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Swap to finding the mapping of Procedure to ExtensionMemberDescriptor
data, instead of using the front_end desugar api for extension
member kind, name, and isStatic information.
Change-Id: I4bca55e8f1d3044def420060ddecc75600452a11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214305
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
The AOT runtime is not supported on IA32, so generating snapshots and
executables requiring the AOT runtime is not possible on IA32.
Fixes https://github.com/dart-lang/sdk/issues/47177
TEST=pkg/dartdev/test/commands/compile_test.dart
Change-Id: I99e9a16f6a93b3b63b8ed15acc1472f9ca619c08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213680
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Bug: VM service `addBreakpointWithScriptUri` and `addBreakpoint` don't add valid breakpoints for code in `dart:` libraries. See #47204
This PR contains :
- a new test : 'service/break_on_dart_colon_test.dart', that checks several URIs to register breakpoints in `dart:` libs.
- a fix in `Debugger::SetBreakpointAtLineCol` to make it calls `Library::LookupScript'` with the right value for `useResolvedUri` parameter.
Fixes https://github.com/dart-lang/sdk/issues/47204
TEST=runtime/observatory/tests/service/break_on_dart_colon_test.dart
Change-Id: Id3d6722c278e3238202a9d84a0d34612b957035c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213766
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
I hoped to get hints on why we get out of sync with the number
of classes, getters, etc in the AST and the element model. Unfortunately
it don't not help, we might have a unit without any variables, the
corresponding code, but AST has variables.
So, this code does not help, and I want to remove it.
It was also used for Move File refactoring, we would need some different
solution later. For now I revert to the state it was not long ago.
Change-Id: If7468aac33ce000f85e94f96bfa2d2966892e560
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214341
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Change-Id: I2c3d97b5b999e03682e60a6a62947257f597c182
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214308
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This paves the way for code generation of the `TodoCode` class.
Change-Id: I25e113f90194f3f7ac5ab0ae2a17b9836e56b835
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214302
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
I maintain the choice to _not_ rewrite a PrefixedIdentifier to a
ConstructorReference in the case that it is the left side of an
AssignmentExpression, because doing so requires extra additional
checking during assignment verification, and probably a new error code
saying a constructor cannot be assigned to, similar to the error code
saying that a method cannot be assigned to. This is all feasible, but
I think it is very reasonable, in AstRewrite, to say, "This prefixed
identifier does seem to refer to a constructor, but it's the left
side of an assignment, so I'm not going to confidently do a rewrite;
instead I will leave this alone and let the assignment verification
code handle it."
Bug: b/200948019
Change-Id: I90c6a157c2992d4935acfb593f38518f0388bced
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214320
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
When checking if type parameters are equivalent for subtyping,
check both base and index of the type parameter to avoid matching
type parameters from different levels. For example, consider
the following function types:
void Function<S>(S val) Function<T>(T val)
void Function<S>(T val) Function<T>(T val)
Also, when instantiating a signature of a closure, correct
base/index of type parameters even if they are not instantiated.
TEST=language/function_subtype/nested_function_type_test
TEST=language/closure/nested_generic_closure_test
Fixes https://github.com/dart-lang/sdk/issues/47265
Change-Id: I6f75a4ee70435f42afeb772e7ecc680ab75a7520
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214136
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
* Add dart-lang/co19 in front of #123 issue references.
* Update the co19_2 script to match the co19 script.
* Track main from the roll branches.
* Add a comment between the two co19 hashes to prevent merge conflicts.
Fixes: b/200911019
Change-Id: I2806ac7e9cd5ff3d24cac0e50a1d094163b35d7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214046
Reviewed-by: William Hesse <whesse@google.com>
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>
This CL enables the avoid_void_async lint in the CFE, makes the needed
changes and adds the missing `await` (because the lint
`unawaited_futures` doesn't react to void async methods).
Change-Id: Iffc1f173badd3c2d48356ee02e81a9aed492ce5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213481
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This is a reland of fb36bba5f2 with
a fix to the ordering to ensure all the expectations run.
Original change's description:
> [ddc] Add web library environment variables
>
> Ensure frontend server builds for the `DevCompilerTarget` add the
> environment variables needed for `bool.fromEnvironment()` calls for
> conditional imports.
>
> Change-Id: Ifd372c1cf385fc843534d85af1ac9ae75a6285b8
> Fixes: https://github.com/dart-lang/sdk/issues/47207
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213802
> Commit-Queue: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
Change-Id: Id88aeaf0ddc783936d413c06099df031bc7cb0a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214224
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Previously, we had an inconsistent convention for whether the class
name should be included when supplying an optional `uniqueName`
parameter to an error constructor. (Some error class constructors
added it automatically, others didn't). And we didn't always follow
the convention properly, so some errors were missing the class name
from their `uniqueName` property.
This change adopts the consistent convention that we never include the
class name when supplying an optional `uniquename` parameter to an
error constructor; it is always added in automatically by the
constructor.
Change-Id: Iff7a213b9fe05b1539c22bdbf935c6e54d49f3e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214060
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Please see https://github.com/dart-lang/sdk/issues/47264
The Flutter team would like to turn this on in product mode for being
able to systrace release applications.
This change could have potential size and performance regressions and
will be monitored as it rolls into Flutter. If the impact is not within
acceptable ranges it can be rolled back.
TEST=ci
Change-Id: Iad6f9b831eaf60d15f03e368702fb25bc9ebc76c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214241
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Dan Field <dnfield@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
This reverts commit fb36bba5f2.
Reason for revert: New test fails on windows configurations.
Original change's description:
> [ddc] Add web library environment variables
>
> Ensure frontend server builds for the `DevCompilerTarget` add the
> environment variables needed for `bool.fromEnvironment()` calls for
> conditional imports.
>
> Change-Id: Ifd372c1cf385fc843534d85af1ac9ae75a6285b8
> Fixes: https://github.com/dart-lang/sdk/issues/47207
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213802
> Commit-Queue: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
TBR=johnniwinther@google.com,nshahan@google.com,annagrin@google.com
Change-Id: Iedfc4c1a5b24b515646d4f1b486bcb2f19bb7783
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214222
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Ensure frontend server builds for the `DevCompilerTarget` add the
environment variables needed for `bool.fromEnvironment()` calls for
conditional imports.
Change-Id: Ifd372c1cf385fc843534d85af1ac9ae75a6285b8
Fixes: https://github.com/dart-lang/sdk/issues/47207
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213802
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
CFE transformation to add a function body for external
extension methods. Routes to `js_util.callMethod` with the
arguments in a ListLiteral to then be further optimized to
the `callMethodUnchecked` version if possible.
Change-Id: Iccdda7b8c16c19b37e20b7cbceb8c32498e64d3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213721
Commit-Queue: Riley Porter <rileyporter@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Saw it failing in the crash log.
Change-Id: I6cf715aeb6f41e405af58a00b69b8742fd7c5ed0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214182
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
When we lower an uninitialized static field to a cell, we gives the cell
a mangled name and create a getter/setter pair with the original field
name. The getter/setter simply call the appropriate members on the cell.
This means that other libraries, even ones that haven't been transformed
(e.g. during modular compilation) will still interoperate correctly,
since the transformed library still has the same external signature.
Change-Id: I88edcb71fa5cb910869b4266628a029ad358b77e
Fixes: https://github.com/dart-lang/sdk/issues/45854
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214064
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>