Skip to content

Commit

Permalink
partial support for #10981
Browse files Browse the repository at this point in the history
  • Loading branch information
ncannasse committed Mar 4, 2023
1 parent 36b9ce7 commit 04db8f4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions std/haxe/EnumFlags.hx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ abstract EnumFlags<T:EnumValue>(Int) {
this = i;
}

@:from static function from<T:EnumValue>(e:T) : EnumFlags<T> {
return new EnumFlags(1 << e.getIndex());
}

@:op(a|b) function or(f:haxe.EnumFlags<T>) : haxe.EnumFlags<T>;
@:op(a&b) function and(f:haxe.EnumFlags<T>) : haxe.EnumFlags<T>;
@:op(a^b) function xor(f:haxe.EnumFlags<T>) : haxe.EnumFlags<T>;

/**
Checks if the index of enum instance `v` is set.
Expand Down

0 comments on commit 04db8f4

Please sign in to comment.