Introducing constructor for label completion values (for 'break' and 'continue' completion types).

This commit is contained in:
Ruben Ayrapetyan
2014-08-28 23:08:26 +04:00
parent 227c09fb3e
commit 164350b369
3 changed files with 29 additions and 3 deletions
+2 -2
View File
@@ -150,8 +150,8 @@ typedef struct
*/ */
struct struct
{ {
/** Levels left */ /** Levels to label left */
uint8_t level; uint8_t depth;
/** Target's offset */ /** Target's offset */
uint16_t offset; uint16_t offset;
+24 -1
View File
@@ -279,7 +279,7 @@ ecma_free_value (ecma_value_t value, /**< value description */
} /* ecma_free_value */ } /* ecma_free_value */
/** /**
* Completion value constructor * Normal, throw, return, exit and meta completion values constructor
* *
* @return completion value * @return completion value
*/ */
@@ -303,6 +303,29 @@ ecma_make_completion_value (ecma_completion_type_t type, /**< type */
return ret_value; return ret_value;
} /* ecma_make_completion_value */ } /* ecma_make_completion_value */
/**
* Break and continue completion values constructor
*
* @return completion value
*/
ecma_completion_value_t
ecma_make_label_completion_value (ecma_completion_type_t type, /**< type */
uint8_t depth_level, /**< depth level (in try constructions,
with blocks, etc.) */
uint16_t offset) /**< offset to label from end of last block */
{
JERRY_ASSERT (type == ECMA_COMPLETION_TYPE_BREAK
|| type == ECMA_COMPLETION_TYPE_CONTINUE);
ecma_completion_value_t ret_value;
ret_value.type = type;
ret_value.u.target.depth = depth_level;
ret_value.u.target.offset = offset;
return ret_value;
} /* ecma_make_label_completion_value */
/** /**
* Simple normal completion value constructor * Simple normal completion value constructor
* *
+3
View File
@@ -70,6 +70,9 @@ extern void ecma_free_value (const ecma_value_t value, bool do_deref_if_object);
extern ecma_completion_value_t ecma_make_completion_value (ecma_completion_type_t type, extern ecma_completion_value_t ecma_make_completion_value (ecma_completion_type_t type,
ecma_value_t value); ecma_value_t value);
extern ecma_completion_value_t ecma_make_label_completion_value (ecma_completion_type_t type,
uint8_t depth_level,
uint16_t offset);
extern ecma_completion_value_t ecma_make_simple_completion_value (ecma_simple_value_t simple_value); extern ecma_completion_value_t ecma_make_simple_completion_value (ecma_simple_value_t simple_value);
extern ecma_completion_value_t ecma_make_throw_value (ecma_object_t *exception_p); extern ecma_completion_value_t ecma_make_throw_value (ecma_object_t *exception_p);
extern ecma_completion_value_t ecma_make_empty_completion_value (void); extern ecma_completion_value_t ecma_make_empty_completion_value (void);