Skip to content

Commit 1203b97

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 1203b97

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ 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+
#ifdef CONFIG_DISABLE_ES2015_SYMBOL
157158
ecma_value_t constructor_value = ecma_op_object_get_by_magic_id (object_p, LIT_MAGIC_STRING_CONSTRUCTOR);
158159

159160
if (ECMA_IS_VALUE_ERROR (constructor_value)
@@ -165,6 +166,8 @@ ecma_op_create_array_object_by_constructor (const ecma_value_t *arguments_list_p
165166
}
166167

167168
ecma_object_t *constructor_object_p = ecma_get_object_from_value (constructor_value);
169+
170+
//FIXME: Use @@species after Symbol has been implemented
168171
ecma_value_t constructor_prototype = ecma_op_object_get_by_magic_id (constructor_object_p,
169172
LIT_MAGIC_STRING_PROTOTYPE);
170173

@@ -175,10 +178,15 @@ ecma_op_create_array_object_by_constructor (const ecma_value_t *arguments_list_p
175178
return constructor_prototype;
176179
}
177180

181+
#else /* !CONFIG_DISABLE_ES2015_SYMBOL*/
182+
JERRY_UNUSED (object_p);
183+
#endif /* CONFIG_DISABLE_ES2015_SYMBOL */
184+
178185
ecma_value_t result = ecma_op_create_array_object (arguments_list_p,
179186
arguments_list_len,
180187
is_treat_single_arg_as_length);
181188

189+
#ifdef CONFIG_DISABLE_ES2015_SYMBOLS
182190
if (ecma_is_value_object (constructor_prototype))
183191
{
184192
ecma_object_t *result_object_p = ecma_get_object_from_value (result);
@@ -187,6 +195,7 @@ ecma_op_create_array_object_by_constructor (const ecma_value_t *arguments_list_p
187195
}
188196

189197
ecma_free_value (constructor_prototype);
198+
#endif /* CONFIG_DISABLE_ES2015_SYMBOL */
190199

191200
return result;
192201
} /* ecma_op_create_array_object_by_constructor */

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)