/** * Get a parent scope. * * @return the parent scope, or <code>null</code>. * @since 0.26 */ public DebugScope getParent() { verifyValidState(); if (parent == null && iterator.hasNext()) { parent = new DebugScope(iterator.next(), iterator, debugger, event, frame, root, language); } return parent; }
/** * Get a parent scope. * * @return the parent scope, or <code>null</code>. * @throws DebugException when guest language code throws an exception * @since 0.26 */ public DebugScope getParent() throws DebugException { verifyValidState(); try { if (parent == null && iterator.hasNext()) { parent = new DebugScope(iterator.next(), iterator, session, event, frame, root, language); } } catch (ThreadDeath td) { throw td; } catch (Throwable ex) { throw new DebugException(session, ex, language, null, true, null); } return parent; }
/** * Returns a language top scope. The top scopes have global validity and unlike * {@link DebugStackFrame#getScope()} have no relation to the suspended location. * * @since 0.30 */ public DebugScope getTopScope(String languageId) { LanguageInfo info = debugger.getEnv().getLanguages().get(languageId); if (info == null) { return null; } Iterable<Scope> scopes = debugger.getEnv().findTopScopes(languageId); Iterator<Scope> it = scopes.iterator(); if (!it.hasNext()) { return null; } return new DebugScope(it.next(), it, debugger, info); }
/** * Returns a language top scope. The top scopes have global validity and unlike * {@link DebugStackFrame#getScope()} have no relation to the suspended location. * * @throws DebugException when guest language code throws an exception * @since 0.30 */ public DebugScope getTopScope(String languageId) throws DebugException { LanguageInfo info = debugger.getEnv().getLanguages().get(languageId); if (info == null) { return null; } try { Iterable<Scope> scopes = debugger.getEnv().findTopScopes(languageId); Iterator<Scope> it = scopes.iterator(); if (!it.hasNext()) { return null; } return new DebugScope(it.next(), it, this, info); } catch (ThreadDeath td) { throw td; } catch (Throwable ex) { throw new DebugException(this, ex, info, null, true, null); } }
/** * Get the current inner-most scope. The scope might not provide valid information if the * execution path diverges from this trace element. * * @return the scope, or <code>null</code> when no language is associated with this frame * location, or when no local scope exists. * @since 1.0 */ public DebugScope getScope() { Node node = traceElement.getLocation(); if (node == null) { return null; } RootNode root = node.getRootNode(); if (root.getLanguageInfo() == null) { // no language, no scopes return null; } Frame elementFrame = traceElement.getFrame(); MaterializedFrame frame = (elementFrame != null) ? elementFrame.materialize() : null; Iterable<Scope> scopes = session.getDebugger().getEnv().findLocalScopes(node, frame); Iterator<Scope> it = scopes.iterator(); if (!it.hasNext()) { return null; } return new DebugScope(it.next(), it, session, null, frame, root); }
return null; return new DebugScope(it.next(), it, debugger, event, frame, root);
return null; return new DebugScope(it.next(), it, session, event, frame, root); } catch (ThreadDeath td) { throw td;