Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Binder support for named parameters
  • Loading branch information
sorear committed Aug 18, 2010
1 parent c766146 commit 1ad3b55
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions CodeGen.pm
Expand Up @@ -55,6 +55,7 @@ use 5.010;
lex => [f => 'Dictionary<string,object>'],
ExecutingLine=> [m => 'Int32'],
ExecutingFile=> [m => 'String'],
ExtractNamed => [m => 'Variable'],
LexicalFind => [m => 'Variable'] },
'Niecza.FatalException' =>
{ SearchForHandler => [c => 'Void'] },
Expand Down
10 changes: 10 additions & 0 deletions Kernel.cs
Expand Up @@ -153,6 +153,16 @@ public class Frame: IP6 {
return c;
}

public Variable ExtractNamed(string n) {
Variable r;
if (named != null && named.TryGetValue(n, out r)) {
named.Remove(n);
return r;
} else {
return null;
}
}

public string GetTypeName() { return "Frame"; }
public bool IsDefined() { return true; }
public IP6 GetTypeObject() { return Kernel.CallFrameMO.typeObject; }
Expand Down
9 changes: 7 additions & 2 deletions Sig.pm
Expand Up @@ -82,9 +82,14 @@ use 5.010;

sub _named_get {
my ($self, $name, $fb) = @_;
# TODO: implement named parameters

$fb;
CgOp::letn('!v', CgOp::rawcall(CgOp::callframe, 'ExtractNamed',
CgOp::clr_string($name)),
CgOp::ternary(
CgOp::compare('!=', CgOp::null('Variable'),
CgOp::letvar('!v')),
CgOp::letvar('!v'),
$fb));
}

sub single_get {
Expand Down

0 comments on commit 1ad3b55

Please sign in to comment.