Skip to content

Commit 94498fa

Browse files
committed
Temporarily disable class Array/%TypedArray%.prototype.{slice, map, concat, filter, splice} related tests
This patch temporarily fixes #2587. The reason of disabling these tests is that the current implementation slightly differs from the related part of the standard (ECMA-262 v6, 9.4.2.3.6.d.1). This part requires the hidden Symbol.@@species property, hence this functionality has not been implemented yet in the project. Also add the related test case to prevent further errors. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
1 parent 1fc369e commit 94498fa

File tree

4 files changed

+28
-34
lines changed

4 files changed

+28
-34
lines changed

jerry-core/ecma/operations/ecma-array-object.c

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -154,41 +154,12 @@ ecma_op_create_array_object_by_constructor (const ecma_value_t *arguments_list_p
154154
ecma_object_t *object_p) /**< The object from whom the new array object
155155
* is being created */
156156
{
157-
ecma_value_t constructor_value = ecma_op_object_get_by_magic_id (object_p, LIT_MAGIC_STRING_CONSTRUCTOR);
157+
/* TODO: Use @@species after Symbol has been implemented */
158+
JERRY_UNUSED (object_p);
158159

159-
if (ECMA_IS_VALUE_ERROR (constructor_value)
160-
|| !ecma_is_value_object (constructor_value)
161-
|| !ecma_is_constructor (constructor_value))
162-
{
163-
ecma_free_value (constructor_value);
164-
return ecma_raise_type_error (ECMA_ERR_MSG ("object.constructor is not a constructor."));
165-
}
166-
167-
ecma_object_t *constructor_object_p = ecma_get_object_from_value (constructor_value);
168-
ecma_value_t constructor_prototype = ecma_op_object_get_by_magic_id (constructor_object_p,
169-
LIT_MAGIC_STRING_PROTOTYPE);
170-
171-
ecma_deref_object (constructor_object_p);
172-
173-
if (ECMA_IS_VALUE_ERROR (constructor_prototype))
174-
{
175-
return constructor_prototype;
176-
}
177-
178-
ecma_value_t result = ecma_op_create_array_object (arguments_list_p,
179-
arguments_list_len,
180-
is_treat_single_arg_as_length);
181-
182-
if (ecma_is_value_object (constructor_prototype))
183-
{
184-
ecma_object_t *result_object_p = ecma_get_object_from_value (result);
185-
ecma_object_t *constructor_prototpye_object_p = ecma_get_object_from_value (constructor_prototype);
186-
ECMA_SET_POINTER (result_object_p->prototype_or_outer_reference_cp, constructor_prototpye_object_p);
187-
}
188-
189-
ecma_free_value (constructor_prototype);
190-
191-
return result;
160+
return ecma_op_create_array_object (arguments_list_p,
161+
arguments_list_len,
162+
is_treat_single_arg_as_length);
192163
} /* ecma_op_create_array_object_by_constructor */
193164
#endif /* !CONFIG_DISABLE_ES2015_CLASS */
194165

tests/jerry/es2015/class-inheritance-builtin-array.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
assert (c.g () === 5);
4848
assert (c.h () === 5);
4949

50+
/* TODO: Enable these tests after Symbol has been implemented
5051
// Test built-in Array prototype methods
5152
var mapped = c.map ((x) => x * 2);
5253
isInstanceofArray (mapped);
@@ -114,3 +115,4 @@
114115
} catch (e) {
115116
assert (e instanceof TypeError);
116117
}
118+
*/

tests/jerry/es2015/class-inheritance-builtin-typedarray.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
assert (c.g () === 5)
4747
assert (c.h () === 5)
4848

49+
/* TODO: Enable these tests after Symbol has been implemented
4950
var mapped = c.map ((x) => x * 2);
5051
isInstanceofTypedArray (mapped);
5152
@@ -72,3 +73,4 @@
7273
} catch (e) {
7374
assert (e instanceof TypeError)
7475
}
76+
*/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright JS Foundation and other contributors, http://js.foundation
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
function f(a,b,c) {
16+
var args = Array.prototype.slice.call(arguments, 3);
17+
assert (typeof args.splice === "function");
18+
}
19+
f();

0 commit comments

Comments
 (0)