Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Unified Diff: src/mirror-debugger.js

Issue 760303002: Expose generator object internal properties via mirrors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/es6/generators-mirror.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mirror-debugger.js
diff --git a/src/mirror-debugger.js b/src/mirror-debugger.js
index bce36b821fea4e9794989d29c54e8dad3049e45d..b8878468a498b50ad7e9684b13dcd497a10cedb0 100644
--- a/src/mirror-debugger.js
+++ b/src/mirror-debugger.js
@@ -931,20 +931,28 @@ ObjectMirror.GetInternalProperties = function(value) {
case 2: kind = "values"; break;
case 3: kind = "entries"; break;
}
- var result = [];
- result.push(new InternalPropertyMirror("[[IteratorHasMore]]", details[0]));
- result.push(new InternalPropertyMirror("[[IteratorIndex]]", details[1]));
+ var result = [
+ new InternalPropertyMirror("[[IteratorHasMore]]", details[0]),
+ new InternalPropertyMirror("[[IteratorIndex]]", details[1])
+ ];
if (kind) {
result.push(new InternalPropertyMirror("[[IteratorKind]]", kind));
}
return result;
+ } else if (IS_GENERATOR(value)) {
+ return [
+ new InternalPropertyMirror("[[GeneratorStatus]]",
+ GeneratorGetStatus_(value)),
+ new InternalPropertyMirror("[[GeneratorFunction]]",
+ %GeneratorGetFunction(value)),
+ new InternalPropertyMirror("[[GeneratorReceiver]]",
+ %GeneratorGetReceiver(value))
+ ];
} else if (ObjectIsPromise(value)) {
- var result = [];
- result.push(new InternalPropertyMirror("[[PromiseStatus]]",
- PromiseGetStatus_(value)));
- result.push(new InternalPropertyMirror("[[PromiseValue]]",
- PromiseGetValue_(value)));
- return result;
+ return [
+ new InternalPropertyMirror("[[PromiseStatus]]", PromiseGetStatus_(value)),
+ new InternalPropertyMirror("[[PromiseValue]]", PromiseGetValue_(value))
+ ];
}
return [];
}
@@ -1443,11 +1451,16 @@ function GeneratorMirror(value) {
inherits(GeneratorMirror, ObjectMirror);
-GeneratorMirror.prototype.status = function() {
- var continuation = %GeneratorGetContinuation(this.value_);
+function GeneratorGetStatus_(value) {
+ var continuation = %GeneratorGetContinuation(value);
if (continuation < 0) return "running";
if (continuation == 0) return "closed";
return "suspended";
+}
+
+
+GeneratorMirror.prototype.status = function() {
+ return GeneratorGetStatus_(this.value_);
};
« no previous file with comments | « no previous file | test/mjsunit/es6/generators-mirror.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698