Commit 49808422 authored by caitp's avatar caitp Committed by Commit bot

[async-iteration] expose Symbol.asyncIterator behind flag --harmony-async-iteration

Flag is used by followup patches split apart from
https://codereview.chromium.org/2622833002/, and tests for each split
out CL ends up using Symbol.asyncIterator, so it makes sense to land it
first (behind a flag).

BUG=v8:5855
R=littledan@chromium.org, adamk@chromium.org

Review-Url: https://codereview.chromium.org/2645923003
Cr-Commit-Position: refs/heads/master@{#42527}
parent 5587c476
......@@ -3592,6 +3592,13 @@ void Genesis::InitializeGlobal_harmony_array_prototype_values() {
NONE);
}
void Genesis::InitializeGlobal_harmony_async_iteration() {
if (!FLAG_harmony_async_iteration) return;
Handle<JSFunction> symbol_fun(native_context()->symbol_function());
InstallConstant(isolate(), symbol_fun, "asyncIterator",
factory()->async_iterator_symbol());
}
Handle<JSFunction> Genesis::InstallArrayBuffer(Handle<JSObject> target,
const char* name,
Builtins::Name call,
......@@ -4057,6 +4064,7 @@ bool Genesis::InstallExperimentalNatives() {
static const char* harmony_trailing_commas_natives[] = {nullptr};
static const char* harmony_class_fields_natives[] = {nullptr};
static const char* harmony_object_rest_spread_natives[] = {nullptr};
static const char* harmony_async_iteration_natives[] = {nullptr};
for (int i = ExperimentalNatives::GetDebuggerCount();
i < ExperimentalNatives::GetBuiltinsCount(); i++) {
......
......@@ -202,7 +202,8 @@ DEFINE_IMPLICATION(es_staging, move_object_start)
V(harmony_regexp_named_captures, "harmony regexp named captures") \
V(harmony_regexp_property, "harmony unicode regexp property classes") \
V(harmony_class_fields, "harmony public fields in class literals") \
V(harmony_object_rest_spread, "harmony object rest spread properties")
V(harmony_object_rest_spread, "harmony object rest spread properties") \
V(harmony_async_iteration, "harmony async iteration")
// Features that are complete (but still behind --harmony/es-staging flag).
#define HARMONY_STAGED(V) \
......
......@@ -243,6 +243,7 @@
V(uninitialized_symbol)
#define PUBLIC_SYMBOL_LIST(V) \
V(async_iterator_symbol, Symbol.asyncIterator) \
V(iterator_symbol, Symbol.iterator) \
V(intl_fallback_symbol, IntlFallback) \
V(match_symbol, Symbol.match) \
......
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-async-iteration
assertTrue(Symbol.hasOwnProperty('asyncIterator'));
assertEquals('symbol', typeof Symbol.asyncIterator);
assertInstanceof(Object(Symbol.asyncIterator), Symbol);
let desc = Object.getOwnPropertyDescriptor(Symbol, 'asyncIterator');
assertFalse(desc.writable);
assertFalse(desc.enumerable);
assertFalse(desc.configurable);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment