Postparser landing patch: add tree of scopes

This commit is contained in:
Ilmir Usmanov
2014-10-12 17:53:02 +04:00
parent cb7e54fe22
commit 63662dfb35
12 changed files with 305 additions and 48 deletions
+1
View File
@@ -22,6 +22,7 @@
#define ASSERT_LIST(list) \
do { \
linked_list_header *header = (linked_list_header *) list; \
JERRY_ASSERT (header); \
JERRY_ASSERT (header->magic == LINKED_LIST_MAGIC); \
} while (0);
+1
View File
@@ -32,6 +32,7 @@ __packed
linked_list_header;
typedef uint8_t* linked_list;
#define null_list NULL
linked_list linked_list_init (size_t);
void linked_list_free (linked_list);
+5 -5
View File
@@ -40,7 +40,7 @@
STACK(temp_names, uint8_t, uint8_t)
#define GLOBAL(NAME, VAR) \
NAME.data[VAR]
STACK_ELEMENT (NAME, VAR)
#define MAX_TEMP_NAME() \
GLOBAL(temp_names, max_temp_name)
@@ -54,7 +54,7 @@
void
parser_init (void)
{
STACK_INIT(uint8_t, temp_names)
STACK_INIT(temp_names)
}
void
@@ -81,11 +81,11 @@ typedef struct \
__packed \
NAME##_stack;
#define STACK_INIT(TYPE, NAME) \
#define STACK_INIT(NAME) \
do { \
NAME.blocks = linked_list_init (sizeof (TYPE)); \
NAME.blocks = linked_list_init (sizeof (NAME##_stack_value_type)); \
NAME.current = NAME##_global_size; \
NAME.length = NAME.block_len = ((linked_list_header *) NAME.blocks)->block_size / sizeof (TYPE); \
NAME.length = NAME.block_len = ((linked_list_header *) NAME.blocks)->block_size / sizeof (NAME##_stack_value_type); \
} while (0)
#define STACK_FREE(NAME) \
+1
View File
@@ -23,6 +23,7 @@
typedef struct tree_header
{
uint8_t magic;
uint8_t children_num;
struct tree_header *parent;
linked_list children;
}