public int getFrameDepth() { int nframe = 0; Context cptr = this; while (!cptr.isTopLevel()) { if (cptr.getType() == Type.FUNCTION) nframe++; cptr = cptr.getParent(); } return nframe; }