| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } else if (IS_ARRAY(value)) { | 80 } else if (IS_ARRAY(value)) { |
| 81 mirror = new ArrayMirror(value); | 81 mirror = new ArrayMirror(value); |
| 82 } else if (IS_DATE(value)) { | 82 } else if (IS_DATE(value)) { |
| 83 mirror = new DateMirror(value); | 83 mirror = new DateMirror(value); |
| 84 } else if (IS_FUNCTION(value)) { | 84 } else if (IS_FUNCTION(value)) { |
| 85 mirror = new FunctionMirror(value); | 85 mirror = new FunctionMirror(value); |
| 86 } else if (IS_REGEXP(value)) { | 86 } else if (IS_REGEXP(value)) { |
| 87 mirror = new RegExpMirror(value); | 87 mirror = new RegExpMirror(value); |
| 88 } else if (IS_ERROR(value)) { | 88 } else if (IS_ERROR(value)) { |
| 89 mirror = new ErrorMirror(value); | 89 mirror = new ErrorMirror(value); |
| 90 } else if (IS_SCRIPT(value)) { |
| 91 mirror = new ScriptMirror(value); |
| 90 } else { | 92 } else { |
| 91 mirror = new ObjectMirror(value); | 93 mirror = new ObjectMirror(value); |
| 92 } | 94 } |
| 93 | 95 |
| 94 mirror_cache_[mirror.handle()] = mirror; | 96 mirror_cache_[mirror.handle()] = mirror; |
| 95 return mirror; | 97 return mirror; |
| 96 } | 98 } |
| 97 | 99 |
| 98 | 100 |
| 99 /** | 101 /** |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 * Returns the script object for the function. | 772 * Returns the script object for the function. |
| 771 * @return {ScriptMirror or undefined} Script object for the function or | 773 * @return {ScriptMirror or undefined} Script object for the function or |
| 772 * undefined if the function has no script | 774 * undefined if the function has no script |
| 773 */ | 775 */ |
| 774 FunctionMirror.prototype.script = function() { | 776 FunctionMirror.prototype.script = function() { |
| 775 // Return script if function is resolved. Otherwise just fall through | 777 // Return script if function is resolved. Otherwise just fall through |
| 776 // to return undefined. | 778 // to return undefined. |
| 777 if (this.resolved()) { | 779 if (this.resolved()) { |
| 778 var script = %FunctionGetScript(this.value_); | 780 var script = %FunctionGetScript(this.value_); |
| 779 if (script) { | 781 if (script) { |
| 780 return new ScriptMirror(script); | 782 return MakeMirror(script); |
| 781 } | 783 } |
| 782 } | 784 } |
| 783 }; | 785 }; |
| 784 | 786 |
| 785 | 787 |
| 786 /** | 788 /** |
| 787 * Returns objects constructed by this function. | 789 * Returns objects constructed by this function. |
| 788 * @param {number} opt_max_instances Optional parameter specifying the maximum | 790 * @param {number} opt_max_instances Optional parameter specifying the maximum |
| 789 * number of instances to return. | 791 * number of instances to return. |
| 790 * @return {Array or undefined} The objects constructed by this function. | 792 * @return {Array or undefined} The objects constructed by this function. |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 * @extends Mirror | 1543 * @extends Mirror |
| 1542 */ | 1544 */ |
| 1543 function ScriptMirror(script) { | 1545 function ScriptMirror(script) { |
| 1544 Mirror.call(this, SCRIPT_TYPE); | 1546 Mirror.call(this, SCRIPT_TYPE); |
| 1545 this.script_ = script; | 1547 this.script_ = script; |
| 1546 this.allocateHandle_(); | 1548 this.allocateHandle_(); |
| 1547 } | 1549 } |
| 1548 inherits(ScriptMirror, Mirror); | 1550 inherits(ScriptMirror, Mirror); |
| 1549 | 1551 |
| 1550 | 1552 |
| 1553 ScriptMirror.prototype.value = function() { |
| 1554 return this.script_; |
| 1555 }; |
| 1556 |
| 1557 |
| 1551 ScriptMirror.prototype.name = function() { | 1558 ScriptMirror.prototype.name = function() { |
| 1552 return this.script_.name; | 1559 return this.script_.name; |
| 1553 }; | 1560 }; |
| 1554 | 1561 |
| 1555 | 1562 |
| 1563 ScriptMirror.prototype.source = function() { |
| 1564 return this.script_.source; |
| 1565 }; |
| 1566 |
| 1567 |
| 1556 ScriptMirror.prototype.lineOffset = function() { | 1568 ScriptMirror.prototype.lineOffset = function() { |
| 1557 return this.script_.line_offset; | 1569 return this.script_.line_offset; |
| 1558 }; | 1570 }; |
| 1559 | 1571 |
| 1560 | 1572 |
| 1561 ScriptMirror.prototype.columnOffset = function() { | 1573 ScriptMirror.prototype.columnOffset = function() { |
| 1562 return this.script_.column_offset; | 1574 return this.script_.column_offset; |
| 1563 }; | 1575 }; |
| 1564 | 1576 |
| 1565 | 1577 |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2054 /** | 2066 /** |
| 2055 * Convert a Date to ISO 8601 format. To avoid depending on the Date object | 2067 * Convert a Date to ISO 8601 format. To avoid depending on the Date object |
| 2056 * this method calls the functions in date.js directly and not through the | 2068 * this method calls the functions in date.js directly and not through the |
| 2057 * value. | 2069 * value. |
| 2058 * @param {Date} value The Date value to format as JSON | 2070 * @param {Date} value The Date value to format as JSON |
| 2059 * @return {string} JSON formatted Date value | 2071 * @return {string} JSON formatted Date value |
| 2060 */ | 2072 */ |
| 2061 function DateToJSON_(value) { | 2073 function DateToJSON_(value) { |
| 2062 return '"' + DateToISO8601_(value) + '"'; | 2074 return '"' + DateToISO8601_(value) + '"'; |
| 2063 } | 2075 } |
| OLD | NEW |