Implement source info retrieval API function (#4780)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2021-09-29 12:34:38 +02:00
committed by GitHub
parent 8b3eb93167
commit 2a82da62ad
7 changed files with 524 additions and 6 deletions
+2
View File
@@ -362,6 +362,8 @@ void jerry_set_vm_exec_stop_callback (jerry_vm_exec_stop_callback_t stop_cb, voi
void jerry_set_vm_throw_callback (jerry_vm_throw_callback_t throw_cb, void *user_p);
jerry_value_t jerry_get_resource_name (const jerry_value_t value);
jerry_value_t jerry_get_user_value (const jerry_value_t value);
jerry_source_info_t *jerry_get_source_info (const jerry_value_t value);
void jerry_free_source_info (jerry_source_info_t *source_info_p);
/**
* Array buffer components.
+27
View File
@@ -789,6 +789,33 @@ typedef enum
JERRY_CONTAINER_OP_CLEAR, /**< Set/Map clear operation */
} jerry_container_operation_t;
/**
* Miscellaneous types.
*/
/**
* Enabled fields of jerry_source_info_t.
*/
typedef enum
{
JERRY_SOURCE_INFO_HAS_SOURCE_CODE = (1 << 0), /**< source_code field is valid */
JERRY_SOURCE_INFO_HAS_FUNCTION_ARGUMENTS = (1 << 1), /**< function_arguments field is valid */
JERRY_SOURCE_INFO_HAS_SOURCE_RANGE = (1 << 2), /**< both source_range_start and source_range_length
* fields are valid */
} jerry_source_info_enabled_fields_t;
/**
* Source related information of a script/module/function.
*/
typedef struct
{
uint32_t enabled_fields; /**< combination of jerry_source_info_enabled_fields_t values */
jerry_value_t source_code; /**< script source code or function body */
jerry_value_t function_arguments; /**< function arguments */
uint32_t source_range_start; /**< start position of the function in the source code */
uint32_t source_range_length; /**< source length of the function in the source code */
} jerry_source_info_t;
/**
* @}
*/