Author: pmichaud
Date: Fri Jan 2 14:59:57 2009
New Revision: 34839
Modified:
trunk/compilers/pge/PGE/Exp.pir
trunk/runtime/parrot/library/PGE/Perl6Grammar.pir
Log:
[pge]: Use P6object 'get_proto' method to skip creating a class if it
already exists.
Modified: trunk/compilers/pge/PGE/Exp.pir
==============================================================================
--- trunk/compilers/pge/PGE/Exp.pir (original)
+++ trunk/compilers/pge/PGE/Exp.pir Fri Jan 2 14:59:57 2009
@@ -94,9 +94,11 @@
$P1 = $P0(code)
make_grammar:
if grammar == '' goto end
- push_eh end
- $P0 = get_hll_global 'P6metaclass'
- $P0.'new_class'(grammar, 'parent'=>'PGE::Grammar')
+ .local pmc p6meta
+ p6meta = get_hll_global 'P6metaclass'
+ $P0 = p6meta.'get_proto'(grammar)
+ unless null $P0 goto end
+ $P0 = p6meta.'new_class'(grammar, 'parent'=>'PGE::Grammar')
end:
.return ($P1)
Modified: trunk/runtime/parrot/library/PGE/Perl6Grammar.pir
==============================================================================
--- trunk/runtime/parrot/library/PGE/Perl6Grammar.pir (original)
+++ trunk/runtime/parrot/library/PGE/Perl6Grammar.pir Fri Jan 2 14:59:57 2009
@@ -183,12 +183,12 @@
$S0 = initpir.'unique'('onload_')
initpir.'emit'(<<' CODE', namespace, inherit, $S0)
## namespace %0
- push_eh %2
.local pmc p6meta
p6meta = get_hll_global 'P6metaclass'
+ $P0 = p6meta.'get_proto'('%0')
+ unless null $P0 goto %2
p6meta.'new_class'('%0', 'parent'=>'%1')
%2:
- pop_eh
CODE
ns_optable:
$P0 = ns['optable']