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

Side by Side Diff: src/mirror-delay.js

Issue 109026: Add inferred function name to the json protocol (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 7 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/runtime.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 /** 749 /**
750 * Returns the name of the function. 750 * Returns the name of the function.
751 * @return {string} Name of the function 751 * @return {string} Name of the function
752 */ 752 */
753 FunctionMirror.prototype.name = function() { 753 FunctionMirror.prototype.name = function() {
754 return %FunctionGetName(this.value_); 754 return %FunctionGetName(this.value_);
755 }; 755 };
756 756
757 757
758 /** 758 /**
759 * Returns the inferred name of the function.
760 * @return {string} Name of the function
761 */
762 FunctionMirror.prototype.inferredName = function() {
763 return %FunctionGetInferredName(this.value_);
764 };
765
766
767 /**
759 * Returns the source code for the function. 768 * Returns the source code for the function.
760 * @return {string or undefined} The source code for the function. If the 769 * @return {string or undefined} The source code for the function. If the
761 * function is not resolved undefined will be returned. 770 * function is not resolved undefined will be returned.
762 */ 771 */
763 FunctionMirror.prototype.source = function() { 772 FunctionMirror.prototype.source = function() {
764 // Return source if function is resolved. Otherwise just fall through to 773 // Return source if function is resolved. Otherwise just fall through to
765 // return undefined. 774 // return undefined.
766 if (this.resolved()) { 775 if (this.resolved()) {
767 return builtins.FunctionSourceString(this.value_); 776 return builtins.FunctionSourceString(this.value_);
768 } 777 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 UnresolvedFunctionMirror.prototype.protoObject = function() { 859 UnresolvedFunctionMirror.prototype.protoObject = function() {
851 return GetUndefinedMirror(); 860 return GetUndefinedMirror();
852 }; 861 };
853 862
854 863
855 UnresolvedFunctionMirror.prototype.name = function() { 864 UnresolvedFunctionMirror.prototype.name = function() {
856 return this.value_; 865 return this.value_;
857 }; 866 };
858 867
859 868
869 UnresolvedFunctionMirror.prototype.inferredName = function() {
870 return undefined;
871 };
872
873
860 UnresolvedFunctionMirror.prototype.propertyNames = function(kind, limit) { 874 UnresolvedFunctionMirror.prototype.propertyNames = function(kind, limit) {
861 return []; 875 return [];
862 } 876 }
863 877
864 878
865 /** 879 /**
866 * Mirror object for arrays. 880 * Mirror object for arrays.
867 * @param {Array} value The Array object reflected by this mirror 881 * @param {Array} value The Array object reflected by this mirror
868 * @constructor 882 * @constructor
869 * @extends ObjectMirror 883 * @extends ObjectMirror
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 content.push(MakeJSONPair_('namedInterceptor', BooleanToJSON_(true))); 1842 content.push(MakeJSONPair_('namedInterceptor', BooleanToJSON_(true)));
1829 } 1843 }
1830 if (mirror.hasIndexedInterceptor()) { 1844 if (mirror.hasIndexedInterceptor()) {
1831 content.push(MakeJSONPair_('indexedInterceptor', BooleanToJSON_(true))); 1845 content.push(MakeJSONPair_('indexedInterceptor', BooleanToJSON_(true)));
1832 } 1846 }
1833 1847
1834 // Add function specific properties. 1848 // Add function specific properties.
1835 if (mirror.isFunction()) { 1849 if (mirror.isFunction()) {
1836 // Add function specific properties. 1850 // Add function specific properties.
1837 content.push(MakeJSONPair_('name', StringToJSON_(mirror.name()))); 1851 content.push(MakeJSONPair_('name', StringToJSON_(mirror.name())));
1852 if (!IS_UNDEFINED(mirror.inferredName())) {
1853 content.push(MakeJSONPair_('inferredName',
1854 StringToJSON_(mirror.inferredName())));
1855 }
1838 content.push(MakeJSONPair_('resolved', BooleanToJSON_(mirror.resolved()))); 1856 content.push(MakeJSONPair_('resolved', BooleanToJSON_(mirror.resolved())));
1839 if (mirror.resolved()) { 1857 if (mirror.resolved()) {
1840 content.push(MakeJSONPair_('source', StringToJSON_(mirror.source()))); 1858 content.push(MakeJSONPair_('source', StringToJSON_(mirror.source())));
1841 } 1859 }
1842 if (mirror.script()) { 1860 if (mirror.script()) {
1843 content.push(MakeJSONPair_('script', this.serializeReference(mirror.script ()))); 1861 content.push(MakeJSONPair_('script', this.serializeReference(mirror.script ())));
1844 } 1862 }
1845 } 1863 }
1846 1864
1847 // Add date specific properties. 1865 // Add date specific properties.
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
2085 /** 2103 /**
2086 * Convert a Date to ISO 8601 format. To avoid depending on the Date object 2104 * Convert a Date to ISO 8601 format. To avoid depending on the Date object
2087 * this method calls the functions in date.js directly and not through the 2105 * this method calls the functions in date.js directly and not through the
2088 * value. 2106 * value.
2089 * @param {Date} value The Date value to format as JSON 2107 * @param {Date} value The Date value to format as JSON
2090 * @return {string} JSON formatted Date value 2108 * @return {string} JSON formatted Date value
2091 */ 2109 */
2092 function DateToJSON_(value) { 2110 function DateToJSON_(value) {
2093 return '"' + DateToISO8601_(value) + '"'; 2111 return '"' + DateToISO8601_(value) + '"';
2094 } 2112 }
OLDNEW
« no previous file with comments | « no previous file | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698