diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2015-12-14 22:01:39 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2015-12-14 22:06:25 -0700 |
| commit | 52e19b4a9b6e6140bae3c20c6f1fef36dca20aa7 (patch) | |
| tree | 7f08300bbaedd657fc46ae816e0302470becfb1a /src/parser.cpp | |
| parent | 304941026013e6310c9362849610c32d98d1332a (diff) | |
| download | zig-52e19b4a9b6e6140bae3c20c6f1fef36dca20aa7.tar.gz zig-52e19b4a9b6e6140bae3c20c6f1fef36dca20aa7.zip | |
analyze: BlockContext has concept of module scope
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index bb75a0da6e..280f8da4d7 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -2266,7 +2266,7 @@ static AstNode *ast_parse_struct_decl(ParseContext *pc, int *token_index) { } /* -TopLevelDecl : FnDef | ExternBlock | RootExportDecl | Use | StructDecl +TopLevelDecl : FnDef | ExternBlock | RootExportDecl | Use | StructDecl | VariableDeclaration */ static void ast_parse_top_level_decls(ParseContext *pc, int *token_index, ZigList<AstNode *> *top_level_decls) { for (;;) { @@ -2310,6 +2310,13 @@ static void ast_parse_top_level_decls(ParseContext *pc, int *token_index, ZigLis } pc->directive_list = nullptr; + AstNode *var_decl_node = ast_parse_variable_declaration_expr(pc, token_index, false); + if (var_decl_node) { + ast_eat_token(pc, token_index, TokenIdSemicolon); + top_level_decls->append(var_decl_node); + continue; + } + return; } zig_unreachable(); |
