Skip to content

Commit 695c745

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 695c745

File tree

6 files changed

+37
-1
lines changed

6 files changed

+37
-1
lines changed

jerry-core/config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
# define CONFIG_DISABLE_ES2015_MAP_BUILTIN
4444
# define CONFIG_DISABLE_ES2015_OBJECT_INITIALIZER
4545
# define CONFIG_DISABLE_ES2015_PROMISE_BUILTIN
46+
# define CONFIG_DISABLE_ES2015_SYMBOL
4647
# define CONFIG_DISABLE_ES2015_TEMPLATE_STRINGS
4748
# define CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN
4849
#endif /* CONFIG_DISABLE_ES2015 */

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+
#ifndef 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+
/* TODO: 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+
#ifndef 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 */

jerry-core/profiles/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ CONFIG_DISABLE_ES2015_FUNCTION_PARAMETER_INITIALIZER
3636
CONFIG_DISABLE_ES2015_MAP_BUILTIN
3737
CONFIG_DISABLE_ES2015_OBJECT_INITIALIZER
3838
CONFIG_DISABLE_ES2015_PROMISE_BUILTIN
39+
CONFIG_DISABLE_ES2015_SYMBOL
3940
CONFIG_DISABLE_ES2015_TEMPLATE_STRINGS
4041
CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN
4142
```
@@ -98,11 +99,13 @@ In JerryScript all of the features are enabled by default, so an empty profile f
9899
Disable the [enhanced object initializer](http://www.ecma-international.org/ecma-262/6.0/#sec-object-initializer) language element.
99100
* `CONFIG_DISABLE_ES2015_PROMISE_BUILTIN`:
100101
Disable the [Promise](http://www.ecma-international.org/ecma-262/6.0/#sec-promise-objects) built-in.
102+
* `CONFIG_DISABLE_ES2015_SYMBOL`:
103+
Disable the [Symbol](http://www.ecma-international.org/ecma-262/6.0/#sec-symbol-constructor) language element.
101104
* `CONFIG_DISABLE_ES2015_TEMPLATE_STRINGS`:
102105
Disable the [template strings](http://www.ecma-international.org/ecma-262/6.0/#sec-static-semantics-templatestrings).
103106
* `CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN`:
104107
Disable the [ArrayBuffer](http://www.ecma-international.org/ecma-262/6.0/#sec-arraybuffer-objects) and [TypedArray](http://www.ecma-international.org/ecma-262/6.0/#sec-typedarray-objects) built-ins.
105108
* `CONFIG_DISABLE_ES2015`: Disable all of the implemented [ECMAScript2015 features](http://www.ecma-international.org/ecma-262/6.0/).
106109
(equivalent to `CONFIG_DISABLE_ES2015_ARROW_FUNCTION`, `CONFIG_DISABLE_ES2015_BUILTIN`, `CONFIG_DISABLE_ES2015_CLASS`,
107110
`CONFIG_DISABLE_ES2015_FUNCTION_PARAMETER_INITIALIZER`, `CONFIG_DISABLE_ES2015_MAP_BUILTIN`, `CONFIG_DISABLE_ES2015_OBJECT_INITIALIZER`,
108-
`CONFIG_DISABLE_ES2015_PROMISE_BUILTIN`, `CONFIG_DISABLE_ES2015_TEMPLATE_STRINGS`, and `CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN`).
111+
`CONFIG_DISABLE_ES2015_PROMISE_BUILTIN`, `CONFIG_DISABLE_ES2015_TEMPLATE_STRINGS`, `CONFIG_DISABLE_ES2015_TEMPLATE_STRINGS`, and `CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN`).

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)