mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
eval_error.c: error position format
* eval_error.c (error_print): use same error position format when no backtrace too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
06751e43a3
commit
aa40518b44
1 changed files with 5 additions and 19 deletions
24
eval_error.c
24
eval_error.c
|
@ -87,6 +87,7 @@ error_print(void)
|
||||||
volatile VALUE eclass = Qundef, e = Qundef;
|
volatile VALUE eclass = Qundef, e = Qundef;
|
||||||
const char *volatile einfo;
|
const char *volatile einfo;
|
||||||
volatile long elen;
|
volatile long elen;
|
||||||
|
VALUE mesg;
|
||||||
|
|
||||||
if (NIL_P(errinfo))
|
if (NIL_P(errinfo))
|
||||||
return;
|
return;
|
||||||
|
@ -105,28 +106,13 @@ error_print(void)
|
||||||
else {
|
else {
|
||||||
goto no_message;
|
goto no_message;
|
||||||
}
|
}
|
||||||
if (NIL_P(errat)) {
|
if (NIL_P(errat) || RARRAY_LEN(errat) == 0 ||
|
||||||
int line;
|
NIL_P(mesg = RARRAY_AREF(errat, 0))) {
|
||||||
const char *file = rb_source_loc(&line);
|
|
||||||
if (!file)
|
|
||||||
warn_printf("%d: ", line);
|
|
||||||
else if (!line)
|
|
||||||
warn_printf("%s: ", file);
|
|
||||||
else
|
|
||||||
warn_printf("%s:%d: ", file, line);
|
|
||||||
}
|
|
||||||
else if (RARRAY_LEN(errat) == 0) {
|
|
||||||
error_pos();
|
error_pos();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
VALUE mesg = RARRAY_AREF(errat, 0);
|
warn_print_str(mesg);
|
||||||
|
warn_print(": ");
|
||||||
if (NIL_P(mesg))
|
|
||||||
error_pos();
|
|
||||||
else {
|
|
||||||
warn_print_str(mesg);
|
|
||||||
warn_print(": ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
eclass = CLASS_OF(errinfo);
|
eclass = CLASS_OF(errinfo);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue