| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 if (mirror.value() === value) { | 60 if (mirror.value() === value) { |
| 61 return mirror; | 61 return mirror; |
| 62 } | 62 } |
| 63 // Special check for NaN as NaN == NaN is false. | 63 // Special check for NaN as NaN == NaN is false. |
| 64 if (mirror.isNumber() && isNaN(mirror.value()) && | 64 if (mirror.isNumber() && isNaN(mirror.value()) && |
| 65 typeof value == 'number' && isNaN(value)) { | 65 typeof value == 'number' && isNaN(value)) { |
| 66 return mirror; | 66 return mirror; |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 if (IS_UNDEFINED(value)) { | 71 if (IS_UNDEFINED(value)) { |
| 72 mirror = new UndefinedMirror(); | 72 mirror = new UndefinedMirror(); |
| 73 } else if (IS_NULL(value)) { | 73 } else if (IS_NULL(value)) { |
| 74 mirror = new NullMirror(); | 74 mirror = new NullMirror(); |
| 75 } else if (IS_BOOLEAN(value)) { | 75 } else if (IS_BOOLEAN(value)) { |
| 76 mirror = new BooleanMirror(value); | 76 mirror = new BooleanMirror(value); |
| 77 } else if (IS_NUMBER(value)) { | 77 } else if (IS_NUMBER(value)) { |
| 78 mirror = new NumberMirror(value); | 78 mirror = new NumberMirror(value); |
| 79 } else if (IS_STRING(value)) { | 79 } else if (IS_STRING(value)) { |
| 80 mirror = new StringMirror(value); | 80 mirror = new StringMirror(value); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 103 * Returns the mirror for a specified mirror handle. | 103 * Returns the mirror for a specified mirror handle. |
| 104 * | 104 * |
| 105 * @param {number} handle the handle to find the mirror for | 105 * @param {number} handle the handle to find the mirror for |
| 106 * @returns {Mirror or undefiend} the mirror with the requested handle or | 106 * @returns {Mirror or undefiend} the mirror with the requested handle or |
| 107 * undefined if no mirror with the requested handle was found | 107 * undefined if no mirror with the requested handle was found |
| 108 */ | 108 */ |
| 109 function LookupMirror(handle) { | 109 function LookupMirror(handle) { |
| 110 return mirror_cache_[handle]; | 110 return mirror_cache_[handle]; |
| 111 } | 111 } |
| 112 | 112 |
| 113 | 113 |
| 114 /** | 114 /** |
| 115 * Returns the mirror for the undefined value. | 115 * Returns the mirror for the undefined value. |
| 116 * | 116 * |
| 117 * @returns {Mirror} the mirror reflects the undefined value | 117 * @returns {Mirror} the mirror reflects the undefined value |
| 118 */ | 118 */ |
| 119 function GetUndefinedMirror() { | 119 function GetUndefinedMirror() { |
| 120 return MakeMirror(void 0); | 120 return MakeMirror(void 0); |
| 121 } | 121 } |
| 122 | 122 |
| 123 | 123 |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 value | 615 value |
| 616 * @return {Array} Property names for this object | 616 * @return {Array} Property names for this object |
| 617 */ | 617 */ |
| 618 ObjectMirror.prototype.propertyNames = function(kind, limit) { | 618 ObjectMirror.prototype.propertyNames = function(kind, limit) { |
| 619 // Find kind and limit and allocate array for the result | 619 // Find kind and limit and allocate array for the result |
| 620 kind = kind || PropertyKind.Named | PropertyKind.Indexed; | 620 kind = kind || PropertyKind.Named | PropertyKind.Indexed; |
| 621 | 621 |
| 622 var propertyNames; | 622 var propertyNames; |
| 623 var elementNames; | 623 var elementNames; |
| 624 var total = 0; | 624 var total = 0; |
| 625 | 625 |
| 626 // Find all the named properties. | 626 // Find all the named properties. |
| 627 if (kind & PropertyKind.Named) { | 627 if (kind & PropertyKind.Named) { |
| 628 // Get the local property names. | 628 // Get the local property names. |
| 629 propertyNames = %GetLocalPropertyNames(this.value_); | 629 propertyNames = %GetLocalPropertyNames(this.value_); |
| 630 total += propertyNames.length; | 630 total += propertyNames.length; |
| 631 | 631 |
| 632 // Get names for named interceptor properties if any. | 632 // Get names for named interceptor properties if any. |
| 633 if (this.hasNamedInterceptor() && (kind & PropertyKind.Named)) { | 633 if (this.hasNamedInterceptor() && (kind & PropertyKind.Named)) { |
| 634 var namedInterceptorNames = | 634 var namedInterceptorNames = |
| 635 %GetNamedInterceptorPropertyNames(this.value_); | 635 %GetNamedInterceptorPropertyNames(this.value_); |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 return MakeMirror(this.setter_); | 1216 return MakeMirror(this.setter_); |
| 1217 } else { | 1217 } else { |
| 1218 return GetUndefinedMirror(); | 1218 return GetUndefinedMirror(); |
| 1219 } | 1219 } |
| 1220 } | 1220 } |
| 1221 | 1221 |
| 1222 | 1222 |
| 1223 /** | 1223 /** |
| 1224 * Returns whether this property is natively implemented by the host or a set | 1224 * Returns whether this property is natively implemented by the host or a set |
| 1225 * through JavaScript code. | 1225 * through JavaScript code. |
| 1226 * @return {boolean} True if the property is | 1226 * @return {boolean} True if the property is |
| 1227 * UndefinedMirror if there is no setter for this property | 1227 * UndefinedMirror if there is no setter for this property |
| 1228 */ | 1228 */ |
| 1229 PropertyMirror.prototype.isNative = function() { | 1229 PropertyMirror.prototype.isNative = function() { |
| 1230 return (this.propertyType() == PropertyType.Interceptor) || | 1230 return (this.propertyType() == PropertyType.Interceptor) || |
| 1231 ((this.propertyType() == PropertyType.Callbacks) && | 1231 ((this.propertyType() == PropertyType.Callbacks) && |
| 1232 !this.hasGetter() && !this.hasSetter()); | 1232 !this.hasGetter() && !this.hasSetter()); |
| 1233 } | 1233 } |
| 1234 | 1234 |
| 1235 | 1235 |
| 1236 const kFrameDetailsFrameIdIndex = 0; | 1236 const kFrameDetailsFrameIdIndex = 0; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 | 1383 |
| 1384 | 1384 |
| 1385 FrameMirror.prototype.index = function() { | 1385 FrameMirror.prototype.index = function() { |
| 1386 return this.index_; | 1386 return this.index_; |
| 1387 }; | 1387 }; |
| 1388 | 1388 |
| 1389 | 1389 |
| 1390 FrameMirror.prototype.func = function() { | 1390 FrameMirror.prototype.func = function() { |
| 1391 // Get the function for this frame from the VM. | 1391 // Get the function for this frame from the VM. |
| 1392 var f = this.details_.func(); | 1392 var f = this.details_.func(); |
| 1393 | 1393 |
| 1394 // Create a function mirror. NOTE: MakeMirror cannot be used here as the | 1394 // Create a function mirror. NOTE: MakeMirror cannot be used here as the |
| 1395 // value returned from the VM might be a string if the function for the | 1395 // value returned from the VM might be a string if the function for the |
| 1396 // frame is unresolved. | 1396 // frame is unresolved. |
| 1397 if (IS_FUNCTION(f)) { | 1397 if (IS_FUNCTION(f)) { |
| 1398 return MakeMirror(f); | 1398 return MakeMirror(f); |
| 1399 } else { | 1399 } else { |
| 1400 return new UnresolvedFunctionMirror(f); | 1400 return new UnresolvedFunctionMirror(f); |
| 1401 } | 1401 } |
| 1402 }; | 1402 }; |
| 1403 | 1403 |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1818 result += this.lineOffset() + this.lineCount() - 1; | 1818 result += this.lineOffset() + this.lineCount() - 1; |
| 1819 } else { | 1819 } else { |
| 1820 result += this.lineCount(); | 1820 result += this.lineCount(); |
| 1821 } | 1821 } |
| 1822 result += ')'; | 1822 result += ')'; |
| 1823 return result; | 1823 return result; |
| 1824 } | 1824 } |
| 1825 | 1825 |
| 1826 | 1826 |
| 1827 /** | 1827 /** |
| 1828 * Returns a suggested script URL from comments in script code (if found), | 1828 * Returns a suggested script URL from comments in script code (if found), |
| 1829 * undefined otherwise. Used primarily by debuggers for identifying eval()'ed | 1829 * undefined otherwise. Used primarily by debuggers for identifying eval()'ed |
| 1830 * scripts. See | 1830 * scripts. See |
| 1831 * http://fbug.googlecode.com/svn/branches/firebug1.1/docs/ReleaseNotes_1.1.txt | 1831 * http://fbug.googlecode.com/svn/branches/firebug1.1/docs/ReleaseNotes_1.1.txt |
| 1832 * for details. | 1832 * for details. |
| 1833 * | 1833 * |
| 1834 * @return {?string} value for //@ sourceURL comment | 1834 * @return {?string} value for //@ sourceURL comment |
| 1835 */ | 1835 */ |
| 1836 ScriptMirror.prototype.sourceUrlFromComment_ = function() { | 1836 ScriptMirror.prototype.sourceUrlFromComment_ = function() { |
| 1837 if (!('sourceUrl_' in this) && this.source()) { | 1837 if (!('sourceUrl_' in this) && this.source()) { |
| 1838 // TODO(608): the spaces in a regexp below had to be escaped as \040 | 1838 // TODO(608): the spaces in a regexp below had to be escaped as \040 |
| 1839 // because this file is being processed by js2c whose handling of spaces | 1839 // because this file is being processed by js2c whose handling of spaces |
| 1840 // in regexps is broken. | 1840 // in regexps is broken. |
| 1841 // We're not using \s here to prevent \n from matching. | 1841 // We're not using \s here to prevent \n from matching. |
| 1842 var sourceUrlPattern = /\/\/@[\040\t]sourceURL=[\040\t]*(\S+)[\040\t]*$/m; | 1842 var sourceUrlPattern = /\/\/@[\040\t]sourceURL=[\040\t]*(\S+)[\040\t]*$/m; |
| 1843 var match = sourceUrlPattern.exec(this.source()); | 1843 var match = sourceUrlPattern.exec(this.source()); |
| 1844 this.sourceUrl_ = match ? match[1] : undefined; | 1844 this.sourceUrl_ = match ? match[1] : undefined; |
| 1845 } | 1845 } |
| 1846 return this.sourceUrl_; | 1846 return this.sourceUrl_; |
| 1847 }; | 1847 }; |
| 1848 | 1848 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1921 /** | 1921 /** |
| 1922 * Returns a serialization of all the objects referenced. | 1922 * Returns a serialization of all the objects referenced. |
| 1923 * | 1923 * |
| 1924 * @param {Mirror} mirror The mirror to serialize. | 1924 * @param {Mirror} mirror The mirror to serialize. |
| 1925 * @returns {Array.<Object>} Array of the referenced objects converted to | 1925 * @returns {Array.<Object>} Array of the referenced objects converted to |
| 1926 * protcol objects. | 1926 * protcol objects. |
| 1927 */ | 1927 */ |
| 1928 JSONProtocolSerializer.prototype.serializeReferencedObjects = function() { | 1928 JSONProtocolSerializer.prototype.serializeReferencedObjects = function() { |
| 1929 // Collect the protocol representation of the referenced objects in an array. | 1929 // Collect the protocol representation of the referenced objects in an array. |
| 1930 var content = []; | 1930 var content = []; |
| 1931 | 1931 |
| 1932 // Get the number of referenced objects. | 1932 // Get the number of referenced objects. |
| 1933 var count = this.mirrors_.length; | 1933 var count = this.mirrors_.length; |
| 1934 | 1934 |
| 1935 for (var i = 0; i < count; i++) { | 1935 for (var i = 0; i < count; i++) { |
| 1936 content.push(this.serialize_(this.mirrors_[i], false, false)); | 1936 content.push(this.serialize_(this.mirrors_[i], false, false)); |
| 1937 } | 1937 } |
| 1938 | 1938 |
| 1939 return content; | 1939 return content; |
| 1940 } | 1940 } |
| 1941 | 1941 |
| 1942 | 1942 |
| 1943 JSONProtocolSerializer.prototype.includeSource_ = function() { | 1943 JSONProtocolSerializer.prototype.includeSource_ = function() { |
| 1944 return this.options_ && this.options_.includeSource; | 1944 return this.options_ && this.options_.includeSource; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1959 } | 1959 } |
| 1960 | 1960 |
| 1961 | 1961 |
| 1962 JSONProtocolSerializer.prototype.add_ = function(mirror) { | 1962 JSONProtocolSerializer.prototype.add_ = function(mirror) { |
| 1963 // If this mirror is already in the list just return. | 1963 // If this mirror is already in the list just return. |
| 1964 for (var i = 0; i < this.mirrors_.length; i++) { | 1964 for (var i = 0; i < this.mirrors_.length; i++) { |
| 1965 if (this.mirrors_[i] === mirror) { | 1965 if (this.mirrors_[i] === mirror) { |
| 1966 return; | 1966 return; |
| 1967 } | 1967 } |
| 1968 } | 1968 } |
| 1969 | 1969 |
| 1970 // Add the mirror to the list of mirrors to be serialized. | 1970 // Add the mirror to the list of mirrors to be serialized. |
| 1971 this.mirrors_.push(mirror); | 1971 this.mirrors_.push(mirror); |
| 1972 } | 1972 } |
| 1973 | 1973 |
| 1974 | 1974 |
| 1975 /** | 1975 /** |
| 1976 * Formats mirror object to protocol reference object with some data that can | 1976 * Formats mirror object to protocol reference object with some data that can |
| 1977 * be used to display the value in debugger. | 1977 * be used to display the value in debugger. |
| 1978 * @param {Mirror} mirror Mirror to serialize. | 1978 * @param {Mirror} mirror Mirror to serialize. |
| 1979 * @return {Object} Protocol reference object. | 1979 * @return {Object} Protocol reference object. |
| 1980 */ | 1980 */ |
| 1981 JSONProtocolSerializer.prototype.serializeReferenceWithDisplayData_ = | 1981 JSONProtocolSerializer.prototype.serializeReferenceWithDisplayData_ = |
| 1982 function(mirror) { | 1982 function(mirror) { |
| 1983 var o = {}; | 1983 var o = {}; |
| 1984 o.ref = mirror.handle(); | 1984 o.ref = mirror.handle(); |
| 1985 o.type = mirror.type(); | 1985 o.type = mirror.type(); |
| 1986 switch (mirror.type()) { | 1986 switch (mirror.type()) { |
| 1987 case UNDEFINED_TYPE: | 1987 case UNDEFINED_TYPE: |
| 1988 case NULL_TYPE: | 1988 case NULL_TYPE: |
| 1989 case BOOLEAN_TYPE: | 1989 case BOOLEAN_TYPE: |
| 1990 case NUMBER_TYPE: | 1990 case NUMBER_TYPE: |
| 1991 o.value = mirror.value(); | 1991 o.value = mirror.value(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2018 // the mirror to the referenced mirrors. | 2018 // the mirror to the referenced mirrors. |
| 2019 if (reference && | 2019 if (reference && |
| 2020 (mirror.isValue() || mirror.isScript() || mirror.isContext())) { | 2020 (mirror.isValue() || mirror.isScript() || mirror.isContext())) { |
| 2021 if (this.inlineRefs_() && mirror.isValue()) { | 2021 if (this.inlineRefs_() && mirror.isValue()) { |
| 2022 return this.serializeReferenceWithDisplayData_(mirror); | 2022 return this.serializeReferenceWithDisplayData_(mirror); |
| 2023 } else { | 2023 } else { |
| 2024 this.add_(mirror); | 2024 this.add_(mirror); |
| 2025 return {'ref' : mirror.handle()}; | 2025 return {'ref' : mirror.handle()}; |
| 2026 } | 2026 } |
| 2027 } | 2027 } |
| 2028 | 2028 |
| 2029 // Collect the JSON property/value pairs. | 2029 // Collect the JSON property/value pairs. |
| 2030 var content = {}; | 2030 var content = {}; |
| 2031 | 2031 |
| 2032 // Add the mirror handle. | 2032 // Add the mirror handle. |
| 2033 if (mirror.isValue() || mirror.isScript() || mirror.isContext()) { | 2033 if (mirror.isValue() || mirror.isScript() || mirror.isContext()) { |
| 2034 content.handle = mirror.handle(); | 2034 content.handle = mirror.handle(); |
| 2035 } | 2035 } |
| 2036 | 2036 |
| 2037 // Always add the type. | 2037 // Always add the type. |
| 2038 content.type = mirror.type(); | 2038 content.type = mirror.type(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2130 } | 2130 } |
| 2131 break; | 2131 break; |
| 2132 | 2132 |
| 2133 case CONTEXT_TYPE: | 2133 case CONTEXT_TYPE: |
| 2134 content.data = mirror.data(); | 2134 content.data = mirror.data(); |
| 2135 break; | 2135 break; |
| 2136 } | 2136 } |
| 2137 | 2137 |
| 2138 // Always add the text representation. | 2138 // Always add the text representation. |
| 2139 content.text = mirror.toText(); | 2139 content.text = mirror.toText(); |
| 2140 | 2140 |
| 2141 // Create and return the JSON string. | 2141 // Create and return the JSON string. |
| 2142 return content; | 2142 return content; |
| 2143 } | 2143 } |
| 2144 | 2144 |
| 2145 | 2145 |
| 2146 /** | 2146 /** |
| 2147 * Serialize object information to the following JSON format. | 2147 * Serialize object information to the following JSON format. |
| 2148 * | 2148 * |
| 2149 * {"className":"<class name>", | 2149 * {"className":"<class name>", |
| 2150 * "constructorFunction":{"ref":<number>}, | 2150 * "constructorFunction":{"ref":<number>}, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2163 content.protoObject = this.serializeReference(mirror.protoObject()); | 2163 content.protoObject = this.serializeReference(mirror.protoObject()); |
| 2164 content.prototypeObject = this.serializeReference(mirror.prototypeObject()); | 2164 content.prototypeObject = this.serializeReference(mirror.prototypeObject()); |
| 2165 | 2165 |
| 2166 // Add flags to indicate whether there are interceptors. | 2166 // Add flags to indicate whether there are interceptors. |
| 2167 if (mirror.hasNamedInterceptor()) { | 2167 if (mirror.hasNamedInterceptor()) { |
| 2168 content.namedInterceptor = true; | 2168 content.namedInterceptor = true; |
| 2169 } | 2169 } |
| 2170 if (mirror.hasIndexedInterceptor()) { | 2170 if (mirror.hasIndexedInterceptor()) { |
| 2171 content.indexedInterceptor = true; | 2171 content.indexedInterceptor = true; |
| 2172 } | 2172 } |
| 2173 | 2173 |
| 2174 // Add function specific properties. | 2174 // Add function specific properties. |
| 2175 if (mirror.isFunction()) { | 2175 if (mirror.isFunction()) { |
| 2176 // Add function specific properties. | 2176 // Add function specific properties. |
| 2177 content.name = mirror.name(); | 2177 content.name = mirror.name(); |
| 2178 if (!IS_UNDEFINED(mirror.inferredName())) { | 2178 if (!IS_UNDEFINED(mirror.inferredName())) { |
| 2179 content.inferredName = mirror.inferredName(); | 2179 content.inferredName = mirror.inferredName(); |
| 2180 } | 2180 } |
| 2181 content.resolved = mirror.resolved(); | 2181 content.resolved = mirror.resolved(); |
| 2182 if (mirror.resolved()) { | 2182 if (mirror.resolved()) { |
| 2183 content.source = mirror.source(); | 2183 content.source = mirror.source(); |
| 2184 } | 2184 } |
| 2185 if (mirror.script()) { | 2185 if (mirror.script()) { |
| 2186 content.script = this.serializeReference(mirror.script()); | 2186 content.script = this.serializeReference(mirror.script()); |
| 2187 content.scriptId = mirror.script().id(); | 2187 content.scriptId = mirror.script().id(); |
| 2188 | 2188 |
| 2189 serializeLocationFields(mirror.sourceLocation(), content); | 2189 serializeLocationFields(mirror.sourceLocation(), content); |
| 2190 } | 2190 } |
| 2191 } | 2191 } |
| 2192 | 2192 |
| 2193 // Add date specific properties. | 2193 // Add date specific properties. |
| 2194 if (mirror.isDate()) { | 2194 if (mirror.isDate()) { |
| 2195 // Add date specific properties. | 2195 // Add date specific properties. |
| 2196 content.value = mirror.value(); | 2196 content.value = mirror.value(); |
| 2197 } | 2197 } |
| 2198 | 2198 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2217 content.properties = p; | 2217 content.properties = p; |
| 2218 } | 2218 } |
| 2219 | 2219 |
| 2220 | 2220 |
| 2221 /** | 2221 /** |
| 2222 * Serialize location information to the following JSON format: | 2222 * Serialize location information to the following JSON format: |
| 2223 * | 2223 * |
| 2224 * "position":"<position>", | 2224 * "position":"<position>", |
| 2225 * "line":"<line>", | 2225 * "line":"<line>", |
| 2226 * "column":"<column>", | 2226 * "column":"<column>", |
| 2227 * | 2227 * |
| 2228 * @param {SourceLocation} location The location to serialize, may be undefined. | 2228 * @param {SourceLocation} location The location to serialize, may be undefined. |
| 2229 */ | 2229 */ |
| 2230 function serializeLocationFields (location, content) { | 2230 function serializeLocationFields (location, content) { |
| 2231 if (!location) { | 2231 if (!location) { |
| 2232 return; | 2232 return; |
| 2233 } | 2233 } |
| 2234 content.position = location.position; | 2234 content.position = location.position; |
| 2235 var line = location.line; | 2235 var line = location.line; |
| 2236 if (!IS_UNDEFINED(line)) { | 2236 if (!IS_UNDEFINED(line)) { |
| 2237 content.line = line; | 2237 content.line = line; |
| 2238 } | 2238 } |
| 2239 var column = location.column; | 2239 var column = location.column; |
| 2240 if (!IS_UNDEFINED(column)) { | 2240 if (!IS_UNDEFINED(column)) { |
| 2241 content.column = column; | 2241 content.column = column; |
| 2242 } | 2242 } |
| 2243 } | 2243 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2257 * Here are a couple of examples. | 2257 * Here are a couple of examples. |
| 2258 * | 2258 * |
| 2259 * {"name":"hello","ref":1} | 2259 * {"name":"hello","ref":1} |
| 2260 * {"name":"length","attributes":7,"propertyType":3,"ref":2} | 2260 * {"name":"length","attributes":7,"propertyType":3,"ref":2} |
| 2261 * | 2261 * |
| 2262 * @param {PropertyMirror} propertyMirror The property to serialize. | 2262 * @param {PropertyMirror} propertyMirror The property to serialize. |
| 2263 * @returns {Object} Protocol object representing the property. | 2263 * @returns {Object} Protocol object representing the property. |
| 2264 */ | 2264 */ |
| 2265 JSONProtocolSerializer.prototype.serializeProperty_ = function(propertyMirror) { | 2265 JSONProtocolSerializer.prototype.serializeProperty_ = function(propertyMirror) { |
| 2266 var result = {}; | 2266 var result = {}; |
| 2267 | 2267 |
| 2268 result.name = propertyMirror.name(); | 2268 result.name = propertyMirror.name(); |
| 2269 var propertyValue = propertyMirror.value(); | 2269 var propertyValue = propertyMirror.value(); |
| 2270 if (this.inlineRefs_() && propertyValue.isValue()) { | 2270 if (this.inlineRefs_() && propertyValue.isValue()) { |
| 2271 result.value = this.serializeReferenceWithDisplayData_(propertyValue); | 2271 result.value = this.serializeReferenceWithDisplayData_(propertyValue); |
| 2272 } else { | 2272 } else { |
| 2273 if (propertyMirror.attributes() != PropertyAttribute.None) { | 2273 if (propertyMirror.attributes() != PropertyAttribute.None) { |
| 2274 result.attributes = propertyMirror.attributes(); | 2274 result.attributes = propertyMirror.attributes(); |
| 2275 } | 2275 } |
| 2276 if (propertyMirror.propertyType() != PropertyType.Normal) { | 2276 if (propertyMirror.propertyType() != PropertyType.Normal) { |
| 2277 result.propertyType = propertyMirror.propertyType(); | 2277 result.propertyType = propertyMirror.propertyType(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2309 local.name = mirror.localName(i); | 2309 local.name = mirror.localName(i); |
| 2310 local.value = this.serializeReference(mirror.localValue(i)); | 2310 local.value = this.serializeReference(mirror.localValue(i)); |
| 2311 x[i] = local; | 2311 x[i] = local; |
| 2312 } | 2312 } |
| 2313 content.locals = x; | 2313 content.locals = x; |
| 2314 serializeLocationFields(mirror.sourceLocation(), content); | 2314 serializeLocationFields(mirror.sourceLocation(), content); |
| 2315 var source_line_text = mirror.sourceLineText(); | 2315 var source_line_text = mirror.sourceLineText(); |
| 2316 if (!IS_UNDEFINED(source_line_text)) { | 2316 if (!IS_UNDEFINED(source_line_text)) { |
| 2317 content.sourceLineText = source_line_text; | 2317 content.sourceLineText = source_line_text; |
| 2318 } | 2318 } |
| 2319 | 2319 |
| 2320 content.scopes = []; | 2320 content.scopes = []; |
| 2321 for (var i = 0; i < mirror.scopeCount(); i++) { | 2321 for (var i = 0; i < mirror.scopeCount(); i++) { |
| 2322 var scope = mirror.scope(i); | 2322 var scope = mirror.scope(i); |
| 2323 content.scopes.push({ | 2323 content.scopes.push({ |
| 2324 type: scope.scopeType(), | 2324 type: scope.scopeType(), |
| 2325 index: i | 2325 index: i |
| 2326 }); | 2326 }); |
| 2327 } | 2327 } |
| 2328 } | 2328 } |
| 2329 | 2329 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2351 if (isNaN(value)) { | 2351 if (isNaN(value)) { |
| 2352 return 'NaN'; | 2352 return 'NaN'; |
| 2353 } | 2353 } |
| 2354 if (!isFinite(value)) { | 2354 if (!isFinite(value)) { |
| 2355 if (value > 0) { | 2355 if (value > 0) { |
| 2356 return 'Infinity'; | 2356 return 'Infinity'; |
| 2357 } else { | 2357 } else { |
| 2358 return '-Infinity'; | 2358 return '-Infinity'; |
| 2359 } | 2359 } |
| 2360 } | 2360 } |
| 2361 return value; | 2361 return value; |
| 2362 } | 2362 } |
| OLD | NEW |