+++ /dev/null
-// Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL]
-package org.ibex.js;
-
-/**
- * This class encapsulates a single trap placed on a given node. The
- * traps for a given property name on a given box are maintained as a
- * linked list stack, with the most recently placed trap at the head
- * of the list.
- */
-final class Trap {
-
- final JS target; ///< the box on which this trap was placed
- final JS key; ///< the property that the trap was placed on
-
- final JSFunction f; ///< the function for this trap
- Trap next; ///< the next trap down the trap stack
-
- Trap(JS b, JS n, JSFunction f, Trap nx) {
- target = b; key = n; this.f = f; this.next = nx;
- }
-
- boolean isReadTrap() { return f.numFormalArgs == 0; }
- boolean isWriteTrap() { return f.numFormalArgs != 0; }
- Trap readTrap() { Trap t = this; while(t!=null && t.isWriteTrap()) t = t.next; return t; }
- Trap writeTrap() { Trap t = this; while(t!=null && t.isReadTrap()) t = t.next; return t; }
- Trap nextReadTrap() { return next == null ? null : next.readTrap(); }
- Trap nextWriteTrap() { return next == null ? null : next.writeTrap(); }
-}