Index: src/liveedit-debugger.js |
diff --git a/src/liveedit-debugger.js b/src/liveedit-debugger.js |
index 451b146bde798e4b4c81b62c39d0adcb1b158630..e262a9663302fafa9f1d007cb4e0c8294c49cf3b 100644 |
--- a/src/liveedit-debugger.js |
+++ b/src/liveedit-debugger.js |
@@ -703,7 +703,13 @@ Debug.LiveEdit = new function() { |
// A recursive function that tries to find a correspondence for all |
// child functions and for their inner functions. |
- function ProcessChildren(old_node, new_node) { |
+ function ProcessNode(old_node, new_node) { |
+ var scope_change_description = |
+ IsFunctionContextLocalsChanged(old_node.info, new_node.info); |
+ if (scope_change_description) { |
+ old_node.status = FunctionStatus.CHANGED; |
+ } |
+ |
var old_children = old_node.children; |
var new_children = new_node.children; |
@@ -729,8 +735,15 @@ Debug.LiveEdit = new function() { |
new_children[new_index]; |
old_children[old_index].textual_corresponding_node = |
new_children[new_index]; |
- if (old_children[old_index].status != FunctionStatus.UNCHANGED) { |
- ProcessChildren(old_children[old_index], |
+ if (scope_change_description) { |
+ old_children[old_index].status = FunctionStatus.DAMAGED; |
+ old_children[old_index].status_explanation = |
+ "Enclosing function is now incompatible. " + |
+ scope_change_description; |
+ old_children[old_index].corresponding_node = void 0; |
+ } else if (old_children[old_index].status != |
+ FunctionStatus.UNCHANGED) { |
+ ProcessNode(old_children[old_index], |
new_children[new_index]); |
if (old_children[old_index].status == FunctionStatus.DAMAGED) { |
unmatched_new_nodes_list.push( |
@@ -772,11 +785,10 @@ Debug.LiveEdit = new function() { |
} |
if (old_node.status == FunctionStatus.CHANGED) { |
- var why_wrong_expectations = |
- WhyFunctionExpectationsDiffer(old_node.info, new_node.info); |
- if (why_wrong_expectations) { |
+ if (old_node.info.param_num != new_node.info.param_num) { |
old_node.status = FunctionStatus.DAMAGED; |
- old_node.status_explanation = why_wrong_expectations; |
+ old_node.status_explanation = "Changed parameter number: " + |
+ old_node.info.param_num + " and " + new_node.info.param_num; |
} |
} |
old_node.unmatched_new_nodes = unmatched_new_nodes_list; |
@@ -784,7 +796,7 @@ Debug.LiveEdit = new function() { |
textually_unmatched_new_nodes_list; |
} |
- ProcessChildren(old_code_tree, new_code_tree); |
+ ProcessNode(old_code_tree, new_code_tree); |
old_code_tree.corresponding_node = new_code_tree; |
old_code_tree.textual_corresponding_node = new_code_tree; |
@@ -878,15 +890,9 @@ Debug.LiveEdit = new function() { |
return script.name + " (old)"; |
} |
- // Compares a function interface old and new version, whether it |
+ // Compares a function scope heap structure, old and new version, whether it |
// changed or not. Returns explanation if they differ. |
- function WhyFunctionExpectationsDiffer(function_info1, function_info2) { |
- // Check that function has the same number of parameters (there may exist |
- // an adapter, that won't survive function parameter number change). |
- if (function_info1.param_num != function_info2.param_num) { |
- return "Changed parameter number: " + function_info1.param_num + |
- " and " + function_info2.param_num; |
- } |
+ function IsFunctionContextLocalsChanged(function_info1, function_info2) { |
var scope_info1 = function_info1.scope_info; |
var scope_info2 = function_info2.scope_info; |
@@ -905,8 +911,8 @@ Debug.LiveEdit = new function() { |
} |
if (scope_info1_text != scope_info2_text) { |
- return "Incompatible variable maps: [" + scope_info1_text + |
- "] and [" + scope_info2_text + "]"; |
+ return "Variable map changed: [" + scope_info1_text + |
+ "] => [" + scope_info2_text + "]"; |
} |
// No differences. Return undefined. |
return; |