Skip to content

Commit

Permalink
feat: improve enumerator even more
Browse files Browse the repository at this point in the history
  • Loading branch information
xhayper committed Dec 2, 2023
1 parent 48a4198 commit 8b82cb7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/internal/enumerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export class Enumerator<T> implements Iterable<T> {

constructor(private _source: Iterable<T>) {}

public get current(): T {
return this._current!;
public get current(): T | undefined {
return this._current;
}

public get index(): number {
Expand Down Expand Up @@ -37,7 +37,7 @@ export class Enumerator<T> implements Iterable<T> {
next: () => {
this.moveNext();
return {
value: this.current,
value: this.current!,
done: this.done,
};
},
Expand Down
2 changes: 1 addition & 1 deletion src/internal/syntacticAnalysis/deserializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class Deserializer {
let manuallyMoved = false;

while (!this.endOfFile && (manuallyMoved || this.moveNext())) {
const token = this.enumerator.current;
const token = this.enumerator.current!;
manuallyMoved = false;

switch (token.type) {
Expand Down

0 comments on commit 8b82cb7

Please sign in to comment.