refactor folders to move "/state" (IApplicationState) inside "/context" (IApplicationContext)

This commit is contained in:
undergroundwires
2020-12-28 22:11:23 +01:00
parent f7557bcc0f
commit 34672414c3
64 changed files with 106 additions and 107 deletions

View File

@@ -0,0 +1,24 @@
import { ICodePosition } from './ICodePosition';
export class CodePosition implements ICodePosition {
public get totalLines(): number {
return this.endLine - this.startLine;
}
constructor(
public readonly startLine: number,
public readonly endLine: number) {
if (startLine < 0) {
throw new Error('Code cannot start in a negative line');
}
if (endLine < 0) {
throw new Error('Code cannot end in a negative line');
}
if (endLine === startLine) {
throw new Error('Empty code');
}
if (endLine < startLine) {
throw new Error('End line cannot be less than start line');
}
}
}