File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/vs/platform/contextkey/common Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -311,7 +311,7 @@ class ParseError extends Error { }
311
311
export class Parser {
312
312
313
313
private _tokens : Token [ ] = [ ] ;
314
- private _current = 0 ;
314
+ private _current = 0 ; // invariant: 0 <= this._current < this._tokens.length ; any incrementation of this value must first call `_isAtEnd`
315
315
private _parsingErrors : string [ ] = [ ] ;
316
316
private _scanner = new Scanner ( ) ;
317
317
@@ -575,9 +575,12 @@ export class Parser {
575
575
}
576
576
577
577
private _check ( type : TokenType ) {
578
- return ! this . _isAtEnd ( ) && this . _peek ( ) . type === type ;
578
+ return this . _peek ( ) . type === type ;
579
579
}
580
580
581
+ /*
582
+ Careful: the function doesn't check array bounds.
583
+ */
581
584
private _peek ( ) {
582
585
return this . _tokens [ this . _current ] ;
583
586
}
You can’t perform that action at this time.
0 commit comments