From 7af2d6820230e0007fecb7365d45c4f8c4e0f573 Mon Sep 17 00:00:00 2001 From: sorear Date: Wed, 26 May 2010 19:20:46 +0000 Subject: [PATCH] [viv] Store generated class information in compiled files git-svn-id: http://svn.pugscode.org/pugs@30820 c213334d-75ef-0310-aa23-eaa082d1ae64 --- Actions.pm | 2 ++ viv | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Actions.pm b/Actions.pm index a515c7d..358a99a 100644 --- a/Actions.pm +++ b/Actions.pm @@ -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; } diff --git a/viv b/viv index bfe0961..30cc48b 100755 --- a/viv +++ b/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";