From 257cf09472ce5f4a51bf39808e119717fa0e4280 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 1 Dec 2015 00:50:11 -0700 Subject: colored error messages that tell the source file --- src/analyze.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/analyze.cpp') 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(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) { -- cgit v1.2.3