Support this binding retrieval for backtrace frames (#4669)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -5276,6 +5276,26 @@ jerry_backtrace_get_function (jerry_backtrace_frame_t *frame_p) /**< frame point
|
||||
return NULL;
|
||||
} /* jerry_backtrace_get_function */
|
||||
|
||||
/**
|
||||
* Initialize and return with the 'this' binding private field of a backtrace frame.
|
||||
* The 'this' binding is a hidden value passed to the called function. As for arrow
|
||||
* functions, the 'this' binding is assigned at function creation.
|
||||
*
|
||||
* @return pointer to the 'this' binding - if the binding is available,
|
||||
* NULL - otherwise
|
||||
*/
|
||||
const jerry_value_t *
|
||||
jerry_backtrace_get_this (jerry_backtrace_frame_t *frame_p) /**< frame pointer */
|
||||
{
|
||||
if (frame_p->frame_type == JERRY_BACKTRACE_FRAME_JS)
|
||||
{
|
||||
frame_p->this_binding = frame_p->context_p->this_binding;
|
||||
return &frame_p->this_binding;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
} /* jerry_backtrace_get_this */
|
||||
|
||||
/**
|
||||
* Returns true, if the code bound to the backtrace frame is strict mode code.
|
||||
*
|
||||
|
||||
@@ -350,6 +350,7 @@ void jerry_backtrace_capture (jerry_backtrace_callback_t callback, void *user_p)
|
||||
jerry_backtrace_frame_types_t jerry_backtrace_get_frame_type (jerry_backtrace_frame_t *frame_p);
|
||||
const jerry_backtrace_location_t *jerry_backtrace_get_location (jerry_backtrace_frame_t *frame_p);
|
||||
const jerry_value_t *jerry_backtrace_get_function (jerry_backtrace_frame_t *frame_p);
|
||||
const jerry_value_t *jerry_backtrace_get_this (jerry_backtrace_frame_t *frame_p);
|
||||
bool jerry_backtrace_is_strict (jerry_backtrace_frame_t *frame_p);
|
||||
|
||||
/**
|
||||
|
||||
@@ -157,6 +157,7 @@ struct jerry_backtrace_frame_internal_t
|
||||
uint8_t frame_type; /**< frame type */
|
||||
jerry_backtrace_location_t location; /**< location information */
|
||||
ecma_value_t function; /**< function reference */
|
||||
ecma_value_t this_binding; /**< this binding passed to the function */
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user