jerry gay wrote:
On Wed, Jun 4, 2008 at 2:46 PM, Moritz Lenz <[EMAIL PROTECTED]> wrote:
Oops, forgot to attach patch. Now it's really there.
thanks, applied as of r28074.
~jerry
This is wrong patch. eval() shouldn't throws any exceptions.
Correct patch for 'eval()' and Test.pm attached.
--
Bacek.
diff --git a/languages/perl6/Test.pm b/languages/perl6/Test.pm
index 5cb04ae..ccc34a9 100644
--- a/languages/perl6/Test.pm
+++ b/languages/perl6/Test.pm
@@ -123,14 +123,16 @@ multi sub lives_ok($closure) {
}
multi sub eval_dies_ok($code, $reason) {
- proclaim((defined eval_exception($code)), $reason);
+ eval(code);
+ proclaim(defined($!), $reason);
}
multi sub eval_dies_ok($code) {
eval_dies_ok($code, '');
}
multi sub eval_lives_ok($code, $reason) {
- proclaim((not defined eval_exception($code)), $reason);
+ eval($code);
+ proclaim((not defined $!), $reason);
}
multi sub eval_lives_ok($code) {
eval_lives_ok($code, '');
@@ -139,12 +141,6 @@ multi sub eval_lives_ok($code) {
## 'private' subs
-sub eval_exception($code) {
- my $eval_exception;
- try { eval ($code); $eval_exception = $! }
- $eval_exception // $!;
-}
-
sub proclaim($cond, $desc) {
$testing_started = 1;
$num_of_tests_run = $num_of_tests_run + 1;
diff --git a/languages/perl6/src/builtins/control.pir b/languages/perl6/src/builtins/control.pir
index 479b1b6..558a4c4 100644
--- a/languages/perl6/src/builtins/control.pir
+++ b/languages/perl6/src/builtins/control.pir
@@ -113,13 +113,12 @@ on error.
unless have_lang goto no_lang
'die'('Lanuage parameter to eval unimplemented.')
no_lang:
+ push_eh catch
.local pmc compiler, invokable
.local pmc res, exception
compiler = compreg 'Perl6'
invokable = compiler.'compile'(code)
-
- push_eh catch
res = invokable()
pop_eh
exception = new 'Failure'