OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 if (old_pos >= change_pos + change_len_old) { | 173 if (old_pos >= change_pos + change_len_old) { |
174 return old_pos + change_len_new - change_len_old; | 174 return old_pos + change_len_new - change_len_old; |
175 } | 175 } |
176 return -1; | 176 return -1; |
177 } | 177 } |
178 | 178 |
179 var position_change_array; | 179 var position_change_array; |
180 var position_patch_report; | 180 var position_patch_report; |
181 function PatchPositions(new_info, shared_info) { | 181 function PatchPositions(new_info, shared_info) { |
182 if (!shared_info) { | 182 if (!shared_info) { |
183 // TODO: explain what is happening. | 183 // TODO(LiveEdit): explain what is happening. |
184 return; | 184 return; |
185 } | 185 } |
186 %LiveEditPatchFunctionPositions(shared_info.raw_array, | 186 var breakpoint_position_update = %LiveEditPatchFunctionPositions( |
187 position_change_array); | 187 shared_info.raw_array, position_change_array); |
| 188 for (var i = 0; i < breakpoint_position_update.length; i += 2) { |
| 189 var new_pos = breakpoint_position_update[i]; |
| 190 var break_point_object = breakpoint_position_update[i + 1]; |
| 191 change_log.push( { breakpoint_position_update: |
| 192 { from: break_point_object.source_position(), to: new_pos } } ); |
| 193 break_point_object.updateSourcePosition(new_pos, script); |
| 194 } |
188 position_patch_report.push( { name: new_info.function_name } ); | 195 position_patch_report.push( { name: new_info.function_name } ); |
189 } | 196 } |
190 | 197 |
191 var link_to_old_script_report; | 198 var link_to_old_script_report; |
192 var old_script; | 199 var old_script; |
193 // Makes a function associated with another instance of a script (the | 200 // Makes a function associated with another instance of a script (the |
194 // one representing its old version). This way the function still | 201 // one representing its old version). This way the function still |
195 // may access its own text. | 202 // may access its own text. |
196 function LinkToOldScript(shared_info) { | 203 function LinkToOldScript(shared_info) { |
197 %LiveEditRelinkFunctionToScript(shared_info.raw_array, old_script); | 204 %LiveEditRelinkFunctionToScript(shared_info.raw_array, old_script); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 } | 538 } |
532 | 539 |
533 if (old_len == 0 && new_len == 0) { | 540 if (old_len == 0 && new_len == 0) { |
534 // no change | 541 // no change |
535 return; | 542 return; |
536 } | 543 } |
537 | 544 |
538 return { "change_pos": change_pos, "old_len": old_len, "new_len": new_len }; | 545 return { "change_pos": change_pos, "old_len": old_len, "new_len": new_len }; |
539 } | 546 } |
540 } | 547 } |
OLD | NEW |