Prechádzať zdrojové kódy

Fix doc gen for atomics, conditions and semaphores. (#10949)

Fixes https://github.com/HaxeFoundation/haxe/issues/10948
Fixes https://github.com/HaxeFoundation/haxe/issues/10947
Zeta 2 rokov pred
rodič
commit
569b486684

+ 0 - 1
std/cpp/_std/haxe/atomic/AtomicInt.hx

@@ -1,6 +1,5 @@
 package haxe.atomic;
 
-@:noDoc
 #if cppia
 extern
 #end

+ 0 - 1
std/cpp/_std/sys/thread/Condition.hx

@@ -1,6 +1,5 @@
 package sys.thread;
 
-@:noDoc
 @:coreApi
 class Condition {
 	var c:Dynamic;

+ 0 - 1
std/cpp/_std/sys/thread/Semaphore.hx

@@ -1,6 +1,5 @@
 package sys.thread;
 
-@:noDoc
 @:coreApi
 class Semaphore {
 	var m:Dynamic;

+ 1 - 2
std/cs/_std/haxe/atomic/AtomicInt.hx

@@ -8,8 +8,7 @@ private class IntWrapper {
 	}
 }
 
-@:noDoc
-abstract AtomicInt(IntWrapper) to IntWrapper {
+abstract AtomicInt(IntWrapper) {
 	public inline function new(value:Int) {
 		this = new IntWrapper(value);
 	}

+ 0 - 1
std/cs/_std/sys/thread/Condition.hx

@@ -2,7 +2,6 @@ package sys.thread;
 
 import cs.system.threading.Monitor;
 
-@:noDoc
 @:coreApi
 @:access(sys.thread.Mutex)
 class Condition {

+ 0 - 1
std/cs/_std/sys/thread/Semaphore.hx

@@ -1,6 +1,5 @@
 package sys.thread;
 
-@:noDoc
 @:coreApi
 class Semaphore {
 	final native:cs.system.threading.Semaphore;

+ 0 - 1
std/eval/_std/sys/thread/Condition.hx

@@ -1,6 +1,5 @@
 package sys.thread;
 
-@:noDoc
 @:coreApi class Condition {
 	final cond:eval.luv.Condition;
 	final mutex:eval.luv.Mutex;

+ 0 - 1
std/eval/_std/sys/thread/Semaphore.hx

@@ -1,6 +1,5 @@
 package sys.thread;
 
-@:noDoc
 @:coreApi class Semaphore {
 	final native:eval.luv.Semaphore;
 

+ 0 - 1
std/haxe/atomic/AtomicInt.hx

@@ -8,7 +8,6 @@ package haxe.atomic;
 	Atomic integer.
 	(js) The Atomics and SharedArrayBuffer objects need to be available. Errors will be thrown if this is not the case.
 **/
-@:noDoc
 @:coreType
 abstract AtomicInt {
 	public function new(value:Int):Void;

+ 0 - 1
std/hl/_std/haxe/atomic/AtomicInt.hx

@@ -5,7 +5,6 @@ package haxe.atomic;
 #end
 import hl.Atomics;
 
-@:noDoc
 abstract AtomicInt(hl.NativeArray<Int>) {
 	public inline function new(value:Int):Void {
 		this = new hl.NativeArray(1);

+ 18 - 1
std/hl/_std/sys/thread/Condition.hx

@@ -1,6 +1,22 @@
 package sys.thread;
 
-@:noDoc
+#if doc_gen
+@:coreApi extern class Condition {
+	function new():Void;
+
+	public function acquire():Void;
+
+	public function tryAcquire():Bool;
+
+	public function release():Void;
+
+	public function wait():Void;
+
+	public function signal():Void;
+
+	public function broadcast():Void;
+}
+#else
 abstract Condition(hl.Abstract<"hl_condition">) {
 	public function new():Void {
 		this = alloc();
@@ -31,3 +47,4 @@ abstract Condition(hl.Abstract<"hl_condition">) {
 		return null;
 	}
 }
+#end

+ 9 - 1
std/hl/_std/sys/thread/Semaphore.hx

@@ -1,6 +1,13 @@
 package sys.thread;
 
-@:noDoc
+#if doc_gen
+@:coreApi extern class Semaphore {
+	function new(value:Int):Void;
+	function acquire():Void;
+	function tryAcquire(?timeout:Float):Bool;
+	function release():Void;
+}
+#else
 abstract Semaphore(hl.Abstract<"hl_semaphore">) {
 	public function new(value:Int):Void {
 		this = alloc(value);
@@ -22,3 +29,4 @@ abstract Semaphore(hl.Abstract<"hl_semaphore">) {
 		return null;
 	}
 }
+#end

+ 0 - 1
std/java/_std/haxe/atomic/AtomicInt.hx

@@ -2,7 +2,6 @@ package haxe.atomic;
 
 import java.util.concurrent.atomic.AtomicInteger;
 
-@:noDoc
 abstract AtomicInt(AtomicInteger) {
 	public inline function new(value:Int) {
 		this = new AtomicInteger(value);

+ 0 - 1
std/java/_std/sys/thread/Condition.hx

@@ -3,7 +3,6 @@ package sys.thread;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.concurrent.locks.Condition as NativeCondition;
 
-@:noDoc
 @:access(sys.thread.Mutex)
 @:coreApi
 @:native('haxe.java.vm.Condition')

+ 0 - 1
std/java/_std/sys/thread/Semaphore.hx

@@ -2,7 +2,6 @@ package sys.thread;
 
 import java.util.concurrent.TimeUnit;
 
-@:noDoc
 @:coreApi
 @:native('haxe.java.vm.Semaphore')
 class Semaphore {

+ 14 - 11
std/js/_std/haxe/atomic/AtomicInt.hx

@@ -2,46 +2,49 @@ package haxe.atomic;
 
 import js.lib.Atomics;
 
-@:noDoc
-abstract AtomicInt(js.lib.Int32Array) to js.lib.Int32Array {
+abstract AtomicInt(js.lib.Int32Array) {
 	public inline function new(value:Int) {
 		this = new js.lib.Int32Array(new js.lib.SharedArrayBuffer(js.lib.Int32Array.BYTES_PER_ELEMENT));
 		this[0] = value;
 	}
 
+	private function asArray():js.lib.Int32Array {
+		return this;
+	}
+
 	public inline function add(b:Int):Int {
-		return Atomics.add(this, 0, b);
+		return Atomics.add(asArray(), 0, b);
 	}
 
 	public inline function sub(b:Int):Int {
-		return Atomics.sub(this, 0, b);
+		return Atomics.sub(asArray(), 0, b);
 	}
 
 	public inline function and(b:Int):Int {
-		return Atomics.and(this, 0, b);
+		return Atomics.and(asArray(), 0, b);
 	}
 
 	public inline function or(b:Int):Int {
-		return Atomics.or(this, 0, b);
+		return Atomics.or(asArray(), 0, b);
 	}
 
 	public inline function xor(b:Int):Int {
-		return Atomics.xor(this, 0, b);
+		return Atomics.xor(asArray(), 0, b);
 	}
 
 	public inline function compareExchange(expected:Int, replacement:Int):Int {
-		return Atomics.compareExchange(this, 0, expected, replacement);
+		return Atomics.compareExchange(asArray(), 0, expected, replacement);
 	}
 
 	public inline function exchange(value:Int):Int {
-		return Atomics.exchange(this, 0, value);
+		return Atomics.exchange(asArray(), 0, value);
 	}
 
 	public inline function load():Int {
-		return Atomics.load(this, 0);
+		return Atomics.load(asArray(), 0);
 	}
 
 	public inline function store(value:Int):Int {
-		return Atomics.store(this, 0, value);
+		return Atomics.store(asArray(), 0, value);
 	}
 }

+ 0 - 1
std/python/_std/sys/thread/Condition.hx

@@ -1,6 +1,5 @@
 package sys.thread;
 
-@:noDoc
 @:coreApi
 class Condition {
 	final cond:python.lib.threading.Condition;

+ 0 - 1
std/python/_std/sys/thread/Semaphore.hx

@@ -2,7 +2,6 @@ package sys.thread;
 
 import python.lib.threading.Semaphore as NativeSemaphore;
 
-@:noDoc
 @:coreApi
 class Semaphore {
 	final semaphore:NativeSemaphore;

+ 0 - 1
std/sys/thread/Condition.hx

@@ -10,7 +10,6 @@ package sys.thread;
 	until another thread modifies a shared variable (the condition)
 	and signals the condition variable.
 **/
-@:noDoc
 @:coreApi extern class Condition {
 	/**
 		Create a new condition variable.

+ 0 - 1
std/sys/thread/Semaphore.hx

@@ -3,7 +3,6 @@ package sys.thread;
 #if (!target.threaded)
 #error "This class is not available on this target"
 #end
-@:noDoc
 @:coreApi extern class Semaphore {
 	/**
 		Creates a new semaphore with an initial value.