Index: lib/Parrot/Pmc2c.pm =================================================================== --- lib/Parrot/Pmc2c.pm (revision 13316) +++ lib/Parrot/Pmc2c.pm (working copy) @@ -951,23 +951,27 @@ $class_init_code EOC + $cout .= <<"EOC"; + { +EOC + # declare auxiliary variables for dyncpmc IDs foreach my $dynpmc (keys %init_mmds) { next if $dynpmc eq $classname; $cout .= <<"EOC"; - int my_enum_class_$dynpmc = pmc_type(interp, string_from_const_cstring(interp, "$dynpmc", 0)); + int my_enum_class_$dynpmc = pmc_type(interp, string_from_const_cstring(interp, "$dynpmc", 0)); EOC } # init MMD "right" slots with the dynpmc types foreach my $entry (@init_mmds) { if ($entry->[1] eq $classname) { $cout .= <<"EOC"; - _temp_mmd_init[$entry->[0]].right = entry; + _temp_mmd_init[$entry->[0]].right = entry; EOC } else { $cout .= <<"EOC"; - _temp_mmd_init[$entry->[0]].right = my_enum_class_$entry->[1]; + _temp_mmd_init[$entry->[0]].right = my_enum_class_$entry->[1]; EOC } } @@ -975,18 +979,19 @@ foreach my $dynpmc (keys %init_mmds) { next if $dynpmc eq $classname; $cout .= <<"EOC"; - assert(my_enum_class_$dynpmc != enum_class_default); + assert(my_enum_class_$dynpmc != enum_class_default); EOC } if (scalar @mmds) { $cout .= <<"EOC"; #define N_MMD_INIT (sizeof(_temp_mmd_init)/sizeof(_temp_mmd_init[0])) - Parrot_mmd_register_table(interp, entry, - _temp_mmd_init, N_MMD_INIT); + Parrot_mmd_register_table(interp, entry, + _temp_mmd_init, N_MMD_INIT); EOC } $cout .= <<"EOC"; + } } /* pass */ } /* Parrot_${classname}_class_init */ EOC