Skip to content
This repository was archived by the owner on Feb 3, 2021. It is now read-only.

Commit 2ac9555

Browse files
committed
Turn proccess_args into NQP.
1 parent 3a05d0d commit 2ac9555

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

src/HLL/Compiler.pm

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -415,29 +415,17 @@ class HLL::Compiler {
415415
}
416416

417417
method process_args(@args) {
418-
Q:PIR {
419-
load_bytecode 'Getopt/Obj.pbc'
420-
421-
.local pmc args
422-
args = find_lex '@args'
423-
.local string arg0
424-
arg0 = shift args
425-
self.'compiler_progname'(arg0)
426-
427-
.local pmc getopts
428-
getopts = new ['Getopt';'Obj']
429-
getopts.'notOptStop'(1)
430-
$P0 = getattribute self, '@!cmdoptions'
431-
.local pmc it
432-
it = iter $P0
433-
getopts_loop:
434-
unless it goto getopts_end
435-
$S0 = shift it
436-
push getopts, $S0
437-
goto getopts_loop
438-
getopts_end:
439-
.tailcall getopts.'get_options'(args)
440-
};
418+
# First argument is the program name.
419+
self.compiler_progname(@args.shift);
420+
421+
# Use Getopt::Obj to proccess the rest.
422+
pir::load_bytecode('Getopt/Obj.pbc');
423+
my $getopts := Q:PIR { %r = new ['Getopt';'Obj'] };
424+
$getopts.notOptStop(1);
425+
for @!cmdoptions {
426+
pir::push__vPs($getopts, $_)
427+
}
428+
$getopts.get_options(@args);
441429
}
442430

443431
method evalfiles(@files, *@args, *%adverbs) {

0 commit comments

Comments
 (0)