提交 3f821c71 编写于 作者: M Matt Bierner

Mark inputs as readonly arrays

The input arrays should never be mutated
上级 39d401c0
......@@ -534,7 +534,7 @@ export class ContextKeyNotRegexExpr implements ContextKeyExpr {
export class ContextKeyAndExpr implements ContextKeyExpr {
public static create(_expr: Array<ContextKeyExpr | null | undefined>): ContextKeyExpr | undefined {
public static create(_expr: ReadonlyArray<ContextKeyExpr | null | undefined>): ContextKeyExpr | undefined {
const expr = ContextKeyAndExpr._normalizeArr(_expr);
if (expr.length === 0) {
return undefined;
......@@ -594,7 +594,7 @@ export class ContextKeyAndExpr implements ContextKeyExpr {
return true;
}
private static _normalizeArr(arr: Array<ContextKeyExpr | null | undefined>): ContextKeyExpr[] {
private static _normalizeArr(arr: ReadonlyArray<ContextKeyExpr | null | undefined>): ContextKeyExpr[] {
const expr: ContextKeyExpr[] = [];
for (const e of arr) {
......@@ -647,7 +647,7 @@ export class ContextKeyAndExpr implements ContextKeyExpr {
export class ContextKeyOrExpr implements ContextKeyExpr {
public static create(_expr: Array<ContextKeyExpr | null | undefined>): ContextKeyExpr | undefined {
public static create(_expr: ReadonlyArray<ContextKeyExpr | null | undefined>): ContextKeyExpr | undefined {
const expr = ContextKeyOrExpr._normalizeArr(_expr);
if (expr.length === 0) {
return undefined;
......@@ -691,7 +691,7 @@ export class ContextKeyOrExpr implements ContextKeyExpr {
return false;
}
private static _normalizeArr(arr: Array<ContextKeyExpr | null | undefined>): ContextKeyExpr[] {
private static _normalizeArr(arr: ReadonlyArray<ContextKeyExpr | null | undefined>): ContextKeyExpr[] {
let expr: ContextKeyExpr[] = [];
if (arr) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册