1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_DEBUG_DEBUG_SCOPE_ITERATOR_H_
6 #define V8_DEBUG_DEBUG_SCOPE_ITERATOR_H_
7 
8 #include "src/debug/debug-frames.h"
9 #include "src/debug/debug-interface.h"
10 #include "src/debug/debug-scopes.h"
11 
12 namespace v8 {
13 namespace internal {
14 
15 class DebugScopeIterator final : public debug::ScopeIterator {
16  public:
17   DebugScopeIterator(Isolate* isolate, FrameInspector* frame_inspector);
18   DebugScopeIterator(Isolate* isolate, Handle<JSFunction> function);
19   DebugScopeIterator(Isolate* isolate, Handle<JSGeneratorObject> generator);
20 
21   bool Done() override;
22   void Advance() override;
23   ScopeType GetType() override;
24   v8::Local<v8::Object> GetObject() override;
25   v8::Local<v8::Value> GetFunctionDebugName() override;
26   int GetScriptId() override;
27   bool HasLocationInfo() override;
28   debug::Location GetStartLocation() override;
29   debug::Location GetEndLocation() override;
30 
31   bool SetVariableValue(v8::Local<v8::String> name,
32                         v8::Local<v8::Value> value) override;
33 
34  private:
35   bool ShouldIgnore();
36 
37   v8::internal::ScopeIterator iterator_;
38 };
39 
40 }  // namespace internal
41 }  // namespace v8
42 
43 #endif  // V8_DEBUG_DEBUG_SCOPE_ITERATOR_H_
44