You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AS3/src/com/cff/anebe/ir/ASClass.as
+27-15Lines changed: 27 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -27,17 +27,17 @@ package com.cff.anebe.ir
27
27
/**
28
28
* Gets a static trait present in the class
29
29
* @param name Name of the trait to retrieve
30
-
* @paramwhichIfMultiple If there are multiple traits that match this ASMultiname (such as may be the case with getters and setters), which index to get
30
+
* @paramfavorSetter If this name refers to both a getter and a setter, true will retrieve the getter, while false will retrieve the setter. If it is neither or only one exists, has no effect.
31
31
* @return The trait retrieved, or null if none were found
if (name ==null||name.type!= ASMultiname.TYPE_QNAME)
36
36
{
37
37
thrownewArgumentError("Trait name must be a QName");
38
38
}
39
39
40
-
var ret:Object= context.call("GetStaticTrait", name, whichIfMultiple);
40
+
var ret:Object= context.call("GetStaticTrait", name, favorSetter);
41
41
42
42
if (ret ==null)
43
43
{
@@ -53,7 +53,13 @@ package com.cff.anebe.ir
53
53
}
54
54
55
55
/**
56
-
* Sets a trait as static into the class. If it does not exist, it will be created, and if it does it will be overwritten.
56
+
* Sets a trait as static into the class.
57
+
* If a trait does not exist by the name of the new trait, the new trait will be added.
58
+
* If a getter exists by the name of the new trait and the new trait is a setter, the new trait will be added.
59
+
* If a setter exists by the name of the new trait and the new trait is a getter, the new trait will be added.
60
+
* If both a getter and setter exist by the name of the new trait and the new trait is neither a getter nor setter, the new trait will replace both the getter and setter.
61
+
* If a trait of the same kind already exists by the name of the new trait, the new trait will replace that trait.
62
+
* If a trait exists by the name of the new trait and the kinds do not match any of the above rules, the new trait will replace the original.
57
63
* @param value The trait to set or add to the class
58
64
*/
59
65
publicfunctionsetStaticTrait(value:ASTrait):void
@@ -82,16 +88,16 @@ package com.cff.anebe.ir
82
88
/**
83
89
* Deletes a static trait present in the class
84
90
* @param name Name of the trait to retrieve
85
-
* @paramwhichIfMultiple If there are multiple traits that match this ASMultiname (such as may be the case with getters and setters), which index to delete
91
+
* @paramfavorSetter If this name refers to both a getter and a setter, true will delete the getter, while false will delete the setter. If it is neither or only one exists, has no effect.
if (name ==null||name.type!= ASMultiname.TYPE_QNAME)
90
96
{
91
97
thrownewArgumentError("Trait name must be a QName");
92
98
}
93
99
94
-
var ret:Object= context.call("DeleteStaticTrait", name, whichIfMultiple);
100
+
var ret:Object= context.call("DeleteStaticTrait", name, favorSetter);
95
101
96
102
if (ret isString)
97
103
{
@@ -106,17 +112,17 @@ package com.cff.anebe.ir
106
112
/**
107
113
* Gets an instance trait present in the class
108
114
* @param name Name of the trait to retrieve
109
-
* @paramwhichIfMultiple If there are multiple traits that match this ASMultiname (such as may be the case with getters and setters), which index to get
115
+
* @paramfavorSetter If this name refers to both a getter and a setter, true will retrieve the getter, while false will retrieve the setter. If it is neither or only one exists, has no effect.
110
116
* @return The trait retrieved, or null if none were found
if (name ==null||name.type!= ASMultiname.TYPE_QNAME)
115
121
{
116
122
thrownewArgumentError("Trait name must be a QName");
117
123
}
118
124
119
-
var ret:Object= context.call("GetInstanceTrait", name, whichIfMultiple);
125
+
var ret:Object= context.call("GetInstanceTrait", name, favorSetter);
120
126
121
127
if (ret ==null)
122
128
{
@@ -132,7 +138,13 @@ package com.cff.anebe.ir
132
138
}
133
139
134
140
/**
135
-
* Sets an instance trait into the class. If it does not exist, it will be created, and if it does it will be overwritten.
141
+
* Sets an instance trait as into the class.
142
+
* If a trait does not exist by the name of the new trait, the new trait will be added.
143
+
* If a getter exists by the name of the new trait and the new trait is a setter, the new trait will be added.
144
+
* If a setter exists by the name of the new trait and the new trait is a getter, the new trait will be added.
145
+
* If both a getter and setter exist by the name of the new trait and the new trait is neither a getter nor setter, the new trait will replace both the getter and setter.
146
+
* If a trait of the same kind already exists by the name of the new trait, the new trait will replace that trait.
147
+
* If a trait exists by the name of the new trait and the kinds do not match any of the above rules, the new trait will replace the original.
136
148
* @param value The trait to set or add to the class
* @paramwhichIfMultiple If there are multiple traits that match this ASMultiname (such as may be the case with getters and setters), which index to delete
176
+
* @paramfavorSetter If this name refers to both a getter and a setter, true will delete the getter, while false will delete the setter. If it is neither or only one exists, has no effect.
0 commit comments