11#[ macro_export]
22macro_rules! impl_custom_object {
33 ( $field: ident) => {
4- crate :: impl_custom_object!( $field { } ) ;
4+ $ crate:: impl_custom_object!( $field { } ) ;
55 } ;
66
77 ( @extra $field: ident bare_object( $as_obj: ident -> $obj_type: ident :: $new: ident) ) => {
@@ -11,9 +11,9 @@ macro_rules! impl_custom_object {
1111
1212 fn create_bare_object(
1313 & self ,
14- activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>,
15- this: crate :: avm1:: Object <' gc>,
16- ) -> Result <crate :: avm1:: Object <' gc>, crate :: avm1:: Error <' gc>> {
14+ activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>,
15+ this: $ crate:: avm1:: Object <' gc>,
16+ ) -> Result <$ crate:: avm1:: Object <' gc>, $ crate:: avm1:: Error <' gc>> {
1717 Ok ( $obj_type:: $new( activation. context. gc_context, Some ( this) ) . into( ) )
1818 }
1919 } ;
@@ -24,34 +24,34 @@ macro_rules! impl_custom_object {
2424 ) *
2525 } ) => {
2626 $(
27- crate :: impl_custom_object!( @extra $field $extra_name( $( $extra) * ) ) ;
27+ $ crate:: impl_custom_object!( @extra $field $extra_name( $( $extra) * ) ) ;
2828 ) *
2929
3030 fn get_local_stored(
3131 & self ,
32- name: impl Into <crate :: avm1:: AvmString <' gc>>,
33- activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>,
34- ) -> Option <crate :: avm1:: Value <' gc>> {
32+ name: impl Into <$ crate:: avm1:: AvmString <' gc>>,
33+ activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>,
34+ ) -> Option <$ crate:: avm1:: Value <' gc>> {
3535 self . 0 . read( ) . $field. get_local_stored( name, activation)
3636 }
3737
3838 fn set_local(
3939 & self ,
40- name: crate :: avm1:: AvmString <' gc>,
41- value: crate :: avm1:: Value <' gc>,
42- activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>,
43- this: crate :: avm1:: Object <' gc>,
44- ) -> Result <( ) , crate :: avm1:: Error <' gc>> {
40+ name: $ crate:: avm1:: AvmString <' gc>,
41+ value: $ crate:: avm1:: Value <' gc>,
42+ activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>,
43+ this: $ crate:: avm1:: Object <' gc>,
44+ ) -> Result <( ) , $ crate:: avm1:: Error <' gc>> {
4545 self . 0 . read( ) . $field. set_local( name, value, activation, this)
4646 }
4747
4848 fn call(
4949 & self ,
50- name: crate :: avm1:: AvmString <' gc>,
51- activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>,
52- this: crate :: avm1:: Value <' gc>,
53- args: & [ crate :: avm1:: Value <' gc>] ,
54- ) -> Result <crate :: avm1:: Value <' gc>, crate :: avm1:: Error <' gc>> {
50+ name: $ crate:: avm1:: AvmString <' gc>,
51+ activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>,
52+ this: $ crate:: avm1:: Value <' gc>,
53+ args: & [ $ crate:: avm1:: Value <' gc>] ,
54+ ) -> Result <$ crate:: avm1:: Value <' gc>, $ crate:: avm1:: Error <' gc>> {
5555 self . 0
5656 . read( )
5757 . $field
@@ -60,38 +60,38 @@ macro_rules! impl_custom_object {
6060
6161 fn getter(
6262 & self ,
63- name: crate :: avm1:: AvmString <' gc>,
64- activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>,
65- ) -> Option <crate :: avm1:: object:: Object <' gc>> {
63+ name: $ crate:: avm1:: AvmString <' gc>,
64+ activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>,
65+ ) -> Option <$ crate:: avm1:: object:: Object <' gc>> {
6666 self . 0 . read( ) . $field. getter( name, activation)
6767 }
6868
6969 fn setter(
7070 & self ,
71- name: crate :: avm1:: AvmString <' gc>,
72- activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>,
73- ) -> Option <crate :: avm1:: object:: Object <' gc>> {
71+ name: $ crate:: avm1:: AvmString <' gc>,
72+ activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>,
73+ ) -> Option <$ crate:: avm1:: object:: Object <' gc>> {
7474 self . 0 . read( ) . $field. setter( name, activation)
7575 }
7676
7777 fn delete(
7878 & self ,
79- activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>,
80- name: crate :: avm1:: AvmString <' gc>,
79+ activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>,
80+ name: $ crate:: avm1:: AvmString <' gc>,
8181 ) -> bool {
8282 self . 0 . read( ) . $field. delete( activation, name)
8383 }
8484
85- fn proto( & self , activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>) -> crate :: avm1:: Value <' gc> {
85+ fn proto( & self , activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>) -> $ crate:: avm1:: Value <' gc> {
8686 self . 0 . read( ) . $field. proto( activation)
8787 }
8888
8989 fn define_value(
9090 & self ,
9191 gc_context: gc_arena:: MutationContext <' gc, ' _>,
92- name: impl Into <crate :: avm1:: AvmString <' gc>>,
93- value: crate :: avm1:: Value <' gc>,
94- attributes: crate :: avm1:: property:: Attribute ,
92+ name: impl Into <$ crate:: avm1:: AvmString <' gc>>,
93+ value: $ crate:: avm1:: Value <' gc>,
94+ attributes: $ crate:: avm1:: property:: Attribute ,
9595 ) {
9696 self . 0
9797 . read( )
@@ -102,9 +102,9 @@ macro_rules! impl_custom_object {
102102 fn set_attributes(
103103 & self ,
104104 gc_context: gc_arena:: MutationContext <' gc, ' _>,
105- name: Option <crate :: avm1:: AvmString <' gc>>,
106- set_attributes: crate :: avm1:: property:: Attribute ,
107- clear_attributes: crate :: avm1:: property:: Attribute ,
105+ name: Option <$ crate:: avm1:: AvmString <' gc>>,
106+ set_attributes: $ crate:: avm1:: property:: Attribute ,
107+ clear_attributes: $ crate:: avm1:: property:: Attribute ,
108108 ) {
109109 self . 0 . write( gc_context) . $field. set_attributes(
110110 gc_context,
@@ -117,10 +117,10 @@ macro_rules! impl_custom_object {
117117 fn add_property(
118118 & self ,
119119 gc_context: gc_arena:: MutationContext <' gc, ' _>,
120- name: crate :: avm1:: AvmString <' gc>,
121- get: crate :: avm1:: object:: Object <' gc>,
122- set: Option <crate :: avm1:: object:: Object <' gc>>,
123- attributes: crate :: avm1:: property:: Attribute ,
120+ name: $ crate:: avm1:: AvmString <' gc>,
121+ get: $ crate:: avm1:: object:: Object <' gc>,
122+ set: Option <$ crate:: avm1:: object:: Object <' gc>>,
123+ attributes: $ crate:: avm1:: property:: Attribute ,
124124 ) {
125125 self . 0
126126 . read( )
@@ -130,11 +130,11 @@ macro_rules! impl_custom_object {
130130
131131 fn add_property_with_case(
132132 & self ,
133- activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>,
134- name: crate :: avm1:: AvmString <' gc>,
135- get: crate :: avm1:: object:: Object <' gc>,
136- set: Option <crate :: avm1:: object:: Object <' gc>>,
137- attributes: crate :: avm1:: property:: Attribute ,
133+ activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>,
134+ name: $ crate:: avm1:: AvmString <' gc>,
135+ get: $ crate:: avm1:: object:: Object <' gc>,
136+ set: Option <$ crate:: avm1:: object:: Object <' gc>>,
137+ attributes: $ crate:: avm1:: property:: Attribute ,
138138 ) {
139139 self . 0
140140 . read( )
@@ -144,32 +144,32 @@ macro_rules! impl_custom_object {
144144
145145 fn has_property(
146146 & self ,
147- activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>,
148- name: crate :: avm1:: AvmString <' gc>,
147+ activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>,
148+ name: $ crate:: avm1:: AvmString <' gc>,
149149 ) -> bool {
150150 self . 0 . read( ) . $field. has_property( activation, name)
151151 }
152152
153153 fn has_own_property(
154154 & self ,
155- activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>,
156- name: crate :: avm1:: AvmString <' gc>,
155+ activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>,
156+ name: $ crate:: avm1:: AvmString <' gc>,
157157 ) -> bool {
158158 self . 0 . read( ) . $field. has_own_property( activation, name)
159159 }
160160
161161 fn has_own_virtual(
162162 & self ,
163- activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>,
164- name: crate :: avm1:: AvmString <' gc>,
163+ activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>,
164+ name: $ crate:: avm1:: AvmString <' gc>,
165165 ) -> bool {
166166 self . 0 . read( ) . $field. has_own_virtual( activation, name)
167167 }
168168
169169 fn is_property_enumerable(
170170 & self ,
171- activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>,
172- name: crate :: avm1:: AvmString <' gc>,
171+ activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>,
172+ name: $ crate:: avm1:: AvmString <' gc>,
173173 ) -> bool {
174174 self . 0
175175 . read( )
@@ -179,23 +179,23 @@ macro_rules! impl_custom_object {
179179
180180 fn get_keys(
181181 & self ,
182- activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>,
183- ) -> Vec <crate :: avm1:: AvmString <' gc>> {
182+ activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>,
183+ ) -> Vec <$ crate:: avm1:: AvmString <' gc>> {
184184 self . 0 . read( ) . $field. get_keys( activation)
185185 }
186186
187187 fn type_of( & self ) -> & ' static str {
188188 self . 0 . read( ) . $field. type_of( )
189189 }
190190
191- fn interfaces( & self ) -> Vec <crate :: avm1:: Object <' gc>> {
191+ fn interfaces( & self ) -> Vec <$ crate:: avm1:: Object <' gc>> {
192192 self . 0 . read( ) . $field. interfaces( )
193193 }
194194
195195 fn set_interfaces(
196196 & self ,
197197 gc_context: gc_arena:: MutationContext <' gc, ' _>,
198- iface_list: Vec <crate :: avm1:: Object <' gc>>,
198+ iface_list: Vec <$ crate:: avm1:: Object <' gc>>,
199199 ) {
200200 self . 0
201201 . write( gc_context)
@@ -207,50 +207,50 @@ macro_rules! impl_custom_object {
207207 Some ( self . 0 . read( ) . $field)
208208 }
209209
210- fn as_ptr( & self ) -> * const crate :: avm1:: ObjectPtr {
211- self . 0 . as_ptr( ) as * const crate :: avm1:: ObjectPtr
210+ fn as_ptr( & self ) -> * const $ crate:: avm1:: ObjectPtr {
211+ self . 0 . as_ptr( ) as * const $ crate:: avm1:: ObjectPtr
212212 }
213213
214- fn length( & self , activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>) -> Result <i32 , crate :: avm1:: Error <' gc>> {
214+ fn length( & self , activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>) -> Result <i32 , $ crate:: avm1:: Error <' gc>> {
215215 self . 0 . read( ) . $field. length( activation)
216216 }
217217
218- fn set_length( & self , activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>, length: i32 ) -> Result <( ) , crate :: avm1:: Error <' gc>> {
218+ fn set_length( & self , activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>, length: i32 ) -> Result <( ) , $ crate:: avm1:: Error <' gc>> {
219219 self . 0 . read( ) . $field. set_length( activation, length)
220220 }
221221
222- fn has_element( & self , activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>, index: i32 ) -> bool {
222+ fn has_element( & self , activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>, index: i32 ) -> bool {
223223 self . 0 . read( ) . $field. has_element( activation, index)
224224 }
225225
226- fn get_element( & self , activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>, index: i32 ) -> crate :: avm1:: Value <' gc> {
226+ fn get_element( & self , activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>, index: i32 ) -> $ crate:: avm1:: Value <' gc> {
227227 self . 0 . read( ) . $field. get_element( activation, index)
228228 }
229229
230- fn set_element( & self , activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>, index: i32 , value: crate :: avm1:: Value <' gc>) -> Result <( ) , crate :: avm1:: Error <' gc>> {
230+ fn set_element( & self , activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>, index: i32 , value: $ crate:: avm1:: Value <' gc>) -> Result <( ) , $ crate:: avm1:: Error <' gc>> {
231231 self . 0 . read( ) . $field. set_element( activation, index, value)
232232 }
233233
234- fn delete_element( & self , activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>, index: i32 ) -> bool {
234+ fn delete_element( & self , activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>, index: i32 ) -> bool {
235235 self . 0 . read( ) . $field. delete_element( activation, index)
236236 }
237237
238238 fn call_watcher(
239239 & self ,
240- activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>,
241- name: crate :: avm1:: AvmString <' gc>,
242- value: & mut crate :: avm1:: Value <' gc>,
243- this: crate :: avm1:: object:: Object <' gc>,
244- ) -> Result <( ) , crate :: avm1:: Error <' gc>> {
240+ activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>,
241+ name: $ crate:: avm1:: AvmString <' gc>,
242+ value: & mut $ crate:: avm1:: Value <' gc>,
243+ this: $ crate:: avm1:: object:: Object <' gc>,
244+ ) -> Result <( ) , $ crate:: avm1:: Error <' gc>> {
245245 self . 0 . read( ) . $field. call_watcher( activation, name, value, this)
246246 }
247247
248248 fn watch(
249249 & self ,
250- activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>,
251- name: crate :: avm1:: AvmString <' gc>,
252- callback: crate :: avm1:: object:: Object <' gc>,
253- user_data: crate :: avm1:: Value <' gc>,
250+ activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>,
251+ name: $ crate:: avm1:: AvmString <' gc>,
252+ callback: $ crate:: avm1:: object:: Object <' gc>,
253+ user_data: $ crate:: avm1:: Value <' gc>,
254254 ) {
255255 self . 0
256256 . read( )
@@ -260,8 +260,8 @@ macro_rules! impl_custom_object {
260260
261261 fn unwatch(
262262 & self ,
263- activation: & mut crate :: avm1:: Activation <' _, ' gc, ' _>,
264- name: crate :: avm1:: AvmString <' gc>,
263+ activation: & mut $ crate:: avm1:: Activation <' _, ' gc, ' _>,
264+ name: $ crate:: avm1:: AvmString <' gc>,
265265 ) -> bool {
266266 self . 0 . read( ) . $field. unwatch( activation, name)
267267 }
0 commit comments