Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
make Niecz::Compiler use named arguments
  • Loading branch information
pmurias committed Jan 2, 2011
1 parent 8f0056c commit eb2e337
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion niecza
Expand Up @@ -23,6 +23,6 @@ my $compiler = Niecza::Compiler->new(
backend => $backend
);

$compiler->compile('1','foo.p6','file.nam');
$compiler->compile(source=>'1',filename=>'foo.p6',output=>'file.nam');


6 changes: 3 additions & 3 deletions src/Niecza/Compiler.pm
Expand Up @@ -4,11 +4,11 @@ has frontend => (is=>'ro');
has passes => (is=>'ro');
has backend => (is=>'ro');
sub compile {
my ($self,$input,$filename,$output) = @_;
my $ast = $self->frontend->parse($input,$filename);
my ($self,%args) = @_;
my $ast = $self->frontend->parse($args{source},$args{filename});
for my $pass (@{$self->passes}) {
$ast = $pass->invoke($ast);
}
$self->backend->compile($ast,$output);
$self->backend->compile($ast,$args{output});
}
1;

0 comments on commit eb2e337

Please sign in to comment.