Permalink
Browse files

Improve dynamic variable handling to hopefully fix eval, Coke++

  • Loading branch information...
1 parent f4918b8 commit dbbc6c720efb7df6f28cb80cadc2621b46cbabda @sorear committed Nov 26, 2012
Showing with 10 additions and 3 deletions.
  1. +10 −3 lib/Kernel.cs
View
@@ -6152,6 +6152,7 @@ class LastFrameNode {
}
internal static void SetupThreadParent(Frame f) {
rlstack = new LastFrameNode();
+ rlstack.compartment = f.info.setting;
rlstack.cur = f;
}
public static Frame GetTopFrame() {
@@ -6167,9 +6168,15 @@ class LastFrameNode {
if (lfn.next == null) {
lfn.next = new LastFrameNode() { compartment = s, prev = lfn };
}
- Frame l = lfn.cur;
- if (lfn.compartment != s)
- l = null; // hide other objects
+ Frame l = null;
+ // use the topmost frame from the same compartment
+ for (LastFrameNode csr = lfn; csr != null; csr = csr.prev) {
+ if (csr.compartment == s) {
+ l = csr.cur;
+ break;
+ }
+ }
+
rlstack = lfn.next;
lfn.next.compartment = s;
return lfn.next.cur = lfn.next.root = ((l == null ?

0 comments on commit dbbc6c7

Please sign in to comment.