Skip to content

Commit

Permalink
fix arg usage for [set]
Browse files Browse the repository at this point in the history
  • Loading branch information
coke committed Dec 19, 2009
1 parent 3e3f9be commit 433bbeb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Partcl/commands/main.pm
Expand Up @@ -21,7 +21,7 @@ our sub append(*@args) {
set($var, $result);
}

our sub apply(*@apply) {
our sub apply(*@args) {
return '';
}

Expand Down Expand Up @@ -458,14 +458,19 @@ INIT {
GLOBAL::return := -> $result = '' { return $result; }
}

our sub set($varname, $value?) {
our sub set(*@args) {
if +@args < 1 || +@args > 2 {
error('wrong # args: should be "set varName ?newValue?"');
}
my $varname := @args[0];
my $var :=
Q:PIR {
.local pmc varname, lexpad
varname = find_lex '$varname'
lexpad = find_dynamic_lex '%LEXPAD'
%r = vivify lexpad, varname, ['Undef']
};
my $value := @args[1];
if pir::defined($value) {
pir::copy__0PP($var, $value)
} elsif ! pir::defined($var) {
Expand Down

0 comments on commit 433bbeb

Please sign in to comment.