Slightly more informative error locations.

Inside a class or protocol definition is not "at top level" ;)
This commit is contained in:
Bill Currie 2010-12-31 15:56:31 +09:00
parent 530e8fae34
commit a4635d79e8
2 changed files with 7 additions and 1 deletions

View file

@ -2882,6 +2882,9 @@ report_function (expr_t *e)
if (current_func) {
fprintf (stderr, "%s: In function `%s':\n", G_GETSTR (file),
current_func->def->name);
} else if (current_class) {
fprintf (stderr, "%s: In class `%s':\n", G_GETSTR (file),
get_class_name (current_class, 1));
} else {
fprintf (stderr, "%s: At top level:\n", G_GETSTR (file));
}

View file

@ -1264,6 +1264,7 @@ new_class_name
error (0, "redefinition of `%s'", $1);
$$ = get_class (0, 1);
}
current_class = &$$->class_type;
}
;
@ -1303,6 +1304,7 @@ new_category_name
error (0, "redefinition of category `%s (%s)'", $1, $3);
$$ = get_category (0, 0, 1);
}
current_class = &$$->class_type;
}
;
@ -1331,6 +1333,7 @@ protocol_name
} else {
$$ = get_protocol ($1, 1);
}
current_class = &$$->class_type;
}
;
@ -1426,7 +1429,7 @@ protocoldef
: PROTOCOL protocol_name
protocolrefs { protocol_add_protocols ($2, $3); $<class>$ = 0; }
methodprotolist { protocol_add_methods ($2, $5); }
END { (void) ($<class>4); }
END { current_class = 0; (void) ($<class>4); }
;
protocolrefs