| Index: src/mirror-debugger.js
|
| diff --git a/src/mirror-debugger.js b/src/mirror-debugger.js
|
| index 124347b7bd5b72cd7a977750b91a2d608aa951e2..2695e019f1c1eace947cc1c8ea5ff3e73ec5833a 100644
|
| --- a/src/mirror-debugger.js
|
| +++ b/src/mirror-debugger.js
|
| @@ -68,6 +68,8 @@ function MakeMirror(value, opt_transient) {
|
| mirror = new NumberMirror(value);
|
| } else if (IS_STRING(value)) {
|
| mirror = new StringMirror(value);
|
| + } else if (IS_SYMBOL(value)) {
|
| + mirror = new SymbolMirror(value);
|
| } else if (IS_ARRAY(value)) {
|
| mirror = new ArrayMirror(value);
|
| } else if (IS_DATE(value)) {
|
| @@ -141,6 +143,7 @@ var NULL_TYPE = 'null';
|
| var BOOLEAN_TYPE = 'boolean';
|
| var NUMBER_TYPE = 'number';
|
| var STRING_TYPE = 'string';
|
| +var SYMBOL_TYPE = 'symbol';
|
| var OBJECT_TYPE = 'object';
|
| var FUNCTION_TYPE = 'function';
|
| var REGEXP_TYPE = 'regexp';
|
| @@ -198,6 +201,7 @@ var ScopeType = { Global: 0,
|
| // - NullMirror
|
| // - NumberMirror
|
| // - StringMirror
|
| +// - SymbolMirror
|
| // - ObjectMirror
|
| // - FunctionMirror
|
| // - UnresolvedFunctionMirror
|
| @@ -282,6 +286,15 @@ Mirror.prototype.isString = function() {
|
|
|
|
|
| /**
|
| + * Check whether the mirror reflects a symbol.
|
| + * @returns {boolean} True if the mirror reflects a symbol
|
| + */
|
| +Mirror.prototype.isSymbol = function() {
|
| + return this instanceof SymbolMirror;
|
| +};
|
| +
|
| +
|
| +/**
|
| * Check whether the mirror reflects an object.
|
| * @returns {boolean} True if the mirror reflects an object
|
| */
|
| @@ -466,7 +479,8 @@ ValueMirror.prototype.isPrimitive = function() {
|
| type === 'null' ||
|
| type === 'boolean' ||
|
| type === 'number' ||
|
| - type === 'string';
|
| + type === 'string' ||
|
| + type === 'symbol';
|
| };
|
|
|
|
|
| @@ -575,6 +589,28 @@ StringMirror.prototype.toText = function() {
|
|
|
|
|
| /**
|
| + * Mirror object for a Symbol
|
| + * @param {Object} value The Symbol
|
| + * @constructor
|
| + * @extends Mirror
|
| + */
|
| +function SymbolMirror(value) {
|
| + %_CallFunction(this, SYMBOL_TYPE, value, ValueMirror);
|
| +}
|
| +inherits(SymbolMirror, ValueMirror);
|
| +
|
| +
|
| +SymbolMirror.prototype.description = function() {
|
| + return %SymbolDescription(%_ValueOf(this.value_));
|
| +}
|
| +
|
| +
|
| +SymbolMirror.prototype.toText = function() {
|
| + return %_CallFunction(this.value_, builtins.SymbolToString);
|
| +}
|
| +
|
| +
|
| +/**
|
| * Mirror object for objects.
|
| * @param {object} value The object reflected by this mirror
|
| * @param {boolean} transient indicate whether this object is transient with a
|
| @@ -1184,9 +1220,9 @@ ErrorMirror.prototype.toText = function() {
|
|
|
| /**
|
| * Mirror object for a Promise object.
|
| - * @param {Object} data The Promise object
|
| + * @param {Object} value The Promise object
|
| * @constructor
|
| - * @extends Mirror
|
| + * @extends ObjectMirror
|
| */
|
| function PromiseMirror(value) {
|
| %_CallFunction(this, value, PROMISE_TYPE, ObjectMirror);
|
| @@ -2318,6 +2354,9 @@ JSONProtocolSerializer.prototype.serializeReferenceWithDisplayData_ =
|
| case STRING_TYPE:
|
| o.value = mirror.getTruncatedValue(this.maxStringLength_());
|
| break;
|
| + case SYMBOL_TYPE:
|
| + o.description = mirror.description();
|
| + break;
|
| case FUNCTION_TYPE:
|
| o.name = mirror.name();
|
| o.inferredName = mirror.inferredName();
|
| @@ -2392,6 +2431,10 @@ JSONProtocolSerializer.prototype.serialize_ = function(mirror, reference,
|
| content.length = mirror.length();
|
| break;
|
|
|
| + case SYMBOL_TYPE:
|
| + content.description = mirror.description();
|
| + break;
|
| +
|
| case OBJECT_TYPE:
|
| case FUNCTION_TYPE:
|
| case ERROR_TYPE:
|
|
|