@@ -90,14 +90,14 @@ impl<'gc> ClassObject<'gc> {
90
90
self ,
91
91
activation : & mut Activation < ' _ , ' gc > ,
92
92
superclass_object : Option < ClassObject < ' gc > > ,
93
- ) -> Result < Object < ' gc > , Error < ' gc > > {
93
+ ) -> Object < ' gc > {
94
94
let proto = ScriptObject :: new_object ( activation) ;
95
95
96
96
if let Some ( superclass_object) = superclass_object {
97
97
let base_proto = superclass_object. prototype ( ) ;
98
98
proto. set_proto ( activation. gc ( ) , base_proto) ;
99
99
}
100
- Ok ( proto)
100
+ proto
101
101
}
102
102
103
103
/// Construct a class.
@@ -114,10 +114,10 @@ impl<'gc> ClassObject<'gc> {
114
114
class : Class < ' gc > ,
115
115
superclass_object : Option < ClassObject < ' gc > > ,
116
116
) -> Result < Self , Error < ' gc > > {
117
- let class_object = Self :: from_class_partial ( activation, class, superclass_object) ? ;
118
- let class_proto = class_object. allocate_prototype ( activation, superclass_object) ? ;
117
+ let class_object = Self :: from_class_partial ( activation, class, superclass_object) ;
118
+ let class_proto = class_object. allocate_prototype ( activation, superclass_object) ;
119
119
120
- class_object. link_prototype ( activation, class_proto) ? ;
120
+ class_object. link_prototype ( activation, class_proto) ;
121
121
122
122
let class_class_proto = activation. avm2 ( ) . classes ( ) . class . prototype ( ) ;
123
123
class_object. link_type ( activation. gc ( ) , class_class_proto) ;
@@ -141,7 +141,7 @@ impl<'gc> ClassObject<'gc> {
141
141
activation : & mut Activation < ' _ , ' gc > ,
142
142
class : Class < ' gc > ,
143
143
superclass_object : Option < ClassObject < ' gc > > ,
144
- ) -> Result < Self , Error < ' gc > > {
144
+ ) -> Self {
145
145
let c_class = class
146
146
. c_class ( )
147
147
. expect ( "Can only call ClassObject::from_class on i_classes" ) ;
@@ -176,14 +176,14 @@ impl<'gc> ClassObject<'gc> {
176
176
instance_scope
177
177
)
178
178
. set ( instance_scope) ;
179
- class_object. init_instance_vtable ( activation) ? ;
179
+ class_object. init_instance_vtable ( activation) ;
180
180
181
181
class. add_class_object ( activation. gc ( ) , class_object) ;
182
182
183
- Ok ( class_object)
183
+ class_object
184
184
}
185
185
186
- fn init_instance_vtable ( self , activation : & mut Activation < ' _ , ' gc > ) -> Result < ( ) , Error < ' gc > > {
186
+ fn init_instance_vtable ( self , activation : & mut Activation < ' _ , ' gc > ) {
187
187
let class = self . inner_class_definition ( ) ;
188
188
189
189
self . instance_vtable ( ) . init_vtable (
@@ -194,9 +194,7 @@ impl<'gc> ClassObject<'gc> {
194
194
activation. gc ( ) ,
195
195
) ;
196
196
197
- self . link_interfaces ( activation) ?;
198
-
199
- Ok ( ( ) )
197
+ self . link_interfaces ( activation) ;
200
198
}
201
199
202
200
/// Finish initialization of the class.
@@ -244,26 +242,22 @@ impl<'gc> ClassObject<'gc> {
244
242
}
245
243
246
244
/// Link this class to a prototype.
247
- pub fn link_prototype (
248
- self ,
249
- activation : & mut Activation < ' _ , ' gc > ,
250
- class_proto : Object < ' gc > ,
251
- ) -> Result < ( ) , Error < ' gc > > {
245
+ pub fn link_prototype ( self , activation : & mut Activation < ' _ , ' gc > , class_proto : Object < ' gc > ) {
252
246
let mc = activation. gc ( ) ;
253
247
254
248
unlock ! ( Gc :: write( mc, self . 0 ) , ClassObjectData , prototype) . set ( Some ( class_proto) ) ;
255
- class_proto. set_string_property_local ( istr ! ( "constructor" ) , self . into ( ) , activation) ?;
249
+ class_proto
250
+ . set_string_property_local ( istr ! ( "constructor" ) , self . into ( ) , activation)
251
+ . expect ( "Prototype is a dynamic object" ) ;
256
252
class_proto. set_local_property_is_enumerable ( mc, istr ! ( "constructor" ) , false ) ;
257
-
258
- Ok ( ( ) )
259
253
}
260
254
261
255
/// Link this class to it's interfaces.
262
256
///
263
257
/// This should be done after all instance traits has been resolved, as
264
258
/// instance traits will be resolved to their corresponding methods at this
265
259
/// time.
266
- pub fn link_interfaces ( self , activation : & mut Activation < ' _ , ' gc > ) -> Result < ( ) , Error < ' gc > > {
260
+ fn link_interfaces ( self , activation : & mut Activation < ' _ , ' gc > ) {
267
261
let class = self . inner_class_definition ( ) ;
268
262
269
263
// FIXME - we should only be copying properties for newly-implemented
@@ -283,8 +277,6 @@ impl<'gc> ClassObject<'gc> {
283
277
}
284
278
}
285
279
}
286
-
287
- Ok ( ( ) )
288
280
}
289
281
290
282
/// Manually set the type of this `Class`.
0 commit comments