|
40 | 40 | */
|
41 | 41 | package com.oracle.truffle.api.debug;
|
42 | 42 |
|
43 |
| -import java.util.HashSet; |
44 | 43 | import java.util.Iterator;
|
45 |
| -import java.util.NoSuchElementException; |
46 |
| -import java.util.Set; |
47 | 44 |
|
48 | 45 | import com.oracle.truffle.api.CallTarget;
|
49 | 46 | import com.oracle.truffle.api.RootCallTarget;
|
|
78 | 75 | * @see SuspendedEvent#getTopStackFrame()
|
79 | 76 | * @since 0.17
|
80 | 77 | */
|
81 |
| -public final class DebugStackFrame implements Iterable<DebugValue> { |
| 78 | +public final class DebugStackFrame { |
82 | 79 |
|
83 | 80 | final SuspendedEvent event;
|
84 | 81 | private final FrameInstance currentFrame;
|
@@ -236,38 +233,6 @@ public DebugScope getScope() throws DebugException {
|
236 | 233 | }
|
237 | 234 | }
|
238 | 235 |
|
239 |
| - /** |
240 |
| - * Lookup a stack value with a given name. If no value is available in the current stack frame |
241 |
| - * with that name <code>null</code> is returned. Stack values are only accessible as as long as |
242 |
| - * the {@link DebugStackFrame debug stack frame} is valid. Debug stack frames are only valid as |
243 |
| - * long as the source {@link SuspendedEvent suspended event} is valid. |
244 |
| - * <p> |
245 |
| - * This method is not thread-safe and will throw an {@link IllegalStateException} if called on |
246 |
| - * another thread than it was created with. |
247 |
| - * |
248 |
| - * @param name the name of the local variable to query. |
249 |
| - * @return the value from the stack |
250 |
| - * @since 0.17 |
251 |
| - * @deprecated Use {@link #getScope()} and {@link DebugScope#getDeclaredValue(java.lang.String)} |
252 |
| - * . |
253 |
| - */ |
254 |
| - @Deprecated |
255 |
| - public DebugValue getValue(String name) { |
256 |
| - DebugScope scope = getScope(); |
257 |
| - while (scope != null) { |
258 |
| - DebugValue value = scope.getDeclaredValue(name); |
259 |
| - if (value != null) { |
260 |
| - return value; |
261 |
| - } |
262 |
| - // Search for the value up to the function root, to be compatible. |
263 |
| - if (scope.isFunctionScope()) { |
264 |
| - break; |
265 |
| - } |
266 |
| - scope = scope.getParent(); |
267 |
| - } |
268 |
| - return null; |
269 |
| - } |
270 |
| - |
271 | 236 | DebugValue wrapHeapValue(Object result) {
|
272 | 237 | LanguageInfo language;
|
273 | 238 | RootNode root = findCurrentRoot();
|
@@ -302,79 +267,6 @@ public DebugValue eval(String code) throws DebugException {
|
302 | 267 | return wrapHeapValue(result);
|
303 | 268 | }
|
304 | 269 |
|
305 |
| - /** |
306 |
| - * Returns an {@link Iterator iterator} for all stack values available in this frame. The |
307 |
| - * returned stack values remain valid as long as the current stack frame remains valid. |
308 |
| - * |
309 |
| - * <p> |
310 |
| - * This method is not thread-safe and will throw an {@link IllegalStateException} if called on |
311 |
| - * another thread than it was created with. |
312 |
| - * |
313 |
| - * @since 0.17 |
314 |
| - * @deprecated Use {@link #getScope()} and {@link DebugScope#getDeclaredValues()}. |
315 |
| - */ |
316 |
| - @Deprecated |
317 |
| - public Iterator<DebugValue> iterator() { |
318 |
| - DebugScope cscope = getScope(); |
319 |
| - // Merge non-masked variables from all scopes: |
320 |
| - return new Iterator<DebugValue>() { |
321 |
| - private DebugScope scope = cscope; |
322 |
| - private Iterator<DebugValue> variables; |
323 |
| - private DebugValue nextVar; |
324 |
| - private Set<String> names = new HashSet<>(); |
325 |
| - |
326 |
| - @Override |
327 |
| - public boolean hasNext() { |
328 |
| - if (nextVar != null) { |
329 |
| - return true; |
330 |
| - } |
331 |
| - for (;;) { |
332 |
| - if (variables == null && scope != null) { |
333 |
| - variables = scope.getDeclaredValues().iterator(); |
334 |
| - if (!variables.hasNext()) { |
335 |
| - variables = null; |
336 |
| - } |
337 |
| - if (scope.isFunctionScope()) { |
338 |
| - // Stop at the function, do not go to closures, to be compatible. |
339 |
| - scope = null; |
340 |
| - } else { |
341 |
| - scope = scope.getParent(); |
342 |
| - } |
343 |
| - if (variables == null) { |
344 |
| - continue; |
345 |
| - } |
346 |
| - } |
347 |
| - if (variables != null && variables.hasNext()) { |
348 |
| - nextVar = variables.next(); |
349 |
| - String name = nextVar.getName(); |
350 |
| - if (!names.contains(name)) { |
351 |
| - names.add(name); |
352 |
| - return true; |
353 |
| - } |
354 |
| - } else { |
355 |
| - variables = null; |
356 |
| - if (scope == null) { |
357 |
| - return false; |
358 |
| - } |
359 |
| - } |
360 |
| - } |
361 |
| - } |
362 |
| - |
363 |
| - @Override |
364 |
| - public DebugValue next() { |
365 |
| - if (nextVar == null) { |
366 |
| - hasNext(); |
367 |
| - } |
368 |
| - DebugValue var = nextVar; |
369 |
| - if (var == null) { |
370 |
| - throw new NoSuchElementException(); |
371 |
| - } |
372 |
| - nextVar = null; |
373 |
| - return var; |
374 |
| - } |
375 |
| - }; |
376 |
| - } |
377 |
| - |
378 | 270 | /**
|
379 | 271 | * @since 1.0
|
380 | 272 | */
|
|
0 commit comments