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 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1610 ScriptMirror.prototype.data = function() { | 1610 ScriptMirror.prototype.data = function() { |
1611 return this.script_.data; | 1611 return this.script_.data; |
1612 }; | 1612 }; |
1613 | 1613 |
1614 | 1614 |
1615 ScriptMirror.prototype.scriptType = function() { | 1615 ScriptMirror.prototype.scriptType = function() { |
1616 return this.script_.type; | 1616 return this.script_.type; |
1617 }; | 1617 }; |
1618 | 1618 |
1619 | 1619 |
| 1620 ScriptMirror.prototype.compilationType = function() { |
| 1621 return this.script_.compilation_type; |
| 1622 }; |
| 1623 |
| 1624 |
1620 ScriptMirror.prototype.lineCount = function() { | 1625 ScriptMirror.prototype.lineCount = function() { |
1621 return this.script_.lineCount(); | 1626 return this.script_.lineCount(); |
1622 }; | 1627 }; |
1623 | 1628 |
1624 | 1629 |
1625 ScriptMirror.prototype.locationFromPosition = function( | 1630 ScriptMirror.prototype.locationFromPosition = function( |
1626 position, include_resource_offset) { | 1631 position, include_resource_offset) { |
1627 return this.script_.locationFromPosition(position, include_resource_offset); | 1632 return this.script_.locationFromPosition(position, include_resource_offset); |
1628 } | 1633 } |
1629 | 1634 |
1630 | 1635 |
1631 ScriptMirror.prototype.sourceSlice = function (opt_from_line, opt_to_line) { | 1636 ScriptMirror.prototype.sourceSlice = function (opt_from_line, opt_to_line) { |
1632 return this.script_.sourceSlice(opt_from_line, opt_to_line); | 1637 return this.script_.sourceSlice(opt_from_line, opt_to_line); |
1633 } | 1638 } |
1634 | 1639 |
1635 | 1640 |
1636 ScriptMirror.prototype.context = function() { | 1641 ScriptMirror.prototype.context = function() { |
1637 return this.context_; | 1642 return this.context_; |
1638 }; | 1643 }; |
1639 | 1644 |
1640 | 1645 |
| 1646 ScriptMirror.prototype.evalFromFunction = function() { |
| 1647 return MakeMirror(this.script_.eval_from_function); |
| 1648 }; |
| 1649 |
| 1650 |
| 1651 ScriptMirror.prototype.evalFromLocation = function() { |
| 1652 var eval_from_function = this.evalFromFunction(); |
| 1653 if (!eval_from_function.isUndefined()) { |
| 1654 var position = this.script_.eval_from_position; |
| 1655 return eval_from_function.script().locationFromPosition(position, true); |
| 1656 } |
| 1657 }; |
| 1658 |
| 1659 |
1641 ScriptMirror.prototype.toText = function() { | 1660 ScriptMirror.prototype.toText = function() { |
1642 var result = ''; | 1661 var result = ''; |
1643 result += this.name(); | 1662 result += this.name(); |
1644 result += ' (lines: '; | 1663 result += ' (lines: '; |
1645 if (this.lineOffset() > 0) { | 1664 if (this.lineOffset() > 0) { |
1646 result += this.lineOffset(); | 1665 result += this.lineOffset(); |
1647 result += '-'; | 1666 result += '-'; |
1648 result += this.lineOffset() + this.lineCount() - 1; | 1667 result += this.lineOffset() + this.lineCount() - 1; |
1649 } else { | 1668 } else { |
1650 result += this.lineCount(); | 1669 result += this.lineCount(); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1894 content.data = mirror.data(); | 1913 content.data = mirror.data(); |
1895 } | 1914 } |
1896 if (this.includeSource_()) { | 1915 if (this.includeSource_()) { |
1897 content.source = mirror.source(); | 1916 content.source = mirror.source(); |
1898 } else { | 1917 } else { |
1899 var sourceStart = mirror.source().substring(0, 80); | 1918 var sourceStart = mirror.source().substring(0, 80); |
1900 content.sourceStart = sourceStart; | 1919 content.sourceStart = sourceStart; |
1901 } | 1920 } |
1902 content.sourceLength = mirror.source().length; | 1921 content.sourceLength = mirror.source().length; |
1903 content.scriptType = mirror.scriptType(); | 1922 content.scriptType = mirror.scriptType(); |
| 1923 content.compilationType = mirror.compilationType(); |
| 1924 if (mirror.compilationType() == 1) { // Compilation type eval. |
| 1925 content.evalFromScript = |
| 1926 this.serializeReference(mirror.evalFromFunction().script()); |
| 1927 var evalFromLocation = mirror.evalFromLocation() |
| 1928 content.evalFromLocation = { line: evalFromLocation.line, |
| 1929 column: evalFromLocation.column} |
| 1930 } |
1904 if (mirror.context()) { | 1931 if (mirror.context()) { |
1905 content.context = this.serializeReference(mirror.context()); | 1932 content.context = this.serializeReference(mirror.context()); |
1906 } | 1933 } |
1907 break; | 1934 break; |
1908 | 1935 |
1909 case CONTEXT_TYPE: | 1936 case CONTEXT_TYPE: |
1910 content.data = mirror.data(); | 1937 content.data = mirror.data(); |
1911 break; | 1938 break; |
1912 } | 1939 } |
1913 | 1940 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2090 } | 2117 } |
2091 if (!isFinite(value)) { | 2118 if (!isFinite(value)) { |
2092 if (value > 0) { | 2119 if (value > 0) { |
2093 return 'Infinity'; | 2120 return 'Infinity'; |
2094 } else { | 2121 } else { |
2095 return '-Infinity'; | 2122 return '-Infinity'; |
2096 } | 2123 } |
2097 } | 2124 } |
2098 return value; | 2125 return value; |
2099 } | 2126 } |
OLD | NEW |