Skip to content

Commit

Permalink
[dotnet] Fix a silly (used static block object instead of dynamic one…
Browse files Browse the repository at this point in the history
… always) and get our outer from the set one, and we have sufficiently working closures to pass a (modified to avoid NYI return) 48-closure.t.
  • Loading branch information
jnthn committed Oct 29, 2010
1 parent 13a72ce commit c04f22c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dotnet/compiler/PAST2DNSTCompiler.pm
Expand Up @@ -354,7 +354,7 @@ our multi sub dnst_for(PAST::Block $block) {
# Wrap in block prelude/postlude.
$result.push(DNST::Temp.new(
:name('C'), :type('Context'),
DNST::New.new( :type('Context'), "StaticBlockInfo[$our_sbi]", "TC.CurrentContext", "Capture" )
DNST::New.new( :type('Context'), "Block", "TC.CurrentContext", "Capture" )
));
$result.push(DNST::Bind.new( 'TC.CurrentContext', 'C' ));
$result.push(DNST::TryFinally.new(
Expand Down
13 changes: 9 additions & 4 deletions dotnet/runtime/Runtime/Context.cs
Expand Up @@ -50,9 +50,10 @@ public Context()
/// </summary>
/// <param name="StaticCodeObject"></param>
/// <param name="Caller"></param>
public Context(RakudoCodeRef.Instance StaticCodeObject, Context Caller, RakudoObject Capture)
public Context(RakudoObject StaticCodeObject_Uncast, Context Caller, RakudoObject Capture)
{
// Set up static code object and caller pointers.
var StaticCodeObject = (RakudoCodeRef.Instance)StaticCodeObject_Uncast;
this.StaticCodeObject = StaticCodeObject;
this.Caller = Caller;
this.Capture = Capture;
Expand All @@ -69,16 +70,20 @@ public Context(RakudoCodeRef.Instance StaticCodeObject, Context Caller, RakudoOb
this.LexPad.Storage = (RakudoObject[])StaticCodeObject.StaticLexPad.Storage.Clone();

// Set outer context.
var OuterBlock = StaticCodeObject.OuterBlock;
if (OuterBlock.CurrentContext != null)
if (StaticCodeObject.OuterForNextInvocation != null)
{
this.Outer = OuterBlock.CurrentContext;
this.Outer = StaticCodeObject.OuterForNextInvocation;
}
else if (StaticCodeObject.OuterBlock.CurrentContext != null)
{
this.Outer = StaticCodeObject.OuterBlock.CurrentContext;
}
else
{
// Auto-close. In this we go setting up fake contexts
// that use the static lexpad until we find a real one.
var CurContext = this;
var OuterBlock = StaticCodeObject.OuterBlock;
while (OuterBlock != null)
{
// If we found a block with a context, we're done.
Expand Down

0 comments on commit c04f22c

Please sign in to comment.