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> {
302302 }
303303
304304 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+
305308 var length = this . length_ ;
306309 if ( length <= 1 ) return this ;
307310 var buffer = this . buffer_ ;
@@ -316,7 +319,7 @@ export class Array<T> {
316319 }
317320
318321 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
320323 return changetype < this> ( insertionSort < T > ( this , comparator ) ) ;
321324 } else {
322325 return changetype < this> ( length < 256
Original file line number Diff line number Diff line change 49374937 (local $2 i32 )
49384938 (local $3 i32 )
49394939 (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+ )
49404954 (if
49414955 (i32.le_s
49424956 (tee_local $2
52545268 (local $2 i32 )
52555269 (local $3 i32 )
52565270 (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+ )
52575285 (if
52585286 (i32.le_s
52595287 (tee_local $2
Original file line number Diff line number Diff line change 61756175 (local $4 i32 )
61766176 (local $5 i32 )
61776177 (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+ )
61786192 (set_local $2
61796193 (i32.load offset = 4
61806194 (get_local $0 )
68996913 (local $4 i32 )
69006914 (local $5 i32 )
69016915 (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+ )
69026930 (set_local $2
69036931 (i32.load offset = 4
69046932 (get_local $0 )
74957523 (local $4 i32 )
74967524 (local $5 i32 )
74977525 (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+ )
74987540 (set_local $2
74997541 (i32.load offset = 4
75007542 (get_local $0 )
81508192 (local $4 i32 )
81518193 (local $5 i32 )
81528194 (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+ )
81538209 (set_local $2
81548210 (i32.load offset = 4
81558211 (get_local $0 )
You can’t perform that action at this time.
0 commit comments