Author: tene
Date: Sun Jan 4 22:47:00 2009
New Revision: 34964
Modified:
branches/pct_hll/languages/perl6/src/builtins/control.pir
Log:
[rakudo]: Initial implementation of :lang for eval.
Modified: branches/pct_hll/languages/perl6/src/builtins/control.pir
==============================================================================
--- branches/pct_hll/languages/perl6/src/builtins/control.pir (original)
+++ branches/pct_hll/languages/perl6/src/builtins/control.pir Sun Jan 4
22:47:00 2009
@@ -301,14 +301,24 @@
$P0 = get_hll_global 'Str'
'!TYPECHECKPARAM'($P0, code)
- unless have_lang goto no_lang
- 'die'('Lanuage parameter to eval unimplemented.')
- no_lang:
-
.local pmc compiler, invokable
.local pmc res, exception
+ unless have_lang goto no_lang
+ push_eh catch
+ $S0 = lang
+ $S0 = concat 'languages/', $S0
+ $S0 = concat $S0, '/'
+ $S1 = lang
+ $S0 = concat $S0, $S1
+ $S0 = concat $S0, '.pbc'
+ load_bytecode $S0
+ $S0 = lang
+ compiler = compreg $S0
+ goto got_lang
+ no_lang:
push_eh catch
compiler = compreg 'Perl6'
+ got_lang:
invokable = compiler.'compile'(code)
res = invokable()