From 1fe1235e14cd599c1b3a6f079670b7cb7ea270d2 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 9 Jan 2016 23:49:22 -0700 Subject: order-independent declarations code constructs and traverses a dependency graph in a deterministic order. --- src/parser.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/parser.cpp') diff --git a/src/parser.cpp b/src/parser.cpp index a27f2d66d9..31f9aadcd8 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -457,6 +457,7 @@ struct ParseContext { ZigList *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(1); node->type = type; node->owner = pc->owner; + node->create_index = pc->next_create_index; + pc->next_create_index += 1; return node; } -- cgit v1.2.3