| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 return 'Unknown debug event ' + event.eventType(); | 173 return 'Unknown debug event ' + event.eventType(); |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 | 176 |
| 177 function SourceUnderline(source_text, position) { | 177 function SourceUnderline(source_text, position) { |
| 178 if (!source_text) { | 178 if (!source_text) { |
| 179 return; | 179 return; |
| 180 } | 180 } |
| 181 | 181 |
| 182 // Create an underline with a caret pointing to the source position. If the»
» | 182 // Create an underline with a caret pointing to the source position. If the |
| 183 // source contains a tab character the underline will have a tab character in»
» | 183 // source contains a tab character the underline will have a tab character in |
| 184 // the same place otherwise the underline will have a space character.»
» | 184 // the same place otherwise the underline will have a space character. |
| 185 var underline = ''; | 185 var underline = ''; |
| 186 for (var i = 0; i < position; i++) { | 186 for (var i = 0; i < position; i++) { |
| 187 if (source_text[i] == '\t') { | 187 if (source_text[i] == '\t') { |
| 188 underline += '\t'; | 188 underline += '\t'; |
| 189 } else { | 189 } else { |
| 190 underline += ' '; | 190 underline += ' '; |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 underline += '^'; | 193 underline += '^'; |
| 194 | 194 |
| 195 // Return the source line text with the underline beneath. | 195 // Return the source line text with the underline beneath. |
| 196 return source_text + '\n' + underline; | 196 return source_text + '\n' + underline; |
| 197 }; | 197 }; |
| 198 | 198 |
| 199 | 199 |
| 200 function FrameSourceUnderline(frame) {» » | 200 function FrameSourceUnderline(frame) { |
| 201 var location = frame.sourceLocation(); | 201 var location = frame.sourceLocation(); |
| 202 if (location) { | 202 if (location) { |
| 203 return SourceUnderline(location.sourceText(), | 203 return SourceUnderline(location.sourceText(), |
| 204 location.position - location.start); | 204 location.position - location.start); |
| 205 } | 205 } |
| 206 }; | 206 }; |
| 207 | 207 |
| 208 | 208 |
| 209 // Converts a text command to a JSON request. | 209 // Converts a text command to a JSON request. |
| 210 function DebugCommandToJSONRequest(cmd_line) { | 210 function DebugCommandToJSONRequest(cmd_line) { |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 json += NumberToJSON_(elem); | 914 json += NumberToJSON_(elem); |
| 915 } else if (typeof(elem) === 'string') { | 915 } else if (typeof(elem) === 'string') { |
| 916 json += StringToJSON_(elem); | 916 json += StringToJSON_(elem); |
| 917 } else { | 917 } else { |
| 918 json += elem; | 918 json += elem; |
| 919 } | 919 } |
| 920 } | 920 } |
| 921 json += ']'; | 921 json += ']'; |
| 922 return json; | 922 return json; |
| 923 } | 923 } |
| OLD | NEW |