Skip to content

Commit aa7c1f7

Browse files
committed
Update arrayEquals
1 parent 34cdf22 commit aa7c1f7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Diff for: src/ast.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -1107,10 +1107,14 @@ export abstract class TypeNode extends Node {
11071107
abstract equals(node: TypeNode): bool;
11081108

11091109
static arrayEquals(node: Comparable[] | null, other: Comparable[] | null): bool {
1110-
if (node == null && other == null) return true;
1111-
if (node == null || other == null) return false;
1112-
if (node.length != other.length) return false;
1113-
return node.map((value, i) => value.equals(other[i])).every(x => x);
1110+
if (node == other) return true;
1111+
if (!node || !other) return false;
1112+
const len = other.length;
1113+
if (node.length !== len) return false;
1114+
for (let i = 0; i < len; i++) {
1115+
if (!node[i].equals(other[i])) return false;
1116+
}
1117+
return true;
11141118
}
11151119
}
11161120

0 commit comments

Comments
 (0)