Skip to content

Commit f2b1bb2

Browse files
committed
Marking array types as readonly
1 parent 99ee26c commit f2b1bb2

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/vs/base/common/history.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class HistoryNavigator<T> implements INavigator<T> {
1111
private _limit: number;
1212
private _navigator!: ArrayNavigator<T>;
1313

14-
constructor(history: T[] = [], limit: number = 10) {
14+
constructor(history: readonly T[] = [], limit: number = 10) {
1515
this._initialize(history);
1616
this._limit = limit;
1717
this._onChange();
@@ -73,7 +73,7 @@ export class HistoryNavigator<T> implements INavigator<T> {
7373
}
7474
}
7575

76-
private _initialize(history: T[]): void {
76+
private _initialize(history: readonly T[]): void {
7777
this._history = new Set();
7878
for (const entry of history) {
7979
this._history.add(entry);

src/vs/base/common/iterator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ export interface INextIterator<T> {
160160

161161
export class ArrayIterator<T> implements INextIterator<T> {
162162

163-
private items: T[];
163+
private readonly items: readonly T[];
164164
protected start: number;
165165
protected end: number;
166166
protected index: number;
167167

168-
constructor(items: T[], start: number = 0, end: number = items.length, index = start - 1) {
168+
constructor(items: readonly T[], start: number = 0, end: number = items.length, index = start - 1) {
169169
this.items = items;
170170
this.start = start;
171171
this.end = end;
@@ -193,7 +193,7 @@ export class ArrayIterator<T> implements INextIterator<T> {
193193

194194
export class ArrayNavigator<T> extends ArrayIterator<T> implements INavigator<T> {
195195

196-
constructor(items: T[], start: number = 0, end: number = items.length, index = start - 1) {
196+
constructor(items: readonly T[], start: number = 0, end: number = items.length, index = start - 1) {
197197
super(items, start, end, index);
198198
}
199199

0 commit comments

Comments
 (0)