-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Contain haxe_ver checks in a single place
This should also fix an issue when built with haxe_ver < 4 where the return value of sortFields() was unused.
- Loading branch information
Showing
3 changed files
with
34 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package dox; | ||
|
||
using Lambda; | ||
|
||
private typedef ContainerType<T> = #if (haxe_ver < 4) List<T> #else Array<T> #end; | ||
|
||
@:forward(filter) | ||
abstract Container<T>(ContainerType<T>) from ContainerType<T> to ContainerType<T> { | ||
public inline function new() { | ||
this = new ContainerType(); | ||
} | ||
|
||
public function sort(f:T->T->Int) { | ||
#if (haxe_ver < 4) | ||
var a = this.array(); | ||
a.sort(f); | ||
return a.list(); | ||
#else | ||
return this; | ||
#end | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters