canJoin method
Implementation
bool canJoin(Reference other) {
// prefixes cannot be joined if they are:
// - different
// - one is null and the other is not
return switch ((prefix, other.prefix)) {
(null, null) => true,
(null, String()) || (String(), null) => switch ((
associatedElement,
other.associatedElement,
)) {
// If one is an import statement, then we can join them
(PrefixElement(), _) || (PrefixElement(), _) => true,
_ => false,
},
(final String p1, final String p2) => p1 == p2,
};
}