@@ -6,36 +6,75 @@ package com.cff.anebe.ir
6
6
*/
7
7
public class ASTrait
8
8
{
9
+ /** Kind of the trait. Trait kinds are listed under KIND_* in this class. */
9
10
public var kind: String ;
11
+
12
+ /** Attributes this trait has. Trait attributes are listed under ATTR_* in this class */
10
13
public var attributes: Vector .< String >;
14
+
15
+ /** Slot/dispId of this trait. 0 lets the runtime assign a slot. */
11
16
public var slotId: uint ;
17
+
18
+ /** Metadata attached to this trait. */
12
19
public var metadata: Vector .< ASMetadata>;
20
+
21
+ /** Name of this trait. Must always be a QName. */
13
22
public var name: ASMultiname;
14
23
15
- // If this is a slot or a const, this will be the type of the stored variable. Otherwise null.
24
+ /** For slot or const kinds, type of the stored variable. Null for others. */
16
25
public var typename: ASMultiname;
17
26
18
- /** If this trait's kind is slot or const, the value of the stored variable, or null if there is none. Otherwise null . */
27
+ /** For slot or const kinds , the value the trait gets initialized to. May be null if there is no value. Null for other kinds . */
19
28
public var value: ASValue;
20
29
21
- /** If this trait's kind is getter, setter, method, or function, the associated function object. Otherwise null . */
30
+ /** For getter, setter, method, or function kinds , the ASMethod that represents the function. Null for others . */
22
31
public var funcOrMethod: ASMethod;
23
32
24
- /** If this trait's kind is class, the associated class object. Otherwise null . */
33
+ /** For class kind, the ASClass that represents the stored class. Null for others . */
25
34
public var clazz: ASClass;
26
35
36
+ /** Kind string for slots */
27
37
public static const KIND_SLOT : String = "slot" ;
38
+
39
+ /** Kind string for methods */
28
40
public static const KIND_METHOD : String = "method" ;
41
+
42
+ /** Kind string for getters */
29
43
public static const KIND_GETTER : String = "getter" ;
44
+
45
+ /** Kind string for setters */
30
46
public static const KIND_SETTER : String = "setter" ;
47
+
48
+ /** Kind string for classes */
31
49
public static const KIND_CLASS : String = "class" ;
50
+
51
+ /** Kind string for functions */
32
52
public static const KIND_FUNCTION : String = "function" ;
53
+
54
+ /** Kind string for consts */
33
55
public static const KIND_CONST : String = "const" ;
34
56
57
+ /** Final attribute: indicates this trait cannot be overridden. */
35
58
public static const ATTR_FINAL : String = "FINAL" ;
59
+
60
+ /** Override attribute: indicates this trait overrides a base class's. */
36
61
public static const ATTR_OVERRIDE : String = "OVERRIDE" ;
62
+
63
+ /** Metadata attribute: indicates that this trait has metadata. */
37
64
public static const ATTR_METADATA : String = "METADATA" ;
38
65
66
+ /**
67
+ * Builds an ASTrait from scratch. Probably shouldn't be used; see instead helper functions in the package com.cff.anebe.ir.traits
68
+ * @param kind Trait kind
69
+ * @param attributes Trait attributes
70
+ * @param slotId Trait slot ID or disp ID
71
+ * @param name Trait name
72
+ * @param typename Trait type name, if present
73
+ * @param metadata Trait metadata, if present
74
+ * @param value Trait initial value, if present
75
+ * @param funcOrMethod Function stored in trait, if present
76
+ * @param clazz Class stored in trait, if present
77
+ */
39
78
public function ASTrait (kind :String = null , attributes :Vector .<String> = null , slotId :uint = 0 , name :ASMultiname = null , typename :ASMultiname = null , metadata :Vector .<ASMetadata> = null , value :ASValue = null , funcOrMethod :ASMethod = null , clazz :ASClass = null )
40
79
{
41
80
this . kind = kind ;
0 commit comments