avm1: Remove `ScriptObject::object_cell`
Use `ScriptObject::new` instead.
This commit is contained in:
parent
04b4a6cabe
commit
5cbfcde784
|
@ -534,7 +534,7 @@ pub fn create_globals<'gc>(
|
||||||
Object<'gc>,
|
Object<'gc>,
|
||||||
as_broadcaster::BroadcasterFunctions<'gc>,
|
as_broadcaster::BroadcasterFunctions<'gc>,
|
||||||
) {
|
) {
|
||||||
let object_proto = ScriptObject::object_cell(gc_context, None);
|
let object_proto = ScriptObject::new(gc_context, None).into();
|
||||||
let function_proto = function::create_proto(gc_context, object_proto);
|
let function_proto = function::create_proto(gc_context, object_proto);
|
||||||
|
|
||||||
object::fill_proto(gc_context, object_proto, function_proto);
|
object::fill_proto(gc_context, object_proto, function_proto);
|
||||||
|
|
|
@ -117,8 +117,12 @@ pub fn apply<'gc>(
|
||||||
/// returned object is also a bare object, which will need to be linked into
|
/// returned object is also a bare object, which will need to be linked into
|
||||||
/// the prototype of `Object`.
|
/// the prototype of `Object`.
|
||||||
pub fn create_proto<'gc>(gc_context: MutationContext<'gc, '_>, proto: Object<'gc>) -> Object<'gc> {
|
pub fn create_proto<'gc>(gc_context: MutationContext<'gc, '_>, proto: Object<'gc>) -> Object<'gc> {
|
||||||
let function_proto = ScriptObject::object_cell(gc_context, Some(proto));
|
let function_proto = ScriptObject::new(gc_context, Some(proto));
|
||||||
let object = function_proto.as_script_object().unwrap();
|
define_properties_on(
|
||||||
define_properties_on(PROTO_DECLS, gc_context, object, function_proto);
|
PROTO_DECLS,
|
||||||
function_proto
|
gc_context,
|
||||||
|
function_proto,
|
||||||
|
function_proto.into(),
|
||||||
|
);
|
||||||
|
function_proto.into()
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,14 +87,6 @@ impl<'gc> ScriptObject<'gc> {
|
||||||
object
|
object
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs and allocates an empty but normal object in one go.
|
|
||||||
pub fn object_cell(
|
|
||||||
gc_context: MutationContext<'gc, '_>,
|
|
||||||
proto: Option<Object<'gc>>,
|
|
||||||
) -> Object<'gc> {
|
|
||||||
Self::new(gc_context, proto).into()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Constructs an object with no properties, not even builtins.
|
/// Constructs an object with no properties, not even builtins.
|
||||||
///
|
///
|
||||||
/// Intended for constructing scope chains, since they exclusively use the
|
/// Intended for constructing scope chains, since they exclusively use the
|
||||||
|
|
|
@ -52,7 +52,7 @@ impl<'gc> Scope<'gc> {
|
||||||
Scope {
|
Scope {
|
||||||
parent: Some(parent),
|
parent: Some(parent),
|
||||||
class: ScopeClass::Local,
|
class: ScopeClass::Local,
|
||||||
values: ScriptObject::object_cell(mc, None),
|
values: ScriptObject::new(mc, None).into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ impl<'gc> Scope<'gc> {
|
||||||
Self {
|
Self {
|
||||||
parent: None,
|
parent: None,
|
||||||
class: ScopeClass::Global,
|
class: ScopeClass::Global,
|
||||||
values: ScriptObject::object_cell(mc, None),
|
values: ScriptObject::new(mc, None).into(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -889,7 +889,7 @@ mod test {
|
||||||
protos.function,
|
protos.function,
|
||||||
);
|
);
|
||||||
|
|
||||||
let o = ScriptObject::object_cell(activation.context.gc_context, Some(protos.object));
|
let o = ScriptObject::new(activation.context.gc_context, Some(protos.object));
|
||||||
o.define_value(
|
o.define_value(
|
||||||
activation.context.gc_context,
|
activation.context.gc_context,
|
||||||
"valueOf",
|
"valueOf",
|
||||||
|
@ -898,7 +898,7 @@ mod test {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Value::Object(o).to_primitive_num(activation).unwrap(),
|
Value::from(o).to_primitive_num(activation).unwrap(),
|
||||||
5.into()
|
5.into()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue