mergeBindings function
Implementation
Map<Variable, Node>? mergeBindings(
Map<Variable, Node>? first,
Map<Variable, Node>? second,
) {
if (first == null || second == null) {
return null;
}
final result = newBindings();
result.addAll(first);
for (final key in second.keys) {
final value = second[key]!;
final other = result[key];
if (other != null) {
final subs = other.match(value);
if (subs == null) {
return null;
} else {
result.addAll(subs);
}
} else {
result[key] = value;
}
}
return result;
}