Fix yield* with undefined return method. (#4126)

Fixes #4097.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
This commit is contained in:
Dániel Bátyai
2020-08-11 14:01:18 +02:00
committed by GitHub
parent f761427a3e
commit 0c154306a8
3 changed files with 27 additions and 2 deletions
@@ -386,7 +386,7 @@ ecma_op_iterator_return (ecma_value_t iterator, /**< iterator value */
if (func_return == ECMA_VALUE_UNDEFINED)
{
return ecma_create_iter_result_object (value, true);
return ecma_create_iter_result_object (value, ECMA_VALUE_TRUE);
}
if (!ecma_is_value_object (func_return) || !ecma_op_is_callable (func_return))
@@ -0,0 +1,26 @@
// Copyright JS Foundation and other contributors, http://js.foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
function* g(a) {
yield* a;
return -3.14;
}
try {
var iter = g("foo" + "bar");
new WeakMap(iter);
assert(false);
} catch (e) {
assert(e instanceof TypeError);
}
-1
View File
@@ -6773,7 +6773,6 @@
<test id="language/expressions/template-literal/invalid-legacy-octal-escape-sequence.js"><reason></reason></test>
<test id="language/expressions/typeof/proxy.js"><reason></reason></test>
<test id="language/expressions/yield/star-return-is-null.js"><reason></reason></test>
<test id="language/expressions/yield/star-rhs-iter-rtrn-no-rtrn.js"><reason></reason></test>
<test id="language/expressions/yield/star-throw-is-null.js"><reason></reason></test>
<test id="language/global-code/decl-lex-configurable-global.js"><reason></reason></test>
<test id="language/global-code/export.js"><reason></reason></test>