Add range-based error messages to -verbose-errors

Example:
Cannot convert '(1 + 2)' to 'untyped bool' from 'untyped integer'

	x := (1 + 2) * true;
	     ^~~~~~^
This commit is contained in:
gingerBill
2021-05-19 14:15:57 +01:00
parent 5108ebf015
commit 9c54ed5792
9 changed files with 429 additions and 167 deletions

View File

@@ -87,7 +87,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32
case BuiltinProc_DIRECTIVE: {
ast_node(bd, BasicDirective, ce->proc);
String name = bd->name;
String name = bd->name.string;
if (name == "defined") {
break;
}
@@ -124,7 +124,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32
case BuiltinProc_DIRECTIVE: {
ast_node(bd, BasicDirective, ce->proc);
String name = bd->name;
String name = bd->name.string;
if (name == "location") {
if (ce->args.count > 1) {
error(ce->args[0], "'#location' expects either 0 or 1 arguments, got %td", ce->args.count);