avm1: Make FunctionObject::function_and_constructor require prototype, it's not optional

This commit is contained in:
Nathan Adams 2020-07-28 19:39:50 +02:00 committed by Mike Welsh
parent 88a31cc5a9
commit 691e3b6804
6 changed files with 10 additions and 11 deletions

View File

@ -516,14 +516,14 @@ impl<'gc> FunctionObject<'gc> {
function: impl Into<Executable<'gc>>,
constructor: impl Into<Executable<'gc>>,
fn_proto: Option<Object<'gc>>,
prototype: Option<Object<'gc>>,
prototype: Object<'gc>,
) -> Object<'gc> {
Self::allocate_function(
context,
Some(function),
Some(constructor),
fn_proto,
prototype,
Some(prototype),
)
}
}

View File

@ -353,7 +353,7 @@ pub fn create_globals<'gc>(
Some(function_proto),
Some(text_format_proto),
);
let array = array::create_array_object(gc_context, Some(array_proto), Some(function_proto));
let array = array::create_array_object(gc_context, array_proto, Some(function_proto));
let xmlnode = FunctionObject::constructor(
gc_context,
Executable::Native(xml::xmlnode_constructor),
@ -366,10 +366,9 @@ pub fn create_globals<'gc>(
Some(function_proto),
Some(xml_proto),
);
let string = string::create_string_object(gc_context, Some(string_proto), Some(function_proto));
let number = number::create_number_object(gc_context, Some(number_proto), Some(function_proto));
let boolean =
boolean::create_boolean_object(gc_context, Some(boolean_proto), Some(function_proto));
let string = string::create_string_object(gc_context, string_proto, Some(function_proto));
let number = number::create_number_object(gc_context, number_proto, Some(function_proto));
let boolean = boolean::create_boolean_object(gc_context, boolean_proto, Some(function_proto));
let flash = ScriptObject::object(gc_context, Some(object_proto));
let geom = ScriptObject::object(gc_context, Some(object_proto));

View File

@ -35,7 +35,7 @@ type CompareFn<'a, 'gc> = Box<
pub fn create_array_object<'gc>(
gc_context: MutationContext<'gc, '_>,
array_proto: Option<Object<'gc>>,
array_proto: Object<'gc>,
fn_proto: Option<Object<'gc>>,
) -> Object<'gc> {
let array = FunctionObject::function_and_constructor(

View File

@ -50,7 +50,7 @@ pub fn boolean_function<'gc>(
pub fn create_boolean_object<'gc>(
gc_context: MutationContext<'gc, '_>,
boolean_proto: Option<Object<'gc>>,
boolean_proto: Object<'gc>,
fn_proto: Option<Object<'gc>>,
) -> Object<'gc> {
FunctionObject::function_and_constructor(

View File

@ -50,7 +50,7 @@ pub fn number_function<'gc>(
pub fn create_number_object<'gc>(
gc_context: MutationContext<'gc, '_>,
number_proto: Option<Object<'gc>>,
number_proto: Object<'gc>,
fn_proto: Option<Object<'gc>>,
) -> Object<'gc> {
let number = FunctionObject::function_and_constructor(

View File

@ -51,7 +51,7 @@ pub fn string_function<'gc>(
pub fn create_string_object<'gc>(
gc_context: MutationContext<'gc, '_>,
string_proto: Option<Object<'gc>>,
string_proto: Object<'gc>,
fn_proto: Option<Object<'gc>>,
) -> Object<'gc> {
let string = FunctionObject::function_and_constructor(