OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 MarkChangedFunctions(root_old_node, pos_translator.GetChunks()); | 69 MarkChangedFunctions(root_old_node, pos_translator.GetChunks()); |
70 | 70 |
71 // Find all SharedFunctionInfo's that were compiled from this script. | 71 // Find all SharedFunctionInfo's that were compiled from this script. |
72 FindLiveSharedInfos(root_old_node, script); | 72 FindLiveSharedInfos(root_old_node, script); |
73 | 73 |
74 // Gather compile information about new version of script. | 74 // Gather compile information about new version of script. |
75 var new_compile_info; | 75 var new_compile_info; |
76 try { | 76 try { |
77 new_compile_info = GatherCompileInfo(new_source, script); | 77 new_compile_info = GatherCompileInfo(new_source, script); |
78 } catch (e) { | 78 } catch (e) { |
79 throw new Failure("Failed to compile new version of script: " + e); | 79 var failure = |
80 new Failure("Failed to compile new version of script: " + e); | |
81 if (e instanceof SyntaxError) { | |
82 var details = { | |
83 type: "liveedit_compile_error", | |
84 syntaxErrorMessage: e.message | |
85 }; | |
86 failure.details = details; | |
Yang
2012/11/28 15:51:28
I'd put this after the following if, even though t
Yang
2012/11/29 16:38:57
I still think this would make sense.
Peter Rybin
2012/11/29 23:16:05
You mean this only line?
Done
| |
87 if ("startPosition" in e) { | |
88 var position_struct = { | |
89 startPosition: e.startPosition, | |
90 endPosition: e.endPosition, | |
91 startLine: e.startLine, | |
92 startColumn: e.startColumn, | |
93 endColumn: e.endColumn | |
94 }; | |
95 details.position = position_struct; | |
96 } | |
97 } | |
98 throw failure; | |
80 } | 99 } |
81 var root_new_node = BuildCodeInfoTree(new_compile_info); | 100 var root_new_node = BuildCodeInfoTree(new_compile_info); |
82 | 101 |
83 // Link recompiled script data with other data. | 102 // Link recompiled script data with other data. |
84 FindCorrespondingFunctions(root_old_node, root_new_node); | 103 FindCorrespondingFunctions(root_old_node, root_new_node); |
85 | 104 |
86 // Prepare to-do lists. | 105 // Prepare to-do lists. |
87 var replace_code_list = new Array(); | 106 var replace_code_list = new Array(); |
88 var link_to_old_script_list = new Array(); | 107 var link_to_old_script_list = new Array(); |
89 var link_to_original_script_list = new Array(); | 108 var link_to_original_script_list = new Array(); |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1093 // Function is public. | 1112 // Function is public. |
1094 this.RestartFrame = RestartFrame; | 1113 this.RestartFrame = RestartFrame; |
1095 | 1114 |
1096 // Functions are public for tests. | 1115 // Functions are public for tests. |
1097 this.TestApi = { | 1116 this.TestApi = { |
1098 PosTranslator: PosTranslator, | 1117 PosTranslator: PosTranslator, |
1099 CompareStrings: CompareStrings, | 1118 CompareStrings: CompareStrings, |
1100 ApplySingleChunkPatch: ApplySingleChunkPatch | 1119 ApplySingleChunkPatch: ApplySingleChunkPatch |
1101 }; | 1120 }; |
1102 }; | 1121 }; |
OLD | NEW |