import { ICodePosition } from './ICodePosition' ; export class CodePosition implements ICodePosition { public get totalLines ( ) : number { return this . endLine - this . startLine ; } constructor ( public readonly startLine , public readonly endLine ) { 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' ) ; } } }