aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-02-28 10:11:32 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-02-28 10:11:32 -0500
commit5424b4320def194b205dcfe8e937035d2d80ae09 (patch)
tree033c9534190356feefa34ac7649f729202beac89 /src/parser.cpp
parentd093f51f16ab9fe4f119a47c80c59d99a90a590f (diff)
downloadzig-5424b4320def194b205dcfe8e937035d2d80ae09.tar.gz
zig-5424b4320def194b205dcfe8e937035d2d80ae09.zip
remove namespace type; files are empty structs
closes #1047
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 6fe78c14c3..2fd453c67f 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -18,7 +18,7 @@ struct ParseContext {
Buf *buf;
size_t current_token;
ZigList<Token> *tokens;
- ImportTableEntry *owner;
+ ZigType *owner;
ErrColor err_color;
};
@@ -130,8 +130,10 @@ static void ast_error(ParseContext *pc, Token *token, const char *format, ...) {
va_end(ap);
- ErrorMsg *err = err_msg_create_with_line(pc->owner->path, token->start_line, token->start_column,
- pc->owner->source_code, pc->owner->line_offsets, msg);
+ ErrorMsg *err = err_msg_create_with_line(pc->owner->data.structure.root_struct->path,
+ token->start_line, token->start_column,
+ pc->owner->data.structure.root_struct->source_code,
+ pc->owner->data.structure.root_struct->line_offsets, msg);
err->line_start = token->start_line;
err->column_start = token->start_column;
@@ -148,8 +150,10 @@ static void ast_asm_error(ParseContext *pc, AstNode *node, size_t offset, const
Buf *msg = buf_vprintf(format, ap);
va_end(ap);
- ErrorMsg *err = err_msg_create_with_line(pc->owner->path, node->line, node->column,
- pc->owner->source_code, pc->owner->line_offsets, msg);
+ ErrorMsg *err = err_msg_create_with_line(pc->owner->data.structure.root_struct->path,
+ node->line, node->column,
+ pc->owner->data.structure.root_struct->source_code,
+ pc->owner->data.structure.root_struct->line_offsets, msg);
print_err_msg(err, pc->err_color);
exit(EXIT_FAILURE);
@@ -570,9 +574,7 @@ static void ast_parse_asm_template(ParseContext *pc, AstNode *node) {
}
}
-AstNode *ast_parse(Buf *buf, ZigList<Token> *tokens, ImportTableEntry *owner,
- ErrColor err_color)
-{
+AstNode *ast_parse(Buf *buf, ZigList<Token> *tokens, ZigType *owner, ErrColor err_color) {
ParseContext pc = {};
pc.err_color = err_color;
pc.owner = owner;