Index: src/mirror-debugger.js |
diff --git a/src/mirror-debugger.js b/src/mirror-debugger.js |
index 897413cfda535284fefe7b5fc2361108c20fb958..2cd991f486028a9ccbd49bfb9b855c0feec4be94 100644 |
--- a/src/mirror-debugger.js |
+++ b/src/mirror-debugger.js |
@@ -81,6 +81,8 @@ function MakeMirror(value, opt_transient) { |
mirror = new ErrorMirror(value); |
} else if (IS_SCRIPT(value)) { |
mirror = new ScriptMirror(value); |
+ } else if (IS_MAP(value) || IS_WEAKMAP(value)) { |
+ mirror = new MapMirror(value); |
} else if (ObjectIsPromise(value)) { |
mirror = new PromiseMirror(value); |
} else { |
@@ -155,6 +157,7 @@ var SCRIPT_TYPE = 'script'; |
var CONTEXT_TYPE = 'context'; |
var SCOPE_TYPE = 'scope'; |
var PROMISE_TYPE = 'promise'; |
+var MAP_TYPE = 'map'; |
// Maximum length when sending strings through the JSON protocol. |
var kMaxProtocolStringLength = 80; |
@@ -210,6 +213,7 @@ var ScopeType = { Global: 0, |
// - RegExpMirror |
// - ErrorMirror |
// - PromiseMirror |
+// - MapMirror |
// - PropertyMirror |
// - InternalPropertyMirror |
// - FrameMirror |
@@ -421,6 +425,15 @@ Mirror.prototype.isScope = function() { |
/** |
+ * Check whether the mirror reflects a map. |
+ * @returns {boolean} True if the mirror reflects a map |
+ */ |
+Mirror.prototype.isMap = function() { |
+ return this instanceof MapMirror; |
+}; |
+ |
+ |
+/** |
* Allocate a handle id for this object. |
*/ |
Mirror.prototype.allocateHandle_ = function() { |
@@ -1253,6 +1266,18 @@ PromiseMirror.prototype.promiseValue = function() { |
}; |
+function MapMirror(value) { |
+ %_CallFunction(this, value, MAP_TYPE, ObjectMirror); |
+} |
+inherits(MapMirror, ObjectMirror); |
+ |
+ |
+MapMirror.prototype.entries = function() { |
+ return IS_WEAKMAP(this.value_) ? |
+ %GetWeakMapEntries(this.value_) : %GetMapEntries(this.value_); |
+}; |
+ |
+ |
/** |
* Base mirror object for properties. |
* @param {ObjectMirror} mirror The mirror object having this property |