Permalink
Browse files

[viv] Store generated class information in compiled files

git-svn-id: http://svn.pugscode.org/pugs@30820 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent c875dc8 commit 7af2d6820230e0007fecb7365d45c4f8c4e0f573 sorear committed May 26, 2010
Showing with 7 additions and 1 deletion.
  1. +2 −0 Actions.pm
  2. +5 −1 viv
View
@@ -6,6 +6,7 @@ package Actions;
our $AUTOLOAD;
my $SEQ = 1;
+our %GENCLASS;
sub AUTOLOAD {
my $self = shift;
@@ -392,6 +393,7 @@ sub gen_class {
print STDERR "Existing class $class\n" if $OPT_log;
return;
}
+ $GENCLASS{$class} = $base;
print STDERR "Creating class $class\n" if $OPT_log;
@{$class . '::ISA'} = $base;
}
View
6 viv
@@ -103,6 +103,9 @@ sub MAIN {
my $raw = retrieve($_[0]);
$::ORIG = $raw->{ORIG};
$r = $raw->{AST};
+ for my $cl (keys %{$raw->{GENCLASS}}) {
+ Actions::gen_class($cl, $raw->{GENCLASS}->{$cl});
+ }
}
elsif (@_ and -f $_[0]) {
$r = STD->parsefile($_[0], actions => 'Actions')->{'_ast'};
@@ -137,7 +140,8 @@ sub MAIN {
print fixpod($r->ret(0,$r->emit_p5(0)));
}
elsif ($output eq 'store') {
- Storable::store_fd({ AST => $r, ORIG => $::ORIG }, \*STDOUT);
+ Storable::store_fd({ AST => $r, GENCLASS => \%Actions::GENCLASS,
+ ORIG => $::ORIG }, \*STDOUT);
}
else {
die "Unknown output mode";

0 comments on commit 7af2d68

Please sign in to comment.