- Timestamp:
- 11/05/08 20:49:14 (2 months ago)
- Location:
- v6/mildew
- Files:
-
- 2 modified
-
mildew (modified) (10 diffs)
-
src/AST.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
v6/mildew/mildew
r22887 r22888 15 15 use Getopt::Long; 16 16 use Carp 'confess'; 17 use Scalar::Util qw(blessed); 17 18 18 19 my ($desugar,$debug,$file,$exec); … … 41 42 } 42 43 43 sub VAST::ws::emit_m0ld {} 44 sub VAST::ws::emit_m0ld { 45 my $m = shift; 46 ( map { 47 warn ' extracting '.$_.' from ws '; 48 $m->{$_}->emit_m0ld 49 } grep { blessed $m->{$_} } keys %{$m} ), 50 ( map { 51 warn ' extracting '.ref($_).' from ws '; 52 $_->emit_m0ld 53 } map { @{$m->{$_}} } grep { ref $m->{$_} eq 'ARRAY' } keys %{$m} ), 54 } 44 55 45 56 sub VAST::longname::canonical { … … 78 89 ), 79 90 ); 91 } else { 92 XXX; 80 93 } 94 } else { 95 XXX; 81 96 } 82 97 } else { … … 121 136 if ($name->{morename} and !$name->{identifier}) { 122 137 lookup join '',map {$_->{identifier}[0]{TEXT}} @{$name->{morename}}; 123 124 } 138 } else { 139 XXX; 140 } 141 } else { 142 XXX; 125 143 } 126 144 } … … 205 223 sub VAST::sublongname::canonical { 206 224 my $m = shift; 225 XXX; 207 226 } 208 227 sub varname { … … 227 246 sub VAST::Comma::emit_m0ld { 228 247 my $m = shift; 229 map {$_->emit_m0ld} @{$m->{list}}; 248 AST::List->new( 249 elements => [ map {$_->emit_m0ld} @{$m->{list}} ] 250 ); 230 251 } 231 252 sub VAST::nulltermish::emit_m0ld { … … 238 259 if (my $methodop = $m->{dottyop}{methodop}) { 239 260 if ($methodop->{longname}) { 240 my $positional = $methodop->{semilist}[0]{statement}[0]; 241 my @positional = $positional ? $positional->emit_m0ld : (); 261 my $positional = [ map { map { $_->emit_m0ld } @{$_->{statement}} } @{$methodop->{semilist}} ]; 242 262 my $ident = $methodop->{longname}->canonical; 243 263 if ($m->{sym} eq '^!') { … … 246 266 AST::Call->new( 247 267 identifier=>string $ident, 248 capture=>AST::Capture->new(invocant=>FETCH($noun),positional=> [@positional]),268 capture=>AST::Capture->new(invocant=>FETCH($noun),positional=>$positional), 249 269 ); 250 270 } else { … … 253 273 } elsif (my $postop = $m->{dottyop}{postop}) { 254 274 if (my $postcircumfix = $postop->{postcircumfix}) { 255 my $positional = $methodop->{semilist}[0]{statement}[0]; 256 my @positional = $positional ? $positional->emit_m0ld : (); 275 my $positional = [ map { map { $_->emit_m0ld } @{$_->{statement}} } @{$methodop->{semilist}} ]; 257 276 AST::Call->new( 258 277 identifier => string 'postcircumfix:'.$postcircumfix->{FIRST}.' '.$postcircumfix->{LAST}, 259 capture => AST::Capture->new(invocant=>FETCH($noun),positional=> [@positional]),278 capture => AST::Capture->new(invocant=>FETCH($noun),positional=>$positional), 260 279 ); 261 280 } else { … … 294 313 sub VAST::Methodcall::emit_m0ld { 295 314 my $m = shift; 296 $m->{ arg}->emit_m0ld;315 $m->{dotty}->emit_m0ld($m->{arg}{noun}->emit_m0ld); 297 316 } 298 317 sub VAST::List_assignment::emit_m0ld { -
v6/mildew/src/AST.pm
r22887 r22888 1 1 { 2 2 package AST; 3 use utf8; 3 4 my $id=0; 4 5 sub unique_id { … … 94 95 has 'identifier'; 95 96 has 'stmt'; 97 98 package AST::List; 99 use Moose; 100 extends 'AST::Base'; 101 has 'elements' => (is=>'ro'); 102 103 sub m0ld { 104 my ($self, $ret) = @_; 105 my @args; 106 my $code; 107 for (@{$self->elements}) { 108 my $id = AST::unique_id(); 109 $code .= $_->m0ld($id); 110 push @args, $id; 111 } 112 $code .= 'my '.$ret.' = ?SMOP__S1P__List."new"('.join(',',@args).');'.$/; 113 } 96 114 97 115 package AST::Named;
