aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-01-09 23:49:22 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-01-09 23:49:22 -0700
commit1fe1235e14cd599c1b3a6f079670b7cb7ea270d2 (patch)
tree87e7bf3db7b96ccf27d4e23591460b7b1c21a3a9 /src/parser.cpp
parent6d9119fcd91cd01d658180d7fa5e4c8c203ba3db (diff)
downloadzig-1fe1235e14cd599c1b3a6f079670b7cb7ea270d2.tar.gz
zig-1fe1235e14cd599c1b3a6f079670b7cb7ea270d2.zip
order-independent declarations
code constructs and traverses a dependency graph in a deterministic order.
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp3
1 files changed, 3 insertions, 0 deletions
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<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;
}