mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-10 13:38:39 +00:00
make SourceLocation fields readonly (#1637)
This commit is contained in:
committed by
ylemkimon
parent
aee4a86a67
commit
ead04e5a29
@@ -6,16 +6,15 @@ import type {LexerInterface} from "./Token";
|
||||
* This object is immutable.
|
||||
*/
|
||||
export default class SourceLocation {
|
||||
lexer: LexerInterface; // Lexer holding the input string.
|
||||
start: number; // Start offset, zero-based inclusive.
|
||||
end: number; // End offset, zero-based exclusive.
|
||||
// The + prefix indicates that these fields aren't writeable
|
||||
+lexer: LexerInterface; // Lexer holding the input string.
|
||||
+start: number; // Start offset, zero-based inclusive.
|
||||
+end: number; // End offset, zero-based exclusive.
|
||||
|
||||
constructor(lexer: LexerInterface, start: number, end: number) {
|
||||
this.lexer = lexer;
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
// $FlowFixMe, do not polyfill
|
||||
Object["freeze"](this); // Immutable to allow sharing in range().
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user