diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2015-12-01 00:50:11 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2015-12-01 00:50:11 -0700 |
| commit | 257cf09472ce5f4a51bf39808e119717fa0e4280 (patch) | |
| tree | 722cbc737134b1aa03fafac400f680f20007308a /src/analyze.cpp | |
| parent | 31cf43de54c012c3b6f4fa7a516e2aac0ae18b56 (diff) | |
| download | zig-257cf09472ce5f4a51bf39808e119717fa0e4280.tar.gz zig-257cf09472ce5f4a51bf39808e119717fa0e4280.zip | |
colored error messages that tell the source file
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index e1a960a698..fccbad8bb7 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -12,13 +12,17 @@ #include "os.hpp" static void add_node_error(CodeGen *g, AstNode *node, Buf *msg) { - g->errors.add_one(); - ErrorMsg *last_msg = &g->errors.last(); - last_msg->line_start = node->line; - last_msg->column_start = node->column; - last_msg->line_end = -1; - last_msg->column_end = -1; - last_msg->msg = msg; + ErrorMsg *err = allocate<ErrorMsg>(1); + err->line_start = node->line; + err->column_start = node->column; + err->line_end = -1; + err->column_end = -1; + err->msg = msg; + err->path = node->owner->path; + err->source = node->owner->source_code; + err->line_offsets = node->owner->line_offsets; + + g->errors.append(err); } static int parse_version_string(Buf *buf, int *major, int *minor, int *patch) { |
