+ if (t == null) { target = ts.t.trapee; key = ts.t.name; }
+
+ } else if (target instanceof Trap.TrapScope && key.equals(((Trap.TrapScope)target).t.name)) {
+ throw je("tried to put to " + key + " inside a trap it owns; use cascade instead");
+
+ } else if (target instanceof JS) {
+ if (target instanceof JSScope) {
+ JSScope p = (JSScope)target; // search the scope-path for the trap
+ t = p.getTrap(key);
+ while (t == null && p.getParentScope() != null) { p = p.getParentScope(); t = p.getTrap(key); }
+ } else {
+ t = ((JS)target).getTrap(key);
+ }
+
+ while (t != null && t.f.numFormalArgs == 0) t = t.next; // find the first write trap
+ if (t != null) {
+ stack.push(new CallMarker(this));
+ JSArray args = new JSArray();
+ args.addElement(val);
+ stack.push(args);
+ }