Remove lifetime from constants

This commit is contained in:
Adrian Wielgosik 2021-05-05 20:08:48 +02:00 committed by Mike Welsh
parent faa0e50e89
commit 5319a5bb81
36 changed files with 61 additions and 122 deletions

View File

@ -1229,21 +1229,18 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
let mut write = class.write(mc);
const PUBLIC_INSTANCE_METHODS: &[(&'static str, NativeMethod)] = &[
const PUBLIC_INSTANCE_METHODS: &[(&str, NativeMethod)] = &[
("toString", to_string),
("toLocaleString", to_locale_string),
("valueOf", value_of),
];
write.define_public_builtin_instance_methods(PUBLIC_INSTANCE_METHODS);
const PUBLIC_INSTANCE_PROPERTIES: &[(
&'static str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[("length", Some(length), Some(set_length))];
const PUBLIC_INSTANCE_PROPERTIES: &[(&str, Option<NativeMethod>, Option<NativeMethod>)] =
&[("length", Some(length), Some(set_length))];
write.define_public_builtin_instance_properties(PUBLIC_INSTANCE_PROPERTIES);
const AS3_INSTANCE_METHODS: &[(&'static str, NativeMethod)] = &[
const AS3_INSTANCE_METHODS: &[(&str, NativeMethod)] = &[
("concat", concat),
("join", join),
("forEach", for_each),
@ -1265,7 +1262,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
];
write.define_as3_builtin_instance_methods(AS3_INSTANCE_METHODS);
const CONSTANTS: &[(&'static str, u32)] = &[
const CONSTANTS: &[(&str, u32)] = &[
(
"CASEINSENSITIVE",
SortOptions::CASE_INSENSITIVE.bits() as u32,

View File

@ -45,7 +45,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::FINAL | ClassAttributes::SEALED);
const CONSTANTS: &[(&'static str, u32)] = &[("ACTIONSCRIPT2", 2), ("ACTIONSCRIPT3", 3)];
const CONSTANTS: &[(&str, u32)] = &[("ACTIONSCRIPT2", 2), ("ACTIONSCRIPT3", 3)];
write.define_public_constant_uint_class_traits(CONSTANTS);
class

View File

@ -44,7 +44,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
let mut write = class.write(mc);
write.set_attributes(ClassAttributes::SEALED);
const CONSTANTS: &[(&'static str, &'static str)] =
const CONSTANTS: &[(&str, &str)] =
&[("NONE", "none"), ("ROUND", "round"), ("SQUARE", "square")];
write.define_public_constant_string_class_traits(CONSTANTS);

View File

@ -597,11 +597,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
let mut write = class.write(mc);
const PUBLIC_INSTANCE_PROPERTIES: &[(
&'static str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[
const PUBLIC_INSTANCE_PROPERTIES: &[(&str, Option<NativeMethod>, Option<NativeMethod>)] = &[
("alpha", Some(alpha), Some(set_alpha)),
("height", Some(height), Some(set_height)),
("scaleY", Some(scale_y), Some(set_scale_y)),
@ -621,7 +617,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
];
write.define_public_builtin_instance_properties(PUBLIC_INSTANCE_PROPERTIES);
const PUBLIC_INSTANCE_METHODS: &[(&'static str, NativeMethod)] = &[
const PUBLIC_INSTANCE_METHODS: &[(&str, NativeMethod)] = &[
("hitTestPoint", hit_test_point),
("hitTestObject", hit_test_object),
];

View File

@ -585,14 +585,11 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
let mut write = class.write(mc);
const PUBLIC_INSTANCE_PROPERTIES: &[(
&'static str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[("numChildren", Some(num_children), None)];
const PUBLIC_INSTANCE_PROPERTIES: &[(&str, Option<NativeMethod>, Option<NativeMethod>)] =
&[("numChildren", Some(num_children), None)];
write.define_public_builtin_instance_properties(PUBLIC_INSTANCE_PROPERTIES);
const PUBLIC_INSTANCE_METHODS: &[(&'static str, NativeMethod)] = &[
const PUBLIC_INSTANCE_METHODS: &[(&str, NativeMethod)] = &[
("getChildAt", get_child_at),
("getChildByName", get_child_by_name),
("addChild", add_child),

View File

@ -101,11 +101,8 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
let mut write = class.write(mc);
const PUBLIC_INSTANCE_PROPERTIES: &[(
&'static str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[("name", Some(name), None), ("frame", Some(frame), None)];
const PUBLIC_INSTANCE_PROPERTIES: &[(&str, Option<NativeMethod>, Option<NativeMethod>)] =
&[("name", Some(name), None), ("frame", Some(frame), None)];
write.define_public_builtin_instance_properties(PUBLIC_INSTANCE_PROPERTIES);
class

View File

@ -365,7 +365,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::SEALED);
const PUBLIC_INSTANCE_METHODS: &[(&'static str, NativeMethod)] = &[
const PUBLIC_INSTANCE_METHODS: &[(&str, NativeMethod)] = &[
("beginFill", begin_fill),
("clear", clear),
("curveTo", curve_to),

View File

@ -45,7 +45,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::SEALED);
const CONSTANTS: &[(&'static str, &'static str)] =
const CONSTANTS: &[(&str, &str)] =
&[("BEVEL", "bevel"), ("MITER", "miter"), ("ROUND", "round")];
write.define_public_constant_string_class_traits(CONSTANTS);

View File

@ -45,7 +45,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::SEALED);
const CONSTANTS: &[(&'static str, &'static str)] = &[
const CONSTANTS: &[(&str, &str)] = &[
("HORIZONTAL", "horizontal"),
("NONE", "none"),
("NORMAL", "normal"),

View File

@ -433,11 +433,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::SEALED);
const PUBLIC_INSTANCE_PROPERTIES: &[(
&'static str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[
const PUBLIC_INSTANCE_PROPERTIES: &[(&str, Option<NativeMethod>, Option<NativeMethod>)] = &[
("actionScriptVersion", Some(action_script_version), None),
("applicationDomain", Some(application_domain), None),
("bytesLoaded", Some(bytes_total), None),

View File

@ -546,11 +546,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
let mut write = class.write(mc);
const PUBLIC_INSTANCE_PROPERTIES: &[(
&'static str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[
const PUBLIC_INSTANCE_PROPERTIES: &[(&str, Option<NativeMethod>, Option<NativeMethod>)] = &[
("currentFrame", Some(current_frame), None),
("currentFrameLabel", Some(current_frame_label), None),
("currentLabel", Some(current_label), None),
@ -563,7 +559,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
];
write.define_public_builtin_instance_properties(PUBLIC_INSTANCE_PROPERTIES);
const PUBLIC_INSTANCE_METHODS: &[(&'static str, NativeMethod)] = &[
const PUBLIC_INSTANCE_METHODS: &[(&str, NativeMethod)] = &[
("addFrameScript", add_frame_script),
("gotoAndPlay", goto_and_play),
("gotoAndStop", goto_and_stop),

View File

@ -125,11 +125,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
let mut write = class.write(mc);
const PUBLIC_INSTANCE_PROPERTIES: &[(
&'static str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[
const PUBLIC_INSTANCE_PROPERTIES: &[(&str, Option<NativeMethod>, Option<NativeMethod>)] = &[
("labels", Some(labels), None),
("name", Some(name), None),
("numFrames", Some(num_frames), None),

View File

@ -97,11 +97,8 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
let mut write = class.write(mc);
const PUBLIC_INSTANCE_PROPERTIES: &[(
&'static str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[("graphics", Some(graphics), None)];
const PUBLIC_INSTANCE_PROPERTIES: &[(&str, Option<NativeMethod>, Option<NativeMethod>)] =
&[("graphics", Some(graphics), None)];
write.define_public_builtin_instance_properties(PUBLIC_INSTANCE_PROPERTIES);
// Slot for lazy-initialized Graphics object.

View File

@ -91,11 +91,8 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::SEALED);
const PUBLIC_INSTANCE_PROPERTIES: &[(
&'static str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[("graphics", Some(graphics), None)];
const PUBLIC_INSTANCE_PROPERTIES: &[(&str, Option<NativeMethod>, Option<NativeMethod>)] =
&[("graphics", Some(graphics), None)];
write.define_public_builtin_instance_properties(PUBLIC_INSTANCE_PROPERTIES);
// Slot for lazy-initialized Graphics object.

View File

@ -615,7 +615,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::SEALED);
const PUBLIC_OVERRIDE_INSTANCE_PROPERTIES: &[(
&'static str,
&str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[
@ -668,11 +668,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
}
}
const PUBLIC_INSTANCE_PROPERTIES: &[(
&'static str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[
const PUBLIC_INSTANCE_PROPERTIES: &[(&str, Option<NativeMethod>, Option<NativeMethod>)] = &[
("align", Some(align), Some(set_align)),
("browserZoomFactor", Some(browser_zoom_factor), None),
("color", Some(color), Some(set_color)),

View File

@ -45,7 +45,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::SEALED | ClassAttributes::FINAL);
const CONSTANTS: &[(&'static str, &'static str)] = &[
const CONSTANTS: &[(&str, &str)] = &[
("BOTTOM", "B"),
("BOTTOM_LEFT", "BL"),
("BOTTOM_RIGHT", "BR"),

View File

@ -45,7 +45,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::SEALED | ClassAttributes::FINAL);
const CONSTANTS: &[(&'static str, &'static str)] = &[
const CONSTANTS: &[(&str, &str)] = &[
("FULL_SCREEN", "fullScreen"),
("FULL_SCREEN_INTERACTIVE", "fullScreenInteractive"),
("NORMAL", "normal"),

View File

@ -45,7 +45,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::SEALED | ClassAttributes::FINAL);
const CONSTANTS: &[(&'static str, &'static str)] = &[
const CONSTANTS: &[(&str, &str)] = &[
("BEST", "best"),
("HIGH", "high"),
("HIGH_16X16", "16x16"),

View File

@ -45,7 +45,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::SEALED | ClassAttributes::FINAL);
const CONSTANTS: &[(&'static str, &'static str)] = &[
const CONSTANTS: &[(&str, &str)] = &[
("EXACT_FIT", "exactFit"),
("NO_BORDER", "noBorder"),
("NO_SCALE", "noScale"),

View File

@ -45,7 +45,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::FINAL | ClassAttributes::SEALED);
const CONSTANTS: &[(&'static str, u32)] = &[
const CONSTANTS: &[(&str, u32)] = &[
("FLASH1", 1),
("FLASH2", 2),
("FLASH3", 3),

View File

@ -273,11 +273,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::SEALED);
const PUBLIC_INSTANCE_PROPERTIES: &[(
&'static str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[
const PUBLIC_INSTANCE_PROPERTIES: &[(&str, Option<NativeMethod>, Option<NativeMethod>)] = &[
("bubbles", Some(bubbles), None),
("cancelable", Some(cancelable), None),
("type", Some(get_type), None),
@ -287,7 +283,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
];
write.define_public_builtin_instance_properties(PUBLIC_INSTANCE_PROPERTIES);
const PUBLIC_INSTANCE_METHODS: &[(&'static str, NativeMethod)] = &[
const PUBLIC_INSTANCE_METHODS: &[(&str, NativeMethod)] = &[
("clone", clone),
("formatToString", format_to_string),
("isDefaultPrevented", is_default_prevented),
@ -298,7 +294,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
];
write.define_public_builtin_instance_methods(PUBLIC_INSTANCE_METHODS);
const CONSTANTS: &[(&'static str, &'static str)] = &[
const CONSTANTS: &[(&str, &str)] = &[
("ACTIVATE", "activate"),
("ADDED", "added"),
("ADDED_TO_STAGE", "addedToStage"),

View File

@ -253,7 +253,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.implements(QName::new(Namespace::package("flash.events"), "IEventDispatcher").into());
const PUBLIC_INSTANCE_METHODS: &[(&'static str, NativeMethod)] = &[
const PUBLIC_INSTANCE_METHODS: &[(&str, NativeMethod)] = &[
("addEventListener", add_event_listener),
("removeEventListener", remove_event_listener),
("hasEventListener", has_event_listener),

View File

@ -41,7 +41,7 @@ pub fn create_interface<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<
write.set_attributes(ClassAttributes::INTERFACE);
const PUBLIC_INSTANCE_METHODS: &[(&'static str, NativeMethod)] = &[
const PUBLIC_INSTANCE_METHODS: &[(&str, NativeMethod)] = &[
("addEventListener", bodiless_method),
("dispatchEvent", bodiless_method),
("hasEventListener", bodiless_method),

View File

@ -341,21 +341,18 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
let mut write = class.write(mc);
write.set_attributes(ClassAttributes::SEALED);
const PUBLIC_INSTANCE_PROPERTIES: &[(
&'static str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[("length", Some(length), None)];
const PUBLIC_INSTANCE_PROPERTIES: &[(&str, Option<NativeMethod>, Option<NativeMethod>)] =
&[("length", Some(length), None)];
write.define_public_builtin_instance_properties(PUBLIC_INSTANCE_PROPERTIES);
const PUBLIC_CLASS_METHODS: &[(&'static str, NativeMethod)] = &[
const PUBLIC_CLASS_METHODS: &[(&str, NativeMethod)] = &[
("distance", distance),
("interpolate", interpolate),
("polar", polar),
];
write.define_public_builtin_class_methods(PUBLIC_CLASS_METHODS);
const PUBLIC_INSTANCE_METHODS: &[(&'static str, NativeMethod)] = &[
const PUBLIC_INSTANCE_METHODS: &[(&str, NativeMethod)] = &[
("add", add),
("clone", clone),
("copyFrom", copy_from),

View File

@ -160,7 +160,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
let mut write = class.write(mc);
const PUBLIC_CLASS_METHODS: &[(&'static str, NativeMethod)] = &[
const PUBLIC_CLASS_METHODS: &[(&str, NativeMethod)] = &[
("currentDomain", current_domain),
("parentDomain", parent_domain),
("getDefinition", get_definition),
@ -168,11 +168,8 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
];
write.define_public_builtin_class_methods(PUBLIC_CLASS_METHODS);
const PUBLIC_INSTANCE_PROPERTIES: &[(
&'static str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[("domainMemory", Some(domain_memory), Some(set_domain_memory))];
const PUBLIC_INSTANCE_PROPERTIES: &[(&str, Option<NativeMethod>, Option<NativeMethod>)] =
&[("domainMemory", Some(domain_memory), Some(set_domain_memory))];
write.define_public_builtin_instance_properties(PUBLIC_INSTANCE_PROPERTIES);
class

View File

@ -52,7 +52,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
let mut write = class.write(mc);
const PUBLIC_CLASS_METHODS: &[(&'static str, NativeMethod)] = &[("gc", gc)];
const PUBLIC_CLASS_METHODS: &[(&str, NativeMethod)] = &[("gc", gc)];
write.define_public_builtin_class_methods(PUBLIC_CLASS_METHODS);
class

View File

@ -865,11 +865,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::SEALED);
const PUBLIC_INSTANCE_PROPERTIES: &[(
&'static str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[
const PUBLIC_INSTANCE_PROPERTIES: &[(&str, Option<NativeMethod>, Option<NativeMethod>)] = &[
("autoSize", Some(autosize), Some(set_autosize)),
(
"backgroundColor",
@ -902,7 +898,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
];
write.define_public_builtin_instance_properties(PUBLIC_INSTANCE_PROPERTIES);
const PUBLIC_INSTANCE_METHODS: &[(&'static str, NativeMethod)] = &[
const PUBLIC_INSTANCE_METHODS: &[(&str, NativeMethod)] = &[
("appendText", append_text),
("getTextFormat", get_text_format),
("replaceSelectedText", replace_selected_text),

View File

@ -45,7 +45,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::FINAL | ClassAttributes::SEALED);
const CONSTANTS: &[(&'static str, &'static str)] = &[
const CONSTANTS: &[(&str, &str)] = &[
("CENTER", "center"),
("LEFT", "left"),
("NONE", "none"),

View File

@ -45,8 +45,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::FINAL | ClassAttributes::SEALED);
const CONSTANTS: &[(&'static str, &'static str)] =
&[("DYNAMIC", "dynamic"), ("INPUT", "input")];
const CONSTANTS: &[(&str, &str)] = &[("DYNAMIC", "dynamic"), ("INPUT", "input")];
write.define_public_constant_string_class_traits(CONSTANTS);
class

View File

@ -125,7 +125,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::SEALED);
const ITEMS: &[(&'static str, &'static str)] = &[
const ITEMS: &[(&str, &str)] = &[
("align", "String"),
("blockIndent", "Object"),
("bold", "Object"),

View File

@ -45,7 +45,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::FINAL | ClassAttributes::SEALED);
const CONSTANTS: &[(&'static str, &'static str)] = &[
const CONSTANTS: &[(&str, &str)] = &[
("CENTER", "center"),
("END", "end"),
("JUSTIFY", "justify"),

View File

@ -743,7 +743,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::SEALED);
const PUBLIC_INSTANCE_METHODS: &[(&'static str, NativeMethod)] = &[
const PUBLIC_INSTANCE_METHODS: &[(&str, NativeMethod)] = &[
("writeByte", write_byte),
("writeBytes", write_bytes),
("readBytes", read_bytes),
@ -777,11 +777,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
];
write.define_public_builtin_instance_methods(PUBLIC_INSTANCE_METHODS);
const PUBLIC_INSTANCE_PROPERTIES: &[(
&'static str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[
const PUBLIC_INSTANCE_PROPERTIES: &[(&str, Option<NativeMethod>, Option<NativeMethod>)] = &[
("bytesAvailable", Some(bytes_available), None),
("length", Some(length), Some(set_length)),
("position", Some(position), Some(set_position)),

View File

@ -38,7 +38,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::FINAL | ClassAttributes::SEALED);
const CONSTANTS: &[(&'static str, &'static str)] = &[
const CONSTANTS: &[(&str, &str)] = &[
("LITTLE_ENDIAN", "littleEndian"),
("BIG_ENDIAN", "bigEndian"),
];

View File

@ -55,7 +55,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
write.set_attributes(ClassAttributes::FINAL | ClassAttributes::SEALED);
use std::f64::consts::*;
const CONSTANTS: &[(&'static str, f64)] = &[
const CONSTANTS: &[(&str, f64)] = &[
("E", E),
("LN10", LN_10),
("LN2", LN_2),
@ -67,7 +67,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
];
write.define_public_constant_number_class_traits(CONSTANTS);
const PUBLIC_CLASS_METHODS: &[(&'static str, NativeMethod)] = &[
const PUBLIC_CLASS_METHODS: &[(&str, NativeMethod)] = &[
("atan2", atan2),
("max", max),
("min", min),

View File

@ -274,11 +274,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
let mut write = class.write(mc);
const PUBLIC_INSTANCE_PROPERTIES: &[(
&'static str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[
const PUBLIC_INSTANCE_PROPERTIES: &[(&str, Option<NativeMethod>, Option<NativeMethod>)] = &[
("dotall", Some(dotall), None),
("extended", Some(extended), None),
("global", Some(global), None),
@ -289,7 +285,7 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
];
write.define_public_builtin_instance_properties(PUBLIC_INSTANCE_PROPERTIES);
const AS3_INSTANCE_METHODS: &[(&'static str, NativeMethod)] = &[("exec", exec), ("test", test)];
const AS3_INSTANCE_METHODS: &[(&str, NativeMethod)] = &[("exec", exec), ("test", test)];
write.define_as3_builtin_instance_methods(AS3_INSTANCE_METHODS);
class

View File

@ -129,14 +129,11 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
let mut write = class.write(mc);
write.set_attributes(ClassAttributes::FINAL | ClassAttributes::SEALED);
const PUBLIC_INSTANCE_PROPERTIES: &[(
&'static str,
Option<NativeMethod>,
Option<NativeMethod>,
)] = &[("length", Some(length), None)];
const PUBLIC_INSTANCE_PROPERTIES: &[(&str, Option<NativeMethod>, Option<NativeMethod>)] =
&[("length", Some(length), None)];
write.define_public_builtin_instance_properties(PUBLIC_INSTANCE_PROPERTIES);
const AS3_INSTANCE_METHODS: &[(&'static str, NativeMethod)] =
const AS3_INSTANCE_METHODS: &[(&str, NativeMethod)] =
&[("charAt", char_at), ("charCodeAt", char_code_at)];
write.define_as3_builtin_instance_methods(AS3_INSTANCE_METHODS);