Permalink
Browse files

[HLL::Compiler] validate --target cli arg

  • Loading branch information...
1 parent 5134a59 commit 17d1cc6ebb20b433831e364530385d69cd3da66b @felliott committed Jul 23, 2011
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/HLL/Compiler.pm
View
@@ -305,6 +305,7 @@ class HLL::Compiler {
self.version if %adverbs<version>;
self.show-config if %adverbs<show-config>;
self.nqpevent(%adverbs<nqpevent>) if %adverbs<nqpevent>;
+ self.validate_target(%adverbs<target>) if (%adverbs<target>);
pir::load_bytecode('dumper.pbc');
pir::load_bytecode('PGE/Dumper.pbc');
@@ -457,6 +458,17 @@ class HLL::Compiler {
}
}
+ method validate_target($target) {
+ my $seen := 0;
+ for @!stages {
+ if $_ eq $target {
+ $seen := 1;
+ last;
+ }
+ }
+ self.panic("\"$target\" is not a valid target") unless $seen;
+ }
+
method usage($name?) {
if $name {
say($name);

0 comments on commit 17d1cc6

Please sign in to comment.