From afb4abf4a2c2ea114cd37e96263f09b48c657624 Mon Sep 17 00:00:00 2001 From: Jonathan Worthington Date: Tue, 24 Aug 2010 02:54:03 +0200 Subject: [PATCH] Bind parameters into the lexpad using a positional index rather than a hash index. Wins us a bit. :-) --- dotnet/runtime/Runtime/Signatures/Parameter.cs | 8 +++++++- dotnet/runtime/Runtime/Signatures/SignatureBinder.cs | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dotnet/runtime/Runtime/Signatures/Parameter.cs b/dotnet/runtime/Runtime/Signatures/Parameter.cs index 5724faa..af2d575 100644 --- a/dotnet/runtime/Runtime/Signatures/Parameter.cs +++ b/dotnet/runtime/Runtime/Signatures/Parameter.cs @@ -18,10 +18,11 @@ public class Parameter /// /// /// - public Parameter(RakudoObject Type, string VariableName, string Name, int Flags) + public Parameter(RakudoObject Type, string VariableName, int VariableLexpadPosition, string Name, int Flags) { this.Type = Type; this.VariableName = VariableName; + this.VariableLexpadPosition = VariableLexpadPosition; this.Name = Name; this.Flags = Flags; } @@ -36,6 +37,11 @@ public Parameter(RakudoObject Type, string VariableName, string Name, int Flags) /// public string VariableName; + /// + /// The position in the lexpad where the variable will be stored. + /// + public int VariableLexpadPosition; + /// /// Name, for named parameters. /// diff --git a/dotnet/runtime/Runtime/Signatures/SignatureBinder.cs b/dotnet/runtime/Runtime/Signatures/SignatureBinder.cs index ce8e7c9..722ae3f 100644 --- a/dotnet/runtime/Runtime/Signatures/SignatureBinder.cs +++ b/dotnet/runtime/Runtime/Signatures/SignatureBinder.cs @@ -67,7 +67,7 @@ public static void Bind(Context C, RakudoObject Capture) if (CurPositional < Positionals.Length) { // We have an argument, just bind it. - Target.SetByName(Param.VariableName, Positionals[CurPositional]); + Target.Storage[Param.VariableLexpadPosition] = Positionals[CurPositional]; } else { @@ -86,7 +86,7 @@ public static void Bind(Context C, RakudoObject Capture) if (CurPositional < Positionals.Length) { // We have an argument, just bind it. - Target.SetByName(Param.VariableName, Positionals[CurPositional]); + Target.Storage[Param.VariableLexpadPosition] = Positionals[CurPositional]; } else { @@ -117,7 +117,7 @@ public static void Bind(Context C, RakudoObject Capture) if (Nameds.TryGetValue(Param.Name, out Value)) { // We have an argument, just bind it. - Target.SetByName(Param.VariableName, Value); + Target.Storage[Param.VariableLexpadPosition] = Value; } else {