Index: microsoft.scripting/Runtime/CodeContext.cs
===================================================================
--- microsoft.scripting/Runtime/CodeContext.cs	(revision 76)
+++ microsoft.scripting/Runtime/CodeContext.cs	(working copy)
@@ -76,6 +76,11 @@
             : this(scope, languageContext, null) {
         }
 
+        public CodeContext(Scope scope, LanguageContext languageContext, ScopeExtension moduleContext, CodeContext parent)
+            : this(scope, languageContext, moduleContext) {
+            _parent = parent;
+        }
+
         public CodeContext(Scope scope, LanguageContext languageContext, ScopeExtension moduleContext) {
             Assert.NotNull(scope, languageContext);
 
Index: microsoft.scripting/Runtime/RuntimeHelpers.cs
===================================================================
--- microsoft.scripting/Runtime/RuntimeHelpers.cs	(revision 76)
+++ microsoft.scripting/Runtime/RuntimeHelpers.cs	(working copy)
@@ -243,7 +243,7 @@
         // The locals dictionary must be first so that we have the benefit of an emtpy stack when we emit the value
         // in the ScopeExpression
         public static CodeContext CreateNestedCodeContext(IAttributesCollection locals, CodeContext context, bool visible) {
-            return new CodeContext(new Scope(context.LanguageContext, context.Scope, locals, visible), context.LanguageContext, context.ModuleContext);
+            return new CodeContext(new Scope(context.LanguageContext, context.Scope, locals, visible), context.LanguageContext, context.ModuleContext, context);
         }
 
         // TODO: hack for Ruby, will be improved later
