order-independent declarations

code constructs and traverses a dependency graph in a deterministic
order.
This commit is contained in:
Andrew Kelley
2016-01-09 23:49:22 -07:00
parent 6d9119fcd9
commit 1fe1235e14
6 changed files with 504 additions and 202 deletions

View File

@@ -457,6 +457,7 @@ struct ParseContext {
ZigList<AstNode *> *directive_list;
ImportTableEntry *owner;
ErrColor err_color;
uint32_t next_create_index;
};
__attribute__ ((format (printf, 4, 5)))
@@ -512,6 +513,8 @@ static AstNode *ast_create_node_no_line_info(ParseContext *pc, NodeType type) {
AstNode *node = allocate<AstNode>(1);
node->type = type;
node->owner = pc->owner;
node->create_index = pc->next_create_index;
pc->next_create_index += 1;
return node;
}