| Index: test/debugger/test-api.js
|
| diff --git a/test/debugger/test-api.js b/test/debugger/test-api.js
|
| index 069f81796d74e411a169b10ac60ebbed79471bac..07f8275307ab61cc6fea33f63a2d6f65bf970532 100644
|
| --- a/test/debugger/test-api.js
|
| +++ b/test/debugger/test-api.js
|
| @@ -292,6 +292,50 @@ class DebugWrapper {
|
| this.takeReplyChecked(msgid);
|
| }
|
|
|
| + generatorScopeCount(gen) {
|
| + return %GetGeneratorScopeCount(gen);
|
| + }
|
| +
|
| + generatorScope(gen, index) {
|
| + // These indexes correspond definitions in debug-scopes.h.
|
| + const kScopeDetailsTypeIndex = 0;
|
| + const kScopeDetailsObjectIndex = 1;
|
| +
|
| + const details = %GetGeneratorScopeDetails(gen, index);
|
| +
|
| + function scopeObjectProperties() {
|
| + const obj = details[kScopeDetailsObjectIndex];
|
| + return Object.keys(obj).map((k, v) => v);
|
| + }
|
| +
|
| + function setScopeVariableValue(name, value) {
|
| + const res = %SetScopeVariableValue(gen, null, null, index, name, value);
|
| + if (!res) throw new Error("Failed to set variable value");
|
| + }
|
| +
|
| + const scopeObject =
|
| + { value : () => details[kScopeDetailsObjectIndex],
|
| + property : (prop) => details[kScopeDetailsObjectIndex][prop],
|
| + properties : scopeObjectProperties,
|
| + propertyNames : () => Object.keys(details[kScopeDetailsObjectIndex])
|
| + .map((key, _) => key),
|
| + };
|
| + return { scopeType : () => details[kScopeDetailsTypeIndex],
|
| + scopeIndex : () => index,
|
| + scopeObject : () => scopeObject,
|
| + setVariableValue : setScopeVariableValue,
|
| + }
|
| + }
|
| +
|
| + generatorScopes(gen) {
|
| + const count = %GetGeneratorScopeCount(gen);
|
| + const scopes = [];
|
| + for (let i = 0; i < count; i++) {
|
| + scopes.push(this.generatorScope(gen, i));
|
| + }
|
| + return scopes;
|
| + }
|
| +
|
| get LiveEdit() {
|
| const debugContext = %GetDebugContext();
|
| return debugContext.Debug.LiveEdit;
|
|
|