Deprecate foo.#bar.

This commit is contained in:
Christoffer Lerno
2025-06-05 12:51:35 +02:00
parent 7f85534414
commit c9d9127da6
10 changed files with 33 additions and 35 deletions

View File

@@ -284,7 +284,7 @@ macro enum_by_name($Type, String enum_name) @builtin
@ensure @typeis(return, $Type)
@return? NOT_FOUND
*>
macro @enum_from_value($Type, #value, value) @builtin
macro @enum_from_value($Type, #value, value) @builtin @deprecated("Use Enum.lookup_field and Enum.lookup")
{
foreach (e : $Type.values)
{

View File

@@ -30,6 +30,14 @@ macro @enum_lookup($Type, #value, value)
return NOT_FOUND?;
}
macro @enum_lookup_new($Type, $name, value)
{
$foreach $val : $Type.values:
if ($val.$eval($name) == value) return $val;
$endforeach
return NOT_FOUND?;
}
module std::core::runtime @if(WASM_NOLIBC);

View File

@@ -61,7 +61,7 @@ fn void? FixedThreadPool.init(&self, usz threads, usz queue_size = 0)
*>
fn void? FixedThreadPool.destroy(&self)
{
return self.@shutdown(stop_now);
return self.@shutdown(self.stop_now);
}
<*
@@ -70,7 +70,7 @@ fn void? FixedThreadPool.destroy(&self)
*>
fn void? FixedThreadPool.stop_and_destroy(&self)
{
return self.@shutdown(stop);
return self.@shutdown(self.stop);
}
macro void? FixedThreadPool.@shutdown(&self, #stop) @private
@@ -78,7 +78,7 @@ macro void? FixedThreadPool.@shutdown(&self, #stop) @private
if (self.initialized)
{
self.mu.lock()!;
self.#stop = true;
#stop = true;
self.notify.broadcast()!;
self.mu.unlock()!;
// Wait for all threads to shutdown.

View File

@@ -7,7 +7,8 @@ struct ThreadPool
QueueItem[SIZE] queue;
usz qindex;
usz num_threads;
bitstruct : char {
bitstruct : char
{
bool initialized;
bool stop;
bool stop_now;
@@ -46,7 +47,7 @@ fn void? ThreadPool.init(&self)
*>
fn void? ThreadPool.destroy(&self)
{
return self.@shutdown(stop_now);
return self.@shutdown(self.stop_now);
}
<*
@@ -55,7 +56,7 @@ fn void? ThreadPool.destroy(&self)
*>
fn void? ThreadPool.stop_and_destroy(&self)
{
return self.@shutdown(stop);
return self.@shutdown(self.stop);
}
macro void? ThreadPool.@shutdown(&self, #stop) @private
@@ -63,7 +64,7 @@ macro void? ThreadPool.@shutdown(&self, #stop) @private
if (self.initialized)
{
self.mu.lock()!;
self.#stop = true;
#stop = true;
self.notify.broadcast()!;
self.mu.unlock()!;
// Wait for all threads to shutdown.