Index: src/inspector/debugger-script.js |
diff --git a/src/inspector/debugger-script.js b/src/inspector/debugger-script.js |
index 9eedd48ec0cd489b334494bff474c72d8e5a6557..5b98d152e15cb009c0ada130287cf648f8324ed6 100644 |
--- a/src/inspector/debugger-script.js |
+++ b/src/inspector/debugger-script.js |
@@ -72,6 +72,34 @@ DebuggerScript.getFunctionScopes = function(fun) |
} |
/** |
+ * @param {Object} gen |
+ * @return {?Array<!Scope>} |
+ */ |
+DebuggerScript.getGeneratorScopes = function(gen) |
+{ |
+ var mirror = MakeMirror(gen); |
+ if (!mirror.isGenerator()) |
+ return null; |
+ var generatorMirror = /** @type {!GeneratorMirror} */(mirror); |
+ var count = generatorMirror.scopeCount(); |
+ if (count == 0) |
+ return null; |
+ var result = []; |
+ for (var i = 0; i < count; i++) { |
+ var scopeDetails = generatorMirror.scope(i).details(); |
+ var scopeObject = DebuggerScript._buildScopeObject(scopeDetails.type(), scopeDetails.object()); |
+ if (!scopeObject) |
+ continue; |
+ result.push({ |
+ type: /** @type {string} */(DebuggerScript._scopeTypeNames.get(scopeDetails.type())), |
+ object: scopeObject, |
+ name: scopeDetails.name() || "" |
+ }); |
+ } |
+ return result; |
+} |
+ |
+/** |
* @param {Object} object |
* @return {?RawLocation} |
*/ |