diff --git a/jerry-core/ecma/operations/ecma-iterator-object.c b/jerry-core/ecma/operations/ecma-iterator-object.c
index f3d7dda03..412cd7ca9 100644
--- a/jerry-core/ecma/operations/ecma-iterator-object.c
+++ b/jerry-core/ecma/operations/ecma-iterator-object.c
@@ -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))
diff --git a/tests/jerry/es.next/regression-test-issue-4097.js b/tests/jerry/es.next/regression-test-issue-4097.js
new file mode 100644
index 000000000..80241d36a
--- /dev/null
+++ b/tests/jerry/es.next/regression-test-issue-4097.js
@@ -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);
+}
diff --git a/tests/test262-esnext-excludelist.xml b/tests/test262-esnext-excludelist.xml
index 907c809ba..adc7509db 100644
--- a/tests/test262-esnext-excludelist.xml
+++ b/tests/test262-esnext-excludelist.xml
@@ -6773,7 +6773,6 @@
-