Remove unnecessary operations in Promise.

We're allocating memory we don't use and calling functions that it would make more sense to inline.
This commit is contained in:
player-03
2024-09-02 15:58:21 -04:00
committed by GitHub
parent 96c5c1c121
commit 169e737486

View File

@@ -61,13 +61,13 @@ class Promise<T>
Whether the `Promise` (and related `Future`) has finished with a completion state. Whether the `Promise` (and related `Future`) has finished with a completion state.
This will be `false` if the `Promise` has not been resolved with a completion or error state. This will be `false` if the `Promise` has not been resolved with a completion or error state.
**/ **/
public var isComplete(get, null):Bool; public var isComplete(get, never):Bool;
/** /**
Whether the `Promise` (and related `Future`) has finished with an error state. Whether the `Promise` (and related `Future`) has finished with an error state.
This will be `false` if the `Promise` has not been resolved with a completion or error state. This will be `false` if the `Promise` has not been resolved with a completion or error state.
**/ **/
public var isError(get, null):Bool; public var isError(get, never):Bool;
#if commonjs #if commonjs
private static function __init__() private static function __init__()
@@ -179,12 +179,12 @@ class Promise<T>
} }
// Get & Set Methods // Get & Set Methods
@:noCompletion private function get_isComplete():Bool @:noCompletion private inline function get_isComplete():Bool
{ {
return future.isComplete; return future.isComplete;
} }
@:noCompletion private function get_isError():Bool @:noCompletion private inline function get_isError():Bool
{ {
return future.isError; return future.isError;
} }