Skip to content

Commit d881556

Browse files
committed
Remove extra null checking
Strict null checks should catch this now
1 parent ae758e6 commit d881556

1 file changed

Lines changed: 15 additions & 17 deletions

File tree

src/vs/platform/contextkey/common/contextkey.ts

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -597,29 +597,27 @@ export class ContextKeyAndExpr implements ContextKeyExpr {
597597
private static _normalizeArr(arr: Array<ContextKeyExpr | null | undefined>): ContextKeyExpr[] {
598598
let expr: ContextKeyExpr[] = [];
599599

600-
if (arr) {
601-
for (let i = 0, len = arr.length; i < len; i++) {
602-
let e: ContextKeyExpr | null | undefined = arr[i];
603-
if (!e) {
604-
continue;
605-
}
606-
607-
if (e instanceof ContextKeyAndExpr) {
608-
expr = expr.concat(e.expr);
609-
continue;
610-
}
600+
for (let i = 0, len = arr.length; i < len; i++) {
601+
let e: ContextKeyExpr | null | undefined = arr[i];
602+
if (!e) {
603+
continue;
604+
}
611605

612-
if (e instanceof ContextKeyOrExpr) {
613-
// Not allowed, because we don't have parens!
614-
throw new Error(`It is not allowed to have an or expression here due to lack of parens! For example "a && (b||c)" is not supported, use "(a&&b) || (a&&c)" instead.`);
615-
}
606+
if (e instanceof ContextKeyAndExpr) {
607+
expr = expr.concat(e.expr);
608+
continue;
609+
}
616610

617-
expr.push(e);
611+
if (e instanceof ContextKeyOrExpr) {
612+
// Not allowed, because we don't have parens!
613+
throw new Error(`It is not allowed to have an or expression here due to lack of parens! For example "a && (b||c)" is not supported, use "(a&&b) || (a&&c)" instead.`);
618614
}
619615

620-
expr.sort(cmp);
616+
expr.push(e);
621617
}
622618

619+
expr.sort(cmp);
620+
623621
return expr;
624622
}
625623

0 commit comments

Comments
 (0)