Skip to content

Commit

Permalink
Add missing object types for ecma_object_get_class_name (#4954)
Browse files Browse the repository at this point in the history
This patch fixes #4937 and fixes #4938.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
  • Loading branch information
Robert Fancsik committed Jan 10, 2022
1 parent 58e504f commit 6efe14d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions jerry-core/ecma/operations/ecma-objects.c
Expand Up @@ -2762,6 +2762,7 @@ ecma_object_check_class_name_is_object (ecma_object_t *obj_p) /**< object */
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_FLOAT64ARRAY_PROTOTYPE)
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
#if JERRY_BUILTIN_BIGINT
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_BIGINT_PROTOTYPE)
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_BIGINT64ARRAY_PROTOTYPE)
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_BIGUINT64ARRAY_PROTOTYPE)
#endif /* JERRY_BUILTIN_BIGINT */
Expand Down Expand Up @@ -2936,6 +2937,7 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */
case ECMA_OBJECT_TYPE_NATIVE_FUNCTION:
case ECMA_OBJECT_TYPE_BOUND_FUNCTION:
case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:
case ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION:
{
return LIT_MAGIC_STRING_FUNCTION_UL;
}
Expand Down
16 changes: 16 additions & 0 deletions tests/jerry/es.next/regression-test-issue-4937-4938.js
@@ -0,0 +1,16 @@
// 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.

assert(Object.prototype.toString.call(class {}) === "[object Function]");
assert(Object.prototype.toString.call(BigInt.prototype) === "[object BigInt]");

0 comments on commit 6efe14d

Please sign in to comment.