private void replaceLocals(Function toFunc, Function fromFunc, TaskMonitor monitor)
			throws CancelledException {
		Variable[] oldLocals = toFunc.getLocalVariables();
		Variable[] fromLocals = fromFunc.getLocalVariables();
		if (Arrays.equals(oldLocals, fromLocals)) {
			return;
		}
		// Remove all locals in the toFunc that don't have a comparable local in the fromFunc.
		for (Variable local : oldLocals) {
			monitor.checkCancelled();
			Variable fromVar = DiffUtility.getVariable(local, fromFunc);
			if (fromVar == null) {
				toFunc.removeVariable(local);
			}
		}
		for (Variable fromLocal : fromLocals) {
			monitor.checkCancelled();
			replaceVariable(fromFunc, fromLocal, toFunc);
		}
	}
Replaces the local symbols in toFunc with the local symbols that are in the fromFunc.
@param toFunc the function having its local variables replaced.
@param fromFunc the source of the replacement variables.
@throws CancelledException if user cancels via the monitor.
Ghidra/Features/Base/src/main/java/ghidra/program/util/ProgramMerge.java