Browse Source

document haxe.macro.MetaAccess

Simon Krajewski 12 years ago
parent
commit
9e5c001ba3
1 changed files with 41 additions and 0 deletions
  1. 41 0
      std/haxe/macro/Type.hx

+ 41 - 0
std/haxe/macro/Type.hx

@@ -122,10 +122,51 @@ typedef AbstractType = {>BaseType,
 	var array : Array<ClassField>;
 }
 
+/**
+	MetaAccess is a wrapper for the `Metadata` array. It can be used to add
+	metadata to and remove metadata from its origin.
+**/
 typedef MetaAccess = {
+	/**
+		Return the wrapped `Metadata` array.
+		
+		Modifying this array has no effect on the origin of `this` MetaAccess.
+		The `add` and `remove` methods can be used for that.
+	**/
 	function get() : Expr.Metadata;
+	
+	/**
+		Adds the metadata specified by `name`, `params` and `pos` to the origin
+		of `this` MetaAccess.
+		
+		Metadata names are not unique during compilation, so this method never
+		overwrites a previous metadata.
+		
+		If a `Metadata` array is obtained through a call to `get`, a subsequent
+		call to `add` has no effect on that array.
+		
+		If any argument is null, compilation fails with an error.
+	**/
 	function add( name : String, params : Array<Expr>, pos : Expr.Position ) : Void;
+	
+	/**
+		Removes all `name` metadata entries from the origin of `this`
+		MetaAccess.
+		
+		This method might clear several metadata entries of the same name.
+		
+		If a `Metadata` array is obtained through a call to `get`, a subsequent
+		call to `remove` has no effect on that array.
+		
+		If `name` is null, compilation fails with an error.
+	**/
 	function remove( name : String ) : Void;
+	
+	/**
+		Tells if the origin of `this` MetaAccess has a `name` metadata entry.
+		
+		If `name` is null, compilation fails with an error.
+	**/
 	function has( name : String ) : Bool;
 }