File tree Expand file tree Collapse file tree 3 files changed +88
-1
lines changed Expand file tree Collapse file tree 3 files changed +88
-1
lines changed Original file line number Diff line number Diff line change @@ -302,6 +302,9 @@ export class Array<T> {
302
302
}
303
303
304
304
sort ( comparator : ( a : T , b : T ) => i32 = defaultComparator < T > ( ) ) : this {
305
+ // TODO remove this when flow will allow trackcing null
306
+ assert ( comparator ) ; // The comparison function must be a function
307
+
305
308
var length = this . length_ ;
306
309
if ( length <= 1 ) return this ;
307
310
var buffer = this . buffer_ ;
@@ -316,7 +319,7 @@ export class Array<T> {
316
319
}
317
320
318
321
if ( isReference < T > ( ) ) {
319
- // TODO replace this to stable sort when it implemented
322
+ // TODO replace this to faster stable sort (TimSort) when it implemented
320
323
return changetype < this> ( insertionSort < T > ( this , comparator ) ) ;
321
324
} else {
322
325
return changetype < this> ( length < 256
Original file line number Diff line number Diff line change 4937
4937
(local $2 i32 )
4938
4938
(local $3 i32 )
4939
4939
(local $4 i32 )
4940
+ (if
4941
+ (i32.eqz
4942
+ (get_local $1 )
4943
+ )
4944
+ (block
4945
+ (call $~lib/env/abort
4946
+ (i32.const 0 )
4947
+ (i32.const 8 )
4948
+ (i32.const 306 )
4949
+ (i32.const 4 )
4950
+ )
4951
+ (unreachable )
4952
+ )
4953
+ )
4940
4954
(if
4941
4955
(i32.le_s
4942
4956
(tee_local $2
5254
5268
(local $2 i32 )
5255
5269
(local $3 i32 )
5256
5270
(local $4 i32 )
5271
+ (if
5272
+ (i32.eqz
5273
+ (get_local $1 )
5274
+ )
5275
+ (block
5276
+ (call $~lib/env/abort
5277
+ (i32.const 0 )
5278
+ (i32.const 8 )
5279
+ (i32.const 306 )
5280
+ (i32.const 4 )
5281
+ )
5282
+ (unreachable )
5283
+ )
5284
+ )
5257
5285
(if
5258
5286
(i32.le_s
5259
5287
(tee_local $2
Original file line number Diff line number Diff line change 6175
6175
(local $4 i32 )
6176
6176
(local $5 i32 )
6177
6177
(local $6 i32 )
6178
+ (if
6179
+ (i32.eqz
6180
+ (get_local $1 )
6181
+ )
6182
+ (block
6183
+ (call $~lib/env/abort
6184
+ (i32.const 0 )
6185
+ (i32.const 8 )
6186
+ (i32.const 306 )
6187
+ (i32.const 4 )
6188
+ )
6189
+ (unreachable )
6190
+ )
6191
+ )
6178
6192
(set_local $2
6179
6193
(i32.load offset = 4
6180
6194
(get_local $0 )
6899
6913
(local $4 i32 )
6900
6914
(local $5 i32 )
6901
6915
(local $6 i32 )
6916
+ (if
6917
+ (i32.eqz
6918
+ (get_local $1 )
6919
+ )
6920
+ (block
6921
+ (call $~lib/env/abort
6922
+ (i32.const 0 )
6923
+ (i32.const 8 )
6924
+ (i32.const 306 )
6925
+ (i32.const 4 )
6926
+ )
6927
+ (unreachable )
6928
+ )
6929
+ )
6902
6930
(set_local $2
6903
6931
(i32.load offset = 4
6904
6932
(get_local $0 )
7495
7523
(local $4 i32 )
7496
7524
(local $5 i32 )
7497
7525
(local $6 i32 )
7526
+ (if
7527
+ (i32.eqz
7528
+ (get_local $1 )
7529
+ )
7530
+ (block
7531
+ (call $~lib/env/abort
7532
+ (i32.const 0 )
7533
+ (i32.const 8 )
7534
+ (i32.const 306 )
7535
+ (i32.const 4 )
7536
+ )
7537
+ (unreachable )
7538
+ )
7539
+ )
7498
7540
(set_local $2
7499
7541
(i32.load offset = 4
7500
7542
(get_local $0 )
8150
8192
(local $4 i32 )
8151
8193
(local $5 i32 )
8152
8194
(local $6 i32 )
8195
+ (if
8196
+ (i32.eqz
8197
+ (get_local $1 )
8198
+ )
8199
+ (block
8200
+ (call $~lib/env/abort
8201
+ (i32.const 0 )
8202
+ (i32.const 8 )
8203
+ (i32.const 306 )
8204
+ (i32.const 4 )
8205
+ )
8206
+ (unreachable )
8207
+ )
8208
+ )
8153
8209
(set_local $2
8154
8210
(i32.load offset = 4
8155
8211
(get_local $0 )
You can’t perform that action at this time.
0 commit comments