| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --expose-debug-as debug | 5 // Flags: --expose-debug-as debug |
| 6 | 6 |
| 7 Debug = debug.Debug | 7 Debug = debug.Debug |
| 8 | 8 |
| 9 function BestEditor() { | 9 function BestEditor() { |
| 10 var best_editor = "Emacs"; | 10 var best_editor = "Emacs"; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 case 1: | 27 case 1: |
| 28 Replace(BestEditor, "Emacs", "Eclipse"); | 28 Replace(BestEditor, "Emacs", "Eclipse"); |
| 29 break; | 29 break; |
| 30 case 2: | 30 case 2: |
| 31 Replace(BestEditor, "Eclipse", "Vim"); | 31 Replace(BestEditor, "Eclipse", "Vim"); |
| 32 break; | 32 break; |
| 33 default: | 33 default: |
| 34 assertUnreachable(); | 34 assertUnreachable(); |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 exec_state.prepareStep(Debug.StepAction.StepIn, 1); | 37 exec_state.prepareStep(Debug.StepAction.StepIn); |
| 38 } catch (e) { | 38 } catch (e) { |
| 39 exception = e; | 39 exception = e; |
| 40 } | 40 } |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 function Replace(fun, original, patch) { | 43 function Replace(fun, original, patch) { |
| 44 var script = Debug.findScript(fun); | 44 var script = Debug.findScript(fun); |
| 45 if (fun.toString().indexOf(original) < 0) return; | 45 if (fun.toString().indexOf(original) < 0) return; |
| 46 var patch_pos = script.source.indexOf(original); | 46 var patch_pos = script.source.indexOf(original); |
| 47 var change_log = []; | 47 var change_log = []; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 72 " return best_editor;","}", | 72 " return best_editor;","}", |
| 73 "results.push(BestEditor());", | 73 "results.push(BestEditor());", |
| 74 "results.push(BestEditor());", | 74 "results.push(BestEditor());", |
| 75 " var best_editor = \"Eclipse\";", | 75 " var best_editor = \"Eclipse\";", |
| 76 " return best_editor;", | 76 " return best_editor;", |
| 77 " var best_editor = \"Vim\";", | 77 " var best_editor = \"Vim\";", |
| 78 " return best_editor;", | 78 " return best_editor;", |
| 79 "}","results.push(BestEditor());", | 79 "}","results.push(BestEditor());", |
| 80 "Debug.setListener(null);" | 80 "Debug.setListener(null);" |
| 81 ], log); | 81 ], log); |
| OLD | NEW |