Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/operations/ecma-function-object.c (C)

Code before:
      }
    }

    return NULL;
  }
#endif /* ENABLED (JERRY_ESNEXT) */

  if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_PROTOTYPE)
      && ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_FUNCTION)
  {
    return ecma_op_lazy_instantiate_prototype_object (object_p);
  }

  if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_CALLER)
      || ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_ARGUMENTS))
  {
    const ecma_compiled_code_t *bytecode_data_p;
    bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);

#if ENABLED (JERRY_ESNEXT)
    uint16_t function_type = CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags);

    if (!(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE)
        && !(function_type == CBC_FUNCTION_ARROW)
        && !(function_type == CBC_FUNCTION_ASYNC)
        && !(function_type == CBC_FUNCTION_GENERATOR))
    {
      ecma_property_t *value_prop_p;
      /* The property_name_p argument contains the name. */
      ecma_property_value_t *value_p = ecma_create_named_data_property (object_p,
                                                                        property_name_p,
                                                                        ECMA_PROPERTY_FIXED,
                                                                        &value_prop_p);
      value_p->value = ECMA_VALUE_NULL;
      return value_prop_p;
    }
#else /* !ENABLED (JERRY_ESNEXT) */
    if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE)
    {
      ecma_object_t *thrower_p = ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER);

      ecma_property_t *caller_prop_p;
      /* The property_name_p argument contains the name. */
      ecma_create_named_accessor_property (object_p,
                                           property_name_p,
                                           thrower_p,
                                           thrower_p,
                                           ECMA_PROPERTY_FIXED,
                                           &caller_prop_p);
      return caller_prop_p;
    }

Review comment (suggestion):
I checked accessors and constructor functions and it seems they don't have these properties as well. Is there any other function type which has these properties? Because if only normal functions have these properties, we can change the check to:
`CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags) == CBC_FUNCTION_NORMAL`

Code after:
      }
    }

    return NULL;
  }
#endif /* ENABLED (JERRY_ESNEXT) */

  if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_PROTOTYPE)
      && ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_FUNCTION)
  {
    return ecma_op_lazy_instantiate_prototype_object (object_p);
  }

  if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_CALLER)
      || ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_ARGUMENTS))
  {
    const ecma_compiled_code_t *bytecode_data_p;
    bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);

#if ENABLED (JERRY_ESNEXT)
    if (!(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE)
        && CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags) == CBC_FUNCTION_NORMAL)
    {
      ecma_property_t *value_prop_p;
      /* The property_name_p argument contains the name. */
      ecma_property_value_t *value_p = ecma_create_named_data_property (object_p,
                                                                        property_name_p,
                                                                        ECMA_PROPERTY_FIXED,
                                                                        &value_prop_p);
      value_p->value = ECMA_VALUE_NULL;
      return value_prop_p;
    }
#else /* !ENABLED (JERRY_ESNEXT) */
    if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE)
    {
      ecma_object_t *thrower_p = ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER);

      ecma_property_t *caller_prop_p;
      /* The property_name_p argument contains the name. */
      ecma_create_named_accessor_property (object_p,
                                           property_name_p,
                                           thrower_p,
                                           thrower_p,
                                           ECMA_PROPERTY_FIXED,
                                           &caller_prop_p);
      return caller_prop_p;
    }
#endif /* ENABLED (JERRY_ESNEXT) */

  }