in src/grammar.ts [1289:1313]
private static _equals(a: ScopeListElement | null, b: ScopeListElement | null): boolean {
do {
if (a === b) {
return true;
}
if (!a && !b) {
// End of list reached for both
return true;
}
if (!a || !b) {
// End of list reached only for one
return false;
}
if (a.scope !== b.scope || a.metadata !== b.metadata) {
return false;
}
// Go to previous pair
a = a.parent;
b = b.parent;
} while (true);
}