Skip to content

Commit 05b7873

Browse files
committed
HLL::Compiler: Allow --target with -e
Prior to this, using --target with -e would just result in the compiler ending early with no output. Of course, this would be more useful if we taught _dumper how to deal with 6model objects. Based on a patch from chrisdolan in Parrot TT366
1 parent 763b9c5 commit 05b7873

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/HLL/Compiler.pm

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,15 +304,19 @@ class HLL::Compiler {
304304
my $result;
305305
my $error;
306306
my $has_error := 0;
307+
my $target := %adverbs<target>;
307308
try {
308309
if pir::defined(%adverbs<e>) {
309-
$result := self.eval(%adverbs<e>, '-e', |@a, |%adverbs)
310+
$result := self.eval(%adverbs<e>, '-e', |@a, |%adverbs);
311+
unless $target eq '' || $target eq 'pir' {
312+
self.dumper($result, $target, |%adverbs);
313+
}
310314
}
311315
elsif !@a { $result := self.interactive(|%adverbs) }
312316
elsif %adverbs<combine> { $result := self.evalfiles(@a, |%adverbs) }
313317
else { $result := self.evalfiles(@a[0], |@a, |%adverbs) }
314318

315-
if !pir::isnull($result) && %adverbs<target> eq 'pir' {
319+
if !pir::isnull($result) && $target eq 'pir' {
316320
my $output := %adverbs<output>;
317321
my $fh := ($output eq '' || $output eq '-')
318322
?? pir::getinterp__P().stdout_handle()

0 commit comments

Comments
 (0)