2
0
Эх сурвалжийг харах

[std] more consistent backtick usage in docs of the haxe package

Jens Fischer 6 жил өмнө
parent
commit
130a9271e5

+ 12 - 12
std/haxe/Constraints.hx

@@ -44,10 +44,10 @@ abstract FlatEnum(Dynamic) {}
 	This type unifies with any instance of classes that have a constructor
 	This type unifies with any instance of classes that have a constructor
 	which
 	which
 
 
-	  * is public and
+	  * is `public` and
 	  * unifies with the type used for type parameter `T`.
 	  * unifies with the type used for type parameter `T`.
 
 
-	If a type parameter A is assigned to a type parameter B which is constrained
+	If a type parameter `A` is assigned to a type parameter `B` which is constrained
 	to `Constructible<T>`, A must be explicitly constrained to
 	to `Constructible<T>`, A must be explicitly constrained to
 	`Constructible<T>` as well.
 	`Constructible<T>` as well.
 
 
@@ -57,14 +57,14 @@ abstract FlatEnum(Dynamic) {}
 abstract Constructible<T>(Dynamic) {}
 abstract Constructible<T>(Dynamic) {}
 
 
 interface IMap<K, V> {
 interface IMap<K, V> {
-	public function get(k:K):Null<V>;
-	public function set(k:K, v:V):Void;
-	public function exists(k:K):Bool;
-	public function remove(k:K):Bool;
-	public function keys():Iterator<K>;
-	public function iterator():Iterator<V>;
-	public function keyValueIterator():KeyValueIterator<K, V>;
-	public function copy():IMap<K, V>;
-	public function toString():String;
-	public function clear():Void;
+	function get(k:K):Null<V>;
+	function set(k:K, v:V):Void;
+	function exists(k:K):Bool;
+	function remove(k:K):Bool;
+	function keys():Iterator<K>;
+	function iterator():Iterator<V>;
+	function keyValueIterator():KeyValueIterator<K, V>;
+	function copy():IMap<K, V>;
+	function toString():String;
+	function clear():Void;
 }
 }

+ 2 - 2
std/haxe/EntryPoint.hx

@@ -29,7 +29,7 @@ private class Thread {
 #end
 #end
 
 
 /**
 /**
-	If haxe.MainLoop is kept from DCE, then we will insert an haxe.EntryPoint.run() call just at then end of main().
+	If `haxe.MainLoop` is kept from DCE, then we will insert an `haxe.EntryPoint.run()` call just at then end of `main()`.
 	This class can be redefined by custom frameworks so they can handle their own main loop logic.
 	This class can be redefined by custom frameworks so they can handle their own main loop logic.
 **/
 **/
 class EntryPoint {
 class EntryPoint {
@@ -41,7 +41,7 @@ class EntryPoint {
 	public static var threadCount(default, null):Int = 0;
 	public static var threadCount(default, null):Int = 0;
 
 
 	/**
 	/**
-		Wakeup a sleeping run()
+		Wakeup a sleeping `run()`
 	**/
 	**/
 	public static function wakeup() {
 	public static function wakeup() {
 		#if sys
 		#if sys

+ 8 - 8
std/haxe/EnumFlags.hx

@@ -29,8 +29,8 @@ package haxe;
 
 
 	Enum constructor indices are preserved from Haxe syntax, so the first
 	Enum constructor indices are preserved from Haxe syntax, so the first
 	declared is index 0, the next index 1 etc. The methods are optimized if the
 	declared is index 0, the next index 1 etc. The methods are optimized if the
-	enum instance is passed directly, e.g. as has(EnumCtor). Otherwise
-	Type.enumIndex() reflection is used.
+	enum instance is passed directly, e.g. as `has(EnumCtor)`. Otherwise
+	`Type.enumIndex()` reflection is used.
 **/
 **/
 abstract EnumFlags<T:EnumValue>(Int) {
 abstract EnumFlags<T:EnumValue>(Int) {
 	/**
 	/**
@@ -44,9 +44,9 @@ abstract EnumFlags<T:EnumValue>(Int) {
 		Checks if the index of enum instance `v` is set.
 		Checks if the index of enum instance `v` is set.
 
 
 		This method is optimized if `v` is an enum instance expression such as
 		This method is optimized if `v` is an enum instance expression such as
-		SomeEnum.SomeCtor.
+		`SomeEnum.SomeCtor`.
 
 
-		If `v` is null, the result is unspecified.
+		If `v` is `null`, the result is unspecified.
 	**/
 	**/
 	public inline function has(v:T):Bool {
 	public inline function has(v:T):Bool {
 		return this & (1 << Type.enumIndex(v)) != 0;
 		return this & (1 << Type.enumIndex(v)) != 0;
@@ -56,9 +56,9 @@ abstract EnumFlags<T:EnumValue>(Int) {
 		Sets the index of enum instance `v`.
 		Sets the index of enum instance `v`.
 
 
 		This method is optimized if `v` is an enum instance expression such as
 		This method is optimized if `v` is an enum instance expression such as
-		SomeEnum.SomeCtor.
+		`SomeEnum.SomeCtor`.
 
 
-		If `v` is null, the result is unspecified.
+		If `v` is `null`, the result is unspecified.
 	**/
 	**/
 	public inline function set(v:T):Void {
 	public inline function set(v:T):Void {
 		this |= 1 << Type.enumIndex(v);
 		this |= 1 << Type.enumIndex(v);
@@ -68,9 +68,9 @@ abstract EnumFlags<T:EnumValue>(Int) {
 		Unsets the index of enum instance `v`.
 		Unsets the index of enum instance `v`.
 
 
 		This method is optimized if `v` is an enum instance expression such as
 		This method is optimized if `v` is an enum instance expression such as
-		SomeEnum.SomeCtor.
+		`SomeEnum.SomeCtor`.
 
 
-		If `v` is null, the result is unspecified.
+		If `v` is `null`, the result is unspecified.
 	**/
 	**/
 	public inline function unset(v:T):Void {
 	public inline function unset(v:T):Void {
 		this &= 0xFFFFFFFF - (1 << Type.enumIndex(v));
 		this &= 0xFFFFFFFF - (1 << Type.enumIndex(v));

+ 4 - 2
std/haxe/EnumTools.hx

@@ -28,7 +28,7 @@ package haxe;
 	  [extension](https://haxe.org/manual/lf-static-extension.html) to the
 	  [extension](https://haxe.org/manual/lf-static-extension.html) to the
 	  `enum` types.
 	  `enum` types.
 
 
-	If the first argument to any of the methods is null, the result is
+	If the first argument to any of the methods is `null`, the result is
 	unspecified.
 	unspecified.
 **/
 **/
 extern class EnumTools {
 extern class EnumTools {
@@ -37,7 +37,9 @@ extern class EnumTools {
 
 
 		If `e` is inside a package, the package structure is returned dot-
 		If `e` is inside a package, the package structure is returned dot-
 		separated, with another dot separating the enum name:
 		separated, with another dot separating the enum name:
+		
 			pack1.pack2.(...).packN.EnumName
 			pack1.pack2.(...).packN.EnumName
+
 		If `e` is a sub-type of a Haxe module, that module is not part of the
 		If `e` is a sub-type of a Haxe module, that module is not part of the
 		package structure.
 		package structure.
 
 
@@ -116,7 +118,7 @@ extern class EnumTools {
 	  [extension](https://haxe.org/manual/lf-static-extension.html) to the
 	  [extension](https://haxe.org/manual/lf-static-extension.html) to the
 	  `EnumValue` types.
 	  `EnumValue` types.
 
 
-	If the first argument to any of the methods is null, the result is
+	If the first argument to any of the methods is `null`, the result is
 	unspecified.
 	unspecified.
 **/
 **/
 extern class EnumValueTools {
 extern class EnumValueTools {

+ 2 - 2
std/haxe/PosInfos.hx

@@ -23,11 +23,11 @@
 package haxe;
 package haxe;
 
 
 /**
 /**
-	PosInfos is a magic type which can be used to generate position information
+	`PosInfos` is a magic type which can be used to generate position information
 	into the output for debugging use.
 	into the output for debugging use.
 
 
 	If a function has a final optional argument of this type, i.e.
 	If a function has a final optional argument of this type, i.e.
-	(..., ?pos:haxe.PosInfos), each call to that function which does not assign
+	`(..., ?pos:haxe.PosInfos)`, each call to that function which does not assign
 	a value to that argument has its position added as call argument.
 	a value to that argument has its position added as call argument.
 
 
 	This can be used to track positions of calls in e.g. a unit testing
 	This can be used to track positions of calls in e.g. a unit testing

+ 8 - 8
std/haxe/Resource.hx

@@ -24,28 +24,28 @@ package haxe;
 
 
 /**
 /**
 	Resource can be used to access resources that were added through the
 	Resource can be used to access resources that were added through the
-	-resource file@name command line parameter.
+	`--resource file@name` command line parameter.
 
 
-	Depending on their type they can be obtained as String through
-	getString(name), or as binary data through getBytes(name).
+	Depending on their type they can be obtained as `String` through
+	`getString(name)`, or as binary data through `getBytes(name)`.
 
 
-	A list of all available resource names can be obtained from listNames().
+	A list of all available resource names can be obtained from `listNames()`.
 **/
 **/
 class Resource {
 class Resource {
 	static var content:Array<{name:String, data:String, str:String}>;
 	static var content:Array<{name:String, data:String, str:String}>;
 
 
 	/**
 	/**
 		Lists all available resource names. The resource name is the name part
 		Lists all available resource names. The resource name is the name part
-		of the -resource file@name command line parameter.
+		of the `--resource file@name` command line parameter.
 	**/
 	**/
 	public static function listNames():Array<String> {
 	public static function listNames():Array<String> {
 		return [for (x in content) x.name];
 		return [for (x in content) x.name];
 	}
 	}
 
 
 	/**
 	/**
-		Retrieves the resource identified by `name` as a String.
+		Retrieves the resource identified by `name` as a `String`.
 
 
-		If `name` does not match any resource name, null is returned.
+		If `name` does not match any resource name, `null` is returned.
 	**/
 	**/
 	public static function getString(name:String):String {
 	public static function getString(name:String):String {
 		for (x in content)
 		for (x in content)
@@ -66,7 +66,7 @@ class Resource {
 		Retrieves the resource identified by `name` as an instance of
 		Retrieves the resource identified by `name` as an instance of
 		haxe.io.Bytes.
 		haxe.io.Bytes.
 
 
-		If `name` does not match any resource name, null is returned.
+		If `name` does not match any resource name, `null` is returned.
 	**/
 	**/
 	public static function getBytes(name:String):haxe.io.Bytes {
 	public static function getBytes(name:String):haxe.io.Bytes {
 		for (x in content)
 		for (x in content)

+ 9 - 9
std/haxe/Serializer.hx

@@ -51,8 +51,8 @@ class Serializer {
 		This may also reduce the size of serialization Strings at the expense of
 		This may also reduce the size of serialization Strings at the expense of
 		performance.
 		performance.
 
 
-		This value can be changed for individual instances of Serializer by
-		setting their useCache field.
+		This value can be changed for individual instances of `Serializer` by
+		setting their `useCache` field.
 	**/
 	**/
 	public static var USE_CACHE = false;
 	public static var USE_CACHE = false;
 
 
@@ -63,8 +63,8 @@ class Serializer {
 		suited for long-term storage: If constructors are removed or added from
 		suited for long-term storage: If constructors are removed or added from
 		the enum, the indices may no longer match.
 		the enum, the indices may no longer match.
 
 
-		This value can be changed for individual instances of Serializer by
-		setting their useEnumIndex field.
+		This value can be changed for individual instances of `Serializer` by
+		setting their `useEnumIndex` field.
 	**/
 	**/
 	public static var USE_ENUM_INDEX = false;
 	public static var USE_ENUM_INDEX = false;
 
 
@@ -79,14 +79,14 @@ class Serializer {
 	/**
 	/**
 		The individual cache setting for `this` Serializer instance.
 		The individual cache setting for `this` Serializer instance.
 
 
-		See USE_CACHE for a complete description.
+		See `USE_CACHE` for a complete description.
 	**/
 	**/
 	public var useCache:Bool;
 	public var useCache:Bool;
 
 
 	/**
 	/**
 		The individual enum index setting for `this` Serializer instance.
 		The individual enum index setting for `this` Serializer instance.
 
 
-		See USE_ENUM_INDEX for a complete description.
+		See `USE_ENUM_INDEX` for a complete description.
 	**/
 	**/
 	public var useEnumIndex:Bool;
 	public var useEnumIndex:Bool;
 
 
@@ -97,8 +97,8 @@ class Serializer {
 		internal buffer of this String. Once complete, the contents can be
 		internal buffer of this String. Once complete, the contents can be
 		retrieved through a call to `this.toString`.
 		retrieved through a call to `this.toString`.
 
 
-		Each Serializer instance maintains its own cache if this.useCache` is
-		true.
+		Each `Serializer` instance maintains its own cache if `this.useCache` is
+		`true`.
 	**/
 	**/
 	public function new() {
 	public function new() {
 		buf = new StringBuf();
 		buf = new StringBuf();
@@ -570,7 +570,7 @@ class Serializer {
 
 
 	This is a convenience function for creating a new instance of
 	This is a convenience function for creating a new instance of
 	Serializer, serialize `v` into it and obtain the result through a call
 	Serializer, serialize `v` into it and obtain the result through a call
-	to toString().
+	to `toString()`.
 **/
 **/
 	public static function run(v:Dynamic) {
 	public static function run(v:Dynamic) {
 		var s = new Serializer();
 		var s = new Serializer();

+ 14 - 14
std/haxe/Template.hx

@@ -48,7 +48,7 @@ private typedef ExprToken = {
 }
 }
 
 
 /**
 /**
-	Template provides a basic templating mechanism to replace values in a source
+	`Template` provides a basic templating mechanism to replace values in a source
 	String, and to have some basic logic.
 	String, and to have some basic logic.
 
 
 	A complete documentation of the supported syntax is available at:
 	A complete documentation of the supported syntax is available at:
@@ -62,8 +62,8 @@ class Template {
 	static var expr_float = ~/^([+-]?)(?=\d|,\d)\d*(,\d*)?([Ee]([+-]?\d+))?$/;
 	static var expr_float = ~/^([+-]?)(?=\d|,\d)\d*(,\d*)?([Ee]([+-]?\d+))?$/;
 
 
 	/**
 	/**
-		Global replacements which are used across all Template instances. This
-		has lower priority than the context argument of execute().
+		Global replacements which are used across all `Template` instances. This
+		has lower priority than the context argument of `execute()`.
 	**/
 	**/
 	public static var globals:Dynamic = {};
 	public static var globals:Dynamic = {};
 
 
@@ -77,14 +77,14 @@ class Template {
 	var buf:StringBuf;
 	var buf:StringBuf;
 
 
 	/**
 	/**
-		Creates a new Template instance from `str`.
+		Creates a new `Template` instance from `str`.
 
 
 		`str` is parsed into tokens, which are stored for internal use. This
 		`str` is parsed into tokens, which are stored for internal use. This
-		means that multiple execute() operations on a single Template instance
-		are more efficient than one execute() operations on multiple Template
+		means that multiple `execute()` operations on a single `Template` instance
+		are more efficient than one `execute()` operations on multiple `Template`
 		instances.
 		instances.
 
 
-		If `str` is null, the result is unspecified.
+		If `str` is `null`, the result is unspecified.
 	**/
 	**/
 	public function new(str:String) {
 	public function new(str:String) {
 		var tokens = parseTokens(str);
 		var tokens = parseTokens(str);
@@ -94,19 +94,19 @@ class Template {
 	}
 	}
 
 
 	/**
 	/**
-		Executes `this` Template, taking into account `context` for
+		Executes `this` `Template`, taking into account `context` for
 		replacements and `macros` for callback functions.
 		replacements and `macros` for callback functions.
 
 
-		If `context` has a field 'name', its value replaces all occurrences of
-		::name:: in the Template. Otherwise Template.globals is checked instead,
-		If 'name' is not a field of that either, ::name:: is replaced with null.
+		If `context` has a field `name`, its value replaces all occurrences of
+		`::name::` in the `Template`. Otherwise `Template.globals` is checked instead,
+		If `name` is not a field of that either, `::name::` is replaced with `null`.
 
 
-		If `macros` has a field 'name', all occurrences of $$name(args) are
+		If `macros` has a field `name`, all occurrences of `$$name(args)` are
 		replaced with the result of calling that field. The first argument is
 		replaced with the result of calling that field. The first argument is
-		always the resolve() method, followed by the given arguments.
+		always the `resolve()` method, followed by the given arguments.
 		If `macros` has no such field, the result is unspecified.
 		If `macros` has no such field, the result is unspecified.
 
 
-		If `context` is null, the result is unspecified. If `macros` is null,
+		If `context` is `null`, the result is unspecified. If `macros` is `null`,
 		no macros are used.
 		no macros are used.
 	**/
 	**/
 	public function execute(context:Dynamic, ?macros:Dynamic):String {
 	public function execute(context:Dynamic, ?macros:Dynamic):String {

+ 17 - 14
std/haxe/Timer.hx

@@ -23,17 +23,17 @@
 package haxe;
 package haxe;
 
 
 /**
 /**
-	The Timer class allows you to create asynchronous timers on platforms that
+	The `Timer` class allows you to create asynchronous timers on platforms that
 	support events.
 	support events.
 
 
-	The intended usage is to create an instance of the Timer class with a given
-	interval, set its run() method to a custom function to be invoked and
-	eventually call stop() to stop the Timer.
+	The intended usage is to create an instance of the `Timer` class with a given
+	interval, set its `run()` method to a custom function to be invoked and
+	eventually call `stop()` to stop the `Timer`.
 
 
-	Note that a running Timer may or may not prevent the program to exit
-	automatically when main() returns.
+	Note that a running `Timer` may or may not prevent the program to exit
+	automatically when `main()` returns.
 
 
-	It is also possible to extend this class and override its run() method in
+	It is also possible to extend this class and override its `run()` method in
 	the child class.
 	the child class.
 **/
 **/
 class Timer {
 class Timer {
@@ -116,9 +116,12 @@ class Timer {
 
 
 		It can be overridden in a subclass, or rebound directly to a custom
 		It can be overridden in a subclass, or rebound directly to a custom
 		function:
 		function:
-			var timer = new haxe.Timer(1000); // 1000ms delay
-			timer.run = function() { ... }
 
 
+		```haxe
+		var timer = new haxe.Timer(1000); // 1000ms delay
+		timer.run = function() { ... }
+		```
+		
 		Once bound, it can still be rebound to different functions until `this`
 		Once bound, it can still be rebound to different functions until `this`
 		Timer is stopped through a call to `this.stop`.
 		Timer is stopped through a call to `this.stop`.
 	**/
 	**/
@@ -128,10 +131,10 @@ class Timer {
 		Invokes `f` after `time_ms` milliseconds.
 		Invokes `f` after `time_ms` milliseconds.
 
 
 		This is a convenience function for creating a new Timer instance with
 		This is a convenience function for creating a new Timer instance with
-		`time_ms` as argument, binding its run() method to `f` and then stopping
+		`time_ms` as argument, binding its `run()` method to `f` and then stopping
 		`this` Timer upon the first invocation.
 		`this` Timer upon the first invocation.
 
 
-		If `f` is null, the result is unspecified.
+		If `f` is `null`, the result is unspecified.
 	**/
 	**/
 	public static function delay(f:Void->Void, time_ms:Int) {
 	public static function delay(f:Void->Void, time_ms:Int) {
 		var t = new haxe.Timer(time_ms);
 		var t = new haxe.Timer(time_ms);
@@ -146,12 +149,12 @@ class Timer {
 		Measures the time it takes to execute `f`, in seconds with fractions.
 		Measures the time it takes to execute `f`, in seconds with fractions.
 
 
 		This is a convenience function for calculating the difference between
 		This is a convenience function for calculating the difference between
-		Timer.stamp() before and after the invocation of `f`.
+		`Timer.stamp()` before and after the invocation of `f`.
 
 
-		The difference is passed as argument to Log.trace(), with "s" appended
+		The difference is passed as argument to `Log.trace()`, with `"s"` appended
 		to denote the unit. The optional `pos` argument is passed through.
 		to denote the unit. The optional `pos` argument is passed through.
 
 
-		If `f` is null, the result is unspecified.
+		If `f` is `null`, the result is unspecified.
 	**/
 	**/
 	public static function measure<T>(f:Void->T, ?pos:PosInfos):T {
 	public static function measure<T>(f:Void->T, ?pos:PosInfos):T {
 		var t0 = stamp();
 		var t0 = stamp();

+ 2 - 2
std/haxe/Ucs2.hx

@@ -72,9 +72,9 @@ abstract Ucs2(String) {
 	/**
 	/**
 		Returns the character code at position `index` of `this` Ucs2.
 		Returns the character code at position `index` of `this` Ucs2.
 
 
-		If `index` is negative or exceeds `this.length`, null is returned.
+		If `index` is negative or exceeds `this.length`, `null` is returned.
 
 
-		To obtain the character code of a single character, "x".code can be used
+		To obtain the character code of a single character, `"x".code` can be used
 		instead to extern public inline the character code at compile time. Note that this
 		instead to extern public inline the character code at compile time. Note that this
 		only works on Ucs2 literals of length 1.
 		only works on Ucs2 literals of length 1.
 	**/
 	**/

+ 2 - 2
std/haxe/Unserializer.hx

@@ -116,7 +116,7 @@ class Unserializer {
 	/**
 	/**
 		Sets the type resolver of `this` Unserializer instance to `r`.
 		Sets the type resolver of `this` Unserializer instance to `r`.
 
 
-		If `r` is null, a special resolver is used which returns null for all
+		If `r` is `null`, a special resolver is used which returns `null` for all
 		input values.
 		input values.
 
 
 		See `DEFAULT_RESOLVER` for more information on type resolvers.
 		See `DEFAULT_RESOLVER` for more information on type resolvers.
@@ -455,7 +455,7 @@ class Unserializer {
 		Unserializes `v` and returns the according value.
 		Unserializes `v` and returns the according value.
 
 
 		This is a convenience function for creating a new instance of
 		This is a convenience function for creating a new instance of
-		Unserializer with `v` as buffer and calling its unserialize() method
+		Unserializer with `v` as buffer and calling its `unserialize()` method
 		once.
 		once.
 	**/
 	**/
 	public static function run(v:String):Dynamic {
 	public static function run(v:String):Dynamic {