2003/06/07 09:37:13
[org.ibex.core.git] / src / org / xwt / js / ForthBlock.java
index f1f1e0a..0cc4ed2 100644 (file)
@@ -38,14 +38,7 @@ class ForthBlock implements OpCodes, Tokens {
            case LITERAL: t.push(arg[i]); break;
            case OBJECT: t.push(new JS.Obj()); break;
            case ARRAY: t.push(new JS.Array(JS.toNumber(arg[i]).intValue())); break;
-           case DECLARE: {
-               String st = (String)t.pop();
-               if (st.equals("sel")) {
-                   System.out.println("**** SEL!");
-                   for(int j=0; j<4; j++) System.out.println(op[i+j] + " " + arg[i+j]);
-               }
-               s.declare(st); break;
-           }
+           case DECLARE: s.declare((String)t.pop()); break;
            case THIS: t.push(s); break;   // FIXME: transparents
            case JT: if (JS.toBoolean(t.pop())) i += JS.toNumber(arg[i]).intValue() - 1; break;
            case JF: if (!JS.toBoolean(t.pop())) i += JS.toNumber(arg[i]).intValue() - 1; break;
@@ -108,7 +101,9 @@ class ForthBlock implements OpCodes, Tokens {
            case PUT: {
                Object val = t.pop();
                Object key = t.pop();
-               ((JS)t.peek()).put(key, val);
+               JS target = (JS)t.peek();
+               if (target == null) throw new JS.Exn("tried to put a value to the " + key + " property on the null value");
+               target.put(key, val);
                t.push(val);
                break;
            }