Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix error reporting breakage.
Wasn't shown up by the non-"# icu" spectests, so went unnoticed in the
commit that introduced it.
  • Loading branch information
jnthn committed Apr 10, 2013
1 parent 00ca10a commit b64279b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/core/Backtrace.pm
Expand Up @@ -40,10 +40,11 @@ my class Backtrace is List {
multi method new(Parcel $bt, Int $offset = 0) {
my $new = self.bless(*);
for $offset .. $bt.elems - 1 {
next if nqp::isnull($bt[$_]<sub>);
my Mu $sub := nqp::getattr(nqp::decont($bt[$_]<sub>), ForeignCode, '$!do');
next if nqp::isnull($sub);
my $code;
try {
$code = nqp::getcodeobj($bt[$_]<sub>);
$code = nqp::getcodeobj($sub);
};
my $line = $bt[$_]<annotations><line>;
my $file = $bt[$_]<annotations><file>;
Expand All @@ -53,7 +54,7 @@ my class Backtrace is List {
$file eq 'src\\gen\\BOOTSTRAP.pm';
last if $file eq 'src/stage2/gen/NQPHLL.pm' ||
$file eq 'src\\stage2\\gen\\NQPHLL.pm';
my $subname = nqp::p6box_s($bt[$_]<sub>);
my $subname = nqp::p6box_s(nqp::getcodename($sub));
$subname = '<anon>' if $subname.substr(0, 6) eq '_block';
$new.push: Backtrace::Frame.new(
:$line,
Expand Down
2 changes: 1 addition & 1 deletion src/core/Code.pm
Expand Up @@ -12,7 +12,7 @@ my class Code does Callable {
multi method Str(Code:D:) { self.name }

method outer(Code:D:) {
nqp::getcodeobj($!do.get_outer())
nqp::getcodeobj(nqp::findmethod($!do, 'get_outer')($!do))
}

# returns an identifier for this code object
Expand Down
9 changes: 5 additions & 4 deletions src/core/Exception.pm
Expand Up @@ -178,14 +178,15 @@ do {
sub is_runtime($bt) {
for $bt.keys {
try {
return True if nqp::iseq_s($bt[$_]<sub>, 'eval')
my Mu $sub := nqp::getattr(nqp::decont($bt[$_]<sub>), ForeignCode, '$!do');
return True if nqp::iseq_s(nqp::getcodename($sub), 'eval')
&& nqp::iseq_s(
nqp::join(';', $bt[$_]<sub>.get_namespace.get_name),
nqp::join(';', $sub.get_namespace.get_name),
'nqp'
);
return False if nqp::iseq_s($bt[$_]<sub>, 'compile')
return False if nqp::iseq_s(nqp::getcodename($sub), 'compile')
&& nqp::iseq_s(
nqp::join(';', $bt[$_]<sub>.get_namespace.get_name),
nqp::join(';', $sub.get_namespace.get_name),
'nqp'
);
}
Expand Down

0 comments on commit b64279b

Please sign in to comment.