@@ -32,10 +32,6 @@ export class AbstractMirrorModel extends TextModelWithTokens implements editorCo
3232 }
3333
3434 public getModeId ( ) : string {
35- if ( this . _isDisposed ) {
36- throw new Error ( 'AbstractMirrorModel.getModeId: Model is disposed' ) ;
37- }
38-
3935 return this . getMode ( ) . getId ( ) ;
4036 }
4137
@@ -63,10 +59,6 @@ export class AbstractMirrorModel extends TextModelWithTokens implements editorCo
6359 }
6460
6561 public getAssociatedResource ( ) : URI {
66- if ( this . _isDisposed ) {
67- throw new Error ( 'AbstractMirrorModel.getAssociatedResource: Model is disposed' ) ;
68- }
69-
7062 return this . _associatedResource ;
7163 }
7264
@@ -82,10 +74,6 @@ export class AbstractMirrorModel extends TextModelWithTokens implements editorCo
8274 }
8375
8476 public getRangeFromOffsetAndLength ( offset :number , length :number ) :editorCommon . IRange {
85- if ( this . _isDisposed ) {
86- throw new Error ( 'AbstractMirrorModel.getRangeFromOffsetAndLength: Model is disposed' ) ;
87- }
88-
8977 var startPosition = this . getPositionFromOffset ( offset ) ,
9078 endPosition = this . getPositionFromOffset ( offset + length ) ;
9179 return {
@@ -97,10 +85,6 @@ export class AbstractMirrorModel extends TextModelWithTokens implements editorCo
9785 }
9886
9987 public getOffsetAndLengthFromRange ( range :editorCommon . IRange ) :{ offset :number ; length :number ; } {
100- if ( this . _isDisposed ) {
101- throw new Error ( 'AbstractMirrorModel.getOffsetAndLengthFromRange: Model is disposed' ) ;
102- }
103-
10488 var startOffset = this . getOffsetFromPosition ( { lineNumber : range . startLineNumber , column : range . startColumn } ) ,
10589 endOffset = this . getOffsetFromPosition ( { lineNumber : range . endLineNumber , column : range . endColumn } ) ;
10690 return {
@@ -110,10 +94,6 @@ export class AbstractMirrorModel extends TextModelWithTokens implements editorCo
11094 }
11195
11296 public getPositionFromOffset ( offset :number ) :editorCommon . IPosition {
113- if ( this . _isDisposed ) {
114- throw new Error ( 'AbstractMirrorModel.getPositionFromOffset: Model is disposed' ) ;
115- }
116-
11797 this . _ensurePrefixSum ( ) ;
11898
11999 let r = this . _lineStarts . getIndexOf ( offset ) ;
@@ -124,28 +104,17 @@ export class AbstractMirrorModel extends TextModelWithTokens implements editorCo
124104 }
125105
126106 public getOffsetFromPosition ( position :editorCommon . IPosition ) : number {
127- if ( this . _isDisposed ) {
128- throw new Error ( 'AbstractMirrorModel.getOffsetFromPosition: Model is disposed' ) ;
129- }
130-
131107 return this . getLineStart ( position . lineNumber ) + position . column - 1 /* column isn't zero-index based */ ;
132108 }
133109
134110 public getLineStart ( lineNumber :number ) : number {
135- if ( this . _isDisposed ) {
136- throw new Error ( 'AbstractMirrorModel.getLineStart: Model is disposed' ) ;
137- }
138-
139111 this . _ensurePrefixSum ( ) ;
140112
141113 var lineIndex = Math . min ( lineNumber , this . _lines . length ) - 1 ;
142114 return this . _lineStarts . getAccumulatedValue ( lineIndex - 1 ) ;
143115 }
144116
145117 public getAllWordsWithRange ( ) : editorCommon . IRangeWithText [ ] {
146- if ( this . _isDisposed ) {
147- throw new Error ( 'AbstractMirrorModel.getAllWordsWithRange: Model is disposed' ) ;
148- }
149118 if ( this . _lines . length > 10000 ) {
150119 // This is a very heavy method, unavailable for very heavy models
151120 return [ ] ;
@@ -169,10 +138,6 @@ export class AbstractMirrorModel extends TextModelWithTokens implements editorCo
169138 }
170139
171140 public getAllWords ( ) : string [ ] {
172- if ( this . _isDisposed ) {
173- throw new Error ( 'AbstractMirrorModel.getAllWords: Model is disposed' ) ;
174- }
175-
176141 var result :string [ ] = [ ] ;
177142 this . _lines . forEach ( ( line ) => {
178143 this . wordenize ( line . text ) . forEach ( ( info ) => {
@@ -183,10 +148,6 @@ export class AbstractMirrorModel extends TextModelWithTokens implements editorCo
183148 }
184149
185150 public getAllUniqueWords ( skipWordOnce ?:string ) : string [ ] {
186- if ( this . _isDisposed ) {
187- throw new Error ( 'AbstractMirrorModel.getAllUniqueWords: Model is disposed' ) ;
188- }
189-
190151 var foundSkipWord = false ;
191152 var uniqueWords = { } ;
192153 return this . getAllWords ( ) . filter ( ( word ) => {
@@ -308,10 +269,6 @@ export class MirrorModel extends AbstractMirrorModel implements editorCommon.IMi
308269 }
309270
310271 public getEmbeddedAtPosition ( position :editorCommon . IPosition ) :editorCommon . IMirrorModel {
311- if ( this . _isDisposed ) {
312- throw new Error ( 'MirrorModel.getEmbeddedAtPosition: Model is disposed' ) ;
313- }
314-
315272 var modeAtPosition = this . getModeAtPosition ( position . lineNumber , position . column ) ;
316273 if ( this . _embeddedModels . hasOwnProperty ( modeAtPosition . getId ( ) ) ) {
317274 return this . _embeddedModels [ modeAtPosition . getId ( ) ] ;
@@ -320,10 +277,6 @@ export class MirrorModel extends AbstractMirrorModel implements editorCommon.IMi
320277 }
321278
322279 public getAllEmbedded ( ) :editorCommon . IMirrorModel [ ] {
323- if ( this . _isDisposed ) {
324- throw new Error ( 'MirrorModel.getAllEmbedded: Model is disposed' ) ;
325- }
326-
327280 return Object . keys ( this . _embeddedModels ) . map ( ( embeddedModeId ) => this . _embeddedModels [ embeddedModeId ] ) ;
328281 }
329282
@@ -434,10 +387,6 @@ export class MirrorModel extends AbstractMirrorModel implements editorCommon.IMi
434387 }
435388
436389 public onEvents ( events :IMirrorModelEvents ) : boolean {
437- if ( this . _isDisposed ) {
438- throw new Error ( 'MirrorModel.onEvents: Model is disposed' ) ;
439- }
440-
441390 let changed = false ;
442391 for ( let i = 0 , len = events . contentChanged . length ; i < len ; i ++ ) {
443392 let contentChangedEvent = events . contentChanged [ i ] ;
0 commit comments