Commit 8fa85efd authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

[esnext] Remove always-disabled support for function.sent

This proposal has not moved beyoned stage 2 in two years, and has never
moved past the HARMONY_INPROGRESS state in flag-definitions.h.

It was originally added to aide in desugaring yield*, but is no longer
used for that purpose.

Bug: v8:4700, v8:7310
Change-Id: Ieca40d8e4bf565516bbe71e47b996daa70d2e835
Reviewed-on: https://chromium-review.googlesource.com/935297
Commit-Queue: Adam Klein <adamk@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51582}
parent 3669c00e
...@@ -4204,7 +4204,6 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate, ...@@ -4204,7 +4204,6 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_tostring) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_tostring)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_public_fields) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_public_fields)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_private_fields) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_private_fields)
......
...@@ -210,7 +210,6 @@ DEFINE_IMPLICATION(harmony_class_fields, harmony_private_fields) ...@@ -210,7 +210,6 @@ DEFINE_IMPLICATION(harmony_class_fields, harmony_private_fields)
// Features that are still work in progress (behind individual flags). // Features that are still work in progress (behind individual flags).
#define HARMONY_INPROGRESS(V) \ #define HARMONY_INPROGRESS(V) \
V(harmony_array_prototype_values, "harmony Array.prototype.values") \ V(harmony_array_prototype_values, "harmony Array.prototype.values") \
V(harmony_function_sent, "harmony function.sent") \
V(harmony_do_expressions, "harmony do-expressions") \ V(harmony_do_expressions, "harmony do-expressions") \
V(harmony_class_fields, "harmony fields in class literals") \ V(harmony_class_fields, "harmony fields in class literals") \
V(harmony_static_fields, "harmony static fields in class literals") \ V(harmony_static_fields, "harmony static fields in class literals") \
......
...@@ -689,8 +689,6 @@ class ErrorUtils : public AllStatic { ...@@ -689,8 +689,6 @@ class ErrorUtils : public AllStatic {
T(TypedArrayTooShort, \ T(TypedArrayTooShort, \
"Derived TypedArray constructor created an array which was too small") \ "Derived TypedArray constructor created an array which was too small") \
T(UnexpectedEOS, "Unexpected end of input") \ T(UnexpectedEOS, "Unexpected end of input") \
T(UnexpectedFunctionSent, \
"function.sent expression is not allowed outside a generator") \
T(UnexpectedReserved, "Unexpected reserved word") \ T(UnexpectedReserved, "Unexpected reserved word") \
T(UnexpectedStrictReserved, "Unexpected strict mode reserved word") \ T(UnexpectedStrictReserved, "Unexpected strict mode reserved word") \
T(UnexpectedSuper, "'super' keyword unexpected here") \ T(UnexpectedSuper, "'super' keyword unexpected here") \
......
...@@ -278,7 +278,6 @@ class ParserBase { ...@@ -278,7 +278,6 @@ class ParserBase {
script_id_(script_id), script_id_(script_id),
allow_natives_(false), allow_natives_(false),
allow_harmony_do_expressions_(false), allow_harmony_do_expressions_(false),
allow_harmony_function_sent_(false),
allow_harmony_public_fields_(false), allow_harmony_public_fields_(false),
allow_harmony_static_fields_(false), allow_harmony_static_fields_(false),
allow_harmony_dynamic_import_(false), allow_harmony_dynamic_import_(false),
...@@ -293,7 +292,6 @@ class ParserBase { ...@@ -293,7 +292,6 @@ class ParserBase {
ALLOW_ACCESSORS(natives); ALLOW_ACCESSORS(natives);
ALLOW_ACCESSORS(harmony_do_expressions); ALLOW_ACCESSORS(harmony_do_expressions);
ALLOW_ACCESSORS(harmony_function_sent);
ALLOW_ACCESSORS(harmony_public_fields); ALLOW_ACCESSORS(harmony_public_fields);
ALLOW_ACCESSORS(harmony_static_fields); ALLOW_ACCESSORS(harmony_static_fields);
ALLOW_ACCESSORS(harmony_dynamic_import); ALLOW_ACCESSORS(harmony_dynamic_import);
...@@ -1553,7 +1551,6 @@ class ParserBase { ...@@ -1553,7 +1551,6 @@ class ParserBase {
bool allow_natives_; bool allow_natives_;
bool allow_harmony_do_expressions_; bool allow_harmony_do_expressions_;
bool allow_harmony_function_sent_;
bool allow_harmony_public_fields_; bool allow_harmony_public_fields_;
bool allow_harmony_static_fields_; bool allow_harmony_static_fields_;
bool allow_harmony_dynamic_import_; bool allow_harmony_dynamic_import_;
...@@ -3561,22 +3558,6 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseMemberExpression( ...@@ -3561,22 +3558,6 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseMemberExpression(
Consume(Token::FUNCTION); Consume(Token::FUNCTION);
int function_token_position = position(); int function_token_position = position();
if (allow_harmony_function_sent() && peek() == Token::PERIOD) {
// function.sent
int pos = position();
ExpectMetaProperty(Token::SENT, "function.sent", pos, CHECK_OK);
if (!is_generator()) {
// TODO(neis): allow escaping into closures?
impl()->ReportMessageAt(scanner()->location(),
MessageTemplate::kUnexpectedFunctionSent);
*ok = false;
return impl()->NullExpression();
}
return impl()->FunctionSentExpression(pos);
}
FunctionKind function_kind = Check(Token::MUL) FunctionKind function_kind = Check(Token::MUL)
? FunctionKind::kGeneratorFunction ? FunctionKind::kGeneratorFunction
: FunctionKind::kNormalFunction; : FunctionKind::kNormalFunction;
......
...@@ -318,16 +318,6 @@ Expression* Parser::NewTargetExpression(int pos) { ...@@ -318,16 +318,6 @@ Expression* Parser::NewTargetExpression(int pos) {
return proxy; return proxy;
} }
Expression* Parser::FunctionSentExpression(int pos) {
// We desugar function.sent into %_GeneratorGetInputOrDebugPos(generator).
ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(1, zone());
VariableProxy* generator = factory()->NewVariableProxy(
function_state_->scope()->generator_object_var());
args->Add(generator, zone());
return factory()->NewCallRuntime(Runtime::kInlineGeneratorGetInputOrDebugPos,
args, pos);
}
Expression* Parser::ImportMetaExpression(int pos) { Expression* Parser::ImportMetaExpression(int pos) {
return factory()->NewCallRuntime( return factory()->NewCallRuntime(
Runtime::kInlineGetImportMetaObject, Runtime::kInlineGetImportMetaObject,
...@@ -453,7 +443,6 @@ Parser::Parser(ParseInfo* info) ...@@ -453,7 +443,6 @@ Parser::Parser(ParseInfo* info)
info->extension() == nullptr && can_compile_lazily; info->extension() == nullptr && can_compile_lazily;
set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); set_allow_natives(FLAG_allow_natives_syntax || info->is_native());
set_allow_harmony_do_expressions(FLAG_harmony_do_expressions); set_allow_harmony_do_expressions(FLAG_harmony_do_expressions);
set_allow_harmony_function_sent(FLAG_harmony_function_sent);
set_allow_harmony_public_fields(FLAG_harmony_public_fields); set_allow_harmony_public_fields(FLAG_harmony_public_fields);
set_allow_harmony_static_fields(FLAG_harmony_static_fields); set_allow_harmony_static_fields(FLAG_harmony_static_fields);
set_allow_harmony_dynamic_import(FLAG_harmony_dynamic_import); set_allow_harmony_dynamic_import(FLAG_harmony_dynamic_import);
......
...@@ -242,7 +242,6 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { ...@@ -242,7 +242,6 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
#define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name()); #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name());
SET_ALLOW(natives); SET_ALLOW(natives);
SET_ALLOW(harmony_do_expressions); SET_ALLOW(harmony_do_expressions);
SET_ALLOW(harmony_function_sent);
SET_ALLOW(harmony_public_fields); SET_ALLOW(harmony_public_fields);
SET_ALLOW(harmony_static_fields); SET_ALLOW(harmony_static_fields);
SET_ALLOW(harmony_dynamic_import); SET_ALLOW(harmony_dynamic_import);
...@@ -829,7 +828,6 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { ...@@ -829,7 +828,6 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
Expression* NewSuperPropertyReference(int pos); Expression* NewSuperPropertyReference(int pos);
Expression* NewSuperCallReference(int pos); Expression* NewSuperCallReference(int pos);
Expression* NewTargetExpression(int pos); Expression* NewTargetExpression(int pos);
Expression* FunctionSentExpression(int pos);
Expression* ImportMetaExpression(int pos); Expression* ImportMetaExpression(int pos);
Literal* ExpressionFromLiteral(Token::Value token, int pos); Literal* ExpressionFromLiteral(Token::Value token, int pos);
......
...@@ -1590,10 +1590,6 @@ class PreParser : public ParserBase<PreParser> { ...@@ -1590,10 +1590,6 @@ class PreParser : public ParserBase<PreParser> {
return PreParserExpression::NewTargetExpression(); return PreParserExpression::NewTargetExpression();
} }
V8_INLINE PreParserExpression FunctionSentExpression(int pos) {
return PreParserExpression::Default();
}
V8_INLINE PreParserExpression ImportMetaExpression(int pos) { V8_INLINE PreParserExpression ImportMetaExpression(int pos) {
return PreParserExpression::Default(); return PreParserExpression::Default();
} }
......
...@@ -1508,7 +1508,6 @@ uc32 Scanner::ScanUnicodeEscape() { ...@@ -1508,7 +1508,6 @@ uc32 Scanner::ScanUnicodeEscape() {
KEYWORD_GROUP('r') \ KEYWORD_GROUP('r') \
KEYWORD("return", Token::RETURN) \ KEYWORD("return", Token::RETURN) \
KEYWORD_GROUP('s') \ KEYWORD_GROUP('s') \
KEYWORD("sent", Token::SENT) \
KEYWORD("set", Token::SET) \ KEYWORD("set", Token::SET) \
KEYWORD("static", Token::STATIC) \ KEYWORD("static", Token::STATIC) \
KEYWORD("super", Token::SUPER) \ KEYWORD("super", Token::SUPER) \
......
...@@ -188,7 +188,6 @@ namespace internal { ...@@ -188,7 +188,6 @@ namespace internal {
C(SET, "set", 0) \ C(SET, "set", 0) \
C(OF, "of", 0) \ C(OF, "of", 0) \
C(TARGET, "target", 0) \ C(TARGET, "target", 0) \
C(SENT, "sent", 0) \
C(META, "meta", 0) \ C(META, "meta", 0) \
C(AS, "as", 0) \ C(AS, "as", 0) \
C(FROM, "from", 0) \ C(FROM, "from", 0) \
......
...@@ -1115,7 +1115,6 @@ const char* ReadString(unsigned* start) { ...@@ -1115,7 +1115,6 @@ const char* ReadString(unsigned* start) {
enum ParserFlag { enum ParserFlag {
kAllowLazy, kAllowLazy,
kAllowNatives, kAllowNatives,
kAllowHarmonyFunctionSent,
kAllowHarmonyPublicFields, kAllowHarmonyPublicFields,
kAllowHarmonyPrivateFields, kAllowHarmonyPrivateFields,
kAllowHarmonyStaticFields, kAllowHarmonyStaticFields,
...@@ -1133,7 +1132,6 @@ enum ParserSyncTestResult { ...@@ -1133,7 +1132,6 @@ enum ParserSyncTestResult {
void SetGlobalFlags(i::EnumSet<ParserFlag> flags) { void SetGlobalFlags(i::EnumSet<ParserFlag> flags) {
i::FLAG_allow_natives_syntax = flags.Contains(kAllowNatives); i::FLAG_allow_natives_syntax = flags.Contains(kAllowNatives);
i::FLAG_harmony_function_sent = flags.Contains(kAllowHarmonyFunctionSent);
i::FLAG_harmony_public_fields = flags.Contains(kAllowHarmonyPublicFields); i::FLAG_harmony_public_fields = flags.Contains(kAllowHarmonyPublicFields);
i::FLAG_harmony_private_fields = flags.Contains(kAllowHarmonyPrivateFields); i::FLAG_harmony_private_fields = flags.Contains(kAllowHarmonyPrivateFields);
i::FLAG_harmony_static_fields = flags.Contains(kAllowHarmonyStaticFields); i::FLAG_harmony_static_fields = flags.Contains(kAllowHarmonyStaticFields);
...@@ -1146,8 +1144,6 @@ void SetGlobalFlags(i::EnumSet<ParserFlag> flags) { ...@@ -1146,8 +1144,6 @@ void SetGlobalFlags(i::EnumSet<ParserFlag> flags) {
void SetParserFlags(i::PreParser* parser, i::EnumSet<ParserFlag> flags) { void SetParserFlags(i::PreParser* parser, i::EnumSet<ParserFlag> flags) {
parser->set_allow_natives(flags.Contains(kAllowNatives)); parser->set_allow_natives(flags.Contains(kAllowNatives));
parser->set_allow_harmony_function_sent(
flags.Contains(kAllowHarmonyFunctionSent));
parser->set_allow_harmony_public_fields( parser->set_allow_harmony_public_fields(
flags.Contains(kAllowHarmonyPublicFields)); flags.Contains(kAllowHarmonyPublicFields));
parser->set_allow_harmony_private_fields( parser->set_allow_harmony_private_fields(
...@@ -8443,26 +8439,6 @@ TEST(EscapeSequenceErrors) { ...@@ -8443,26 +8439,6 @@ TEST(EscapeSequenceErrors) {
RunParserSyncTest(context_data, error_data, kError); RunParserSyncTest(context_data, error_data, kError);
} }
TEST(FunctionSentErrors) {
// clang-format off
const char* context_data[][2] = {
{ "'use strict'", "" },
{ "", "" },
{ nullptr, nullptr }
};
const char* error_data[] = {
"var x = function.sent",
"function* g() { yield function.s\\u0065nt; }",
nullptr
};
// clang-format on
static const ParserFlag always_flags[] = {kAllowHarmonyFunctionSent};
RunParserSyncTest(context_data, error_data, kError, always_flags,
arraysize(always_flags));
}
TEST(NewTargetErrors) { TEST(NewTargetErrors) {
// clang-format off // clang-format off
const char* context_data[][2] = { const char* context_data[][2] = {
......
...@@ -67,7 +67,7 @@ function Loop() { ...@@ -67,7 +67,7 @@ function Loop() {
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function* multiples(x) { function* multiples(x) {
let skip = function.sent || 0; let skip = 2;
let next = 0; let next = 0;
while (true) { while (true) {
if (skip === 0) { if (skip === 0) {
......
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
"path": ["Generators"], "path": ["Generators"],
"main": "run.js", "main": "run.js",
"resources": ["generators.js"], "resources": ["generators.js"],
"flags": ["--harmony-function-sent"],
"results_regexp": "^Generators\\-Generators\\(Score\\): (.+)$" "results_regexp": "^Generators\\-Generators\\(Score\\): (.+)$"
}, },
{ {
......
// Copyright 2016 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-function-sent
function* f() {
return function.s\u0065nt;
}
for (var i of f()) print(i);
*%(basename)s:8: SyntaxError: 'function.sent' must not contain escaped characters
return function.s\u0065nt;
^^^^^^^^^^^^^^^^^^
SyntaxError: 'function.sent' must not contain escaped characters
// Copyright 2016 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-function-sent
{
function* g() { return function.sent }
assertEquals({value: 42, done: true}, g().next(42));
}
{
function* g() {
try {
yield function.sent;
} finally {
yield function.sent;
return function.sent;
}
}
{
let x = g();
assertEquals({value: 1, done: false}, x.next(1));
assertEquals({value: 2, done: false}, x.next(2));
assertEquals({value: 3, done: true}, x.next(3));
}
{
let x = g();
assertEquals({value: 1, done: false}, x.next(1));
assertEquals({value: 2, done: false}, x.throw(2));
assertEquals({value: 3, done: true}, x.next(3));
}
{
let x = g();
assertEquals({value: 1, done: false}, x.next(1));
assertEquals({value: 2, done: false}, x.return(2));
assertEquals({value: 3, done: true}, x.next(3));
}
}
{
function* inner() {
try {
yield function.sent;
} finally {
return 23;
}
}
function* g() {
yield function.sent;
yield* inner();
return function.sent;
}
{
let x = g();
assertEquals({value: 1, done: false}, x.next(1));
assertEquals({value: undefined, done: false}, x.next(2));
assertEquals({value: 3, done: true}, x.next(3));
}
{
let x = g();
assertEquals({value: 1, done: false}, x.next(1));
assertEquals({value: undefined, done: false}, x.next(2));
assertEquals({value: 42, done: true}, x.throw(42));
}
{
let x = g();
assertEquals({value: 1, done: false}, x.next(1));
assertEquals({value: undefined, done: false}, x.next(2));
assertEquals({value: 23, done: true}, x.return(42));
}
}
assertThrows("function f() { return function.sent }", SyntaxError);
assertThrows("() => { return function.sent }", SyntaxError);
assertThrows("() => { function.sent }", SyntaxError);
assertThrows("() => function.sent", SyntaxError);
assertThrows("({*f() { function.sent }})", SyntaxError);
assertDoesNotThrow("({*f() { return function.sent }})");
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