chore: Move core::property_map to core::avm1::property_map

This commit is contained in:
Moulins 2021-05-03 21:15:59 +02:00 committed by Mike Welsh
parent 272841729e
commit 78627acc92
6 changed files with 10 additions and 15 deletions

View File

@ -23,6 +23,7 @@ pub mod function;
pub mod globals; pub mod globals;
pub mod object; pub mod object;
pub mod property; pub mod property;
pub mod property_map;
mod scope; mod scope;
mod string; mod string;
mod timer; mod timer;

View File

@ -2,8 +2,8 @@ use crate::avm1::activation::Activation;
use crate::avm1::error::Error; use crate::avm1::error::Error;
use crate::avm1::function::{Executable, ExecutionReason, FunctionObject, NativeFunction}; use crate::avm1::function::{Executable, ExecutionReason, FunctionObject, NativeFunction};
use crate::avm1::property::{Attribute, Property}; use crate::avm1::property::{Attribute, Property};
use crate::avm1::property_map::{Entry, PropertyMap};
use crate::avm1::{AvmString, Object, ObjectPtr, TObject, Value}; use crate::avm1::{AvmString, Object, ObjectPtr, TObject, Value};
use crate::property_map::{Entry, PropertyMap};
use core::fmt; use core::fmt;
use gc_arena::{Collect, GcCell, MutationContext}; use gc_arena::{Collect, GcCell, MutationContext};
use std::borrow::Cow; use std::borrow::Cow;

View File

@ -5,11 +5,11 @@ use crate::avm1::error::Error;
use crate::avm1::function::Executable; use crate::avm1::function::Executable;
use crate::avm1::object::search_prototype; use crate::avm1::object::search_prototype;
use crate::avm1::property::Attribute; use crate::avm1::property::Attribute;
use crate::avm1::property_map::PropertyMap;
use crate::avm1::{AvmString, Object, ObjectPtr, ScriptObject, TDisplayObject, TObject, Value}; use crate::avm1::{AvmString, Object, ObjectPtr, ScriptObject, TDisplayObject, TObject, Value};
use crate::avm_warn; use crate::avm_warn;
use crate::context::UpdateContext; use crate::context::UpdateContext;
use crate::display_object::{DisplayObject, EditText, MovieClip, TDisplayObjectContainer}; use crate::display_object::{DisplayObject, EditText, MovieClip, TDisplayObjectContainer};
use crate::property_map::PropertyMap;
use crate::string_utils::swf_string_eq; use crate::string_utils::swf_string_eq;
use crate::types::Percent; use crate::types::Percent;
use gc_arena::{Collect, GcCell, MutationContext}; use gc_arena::{Collect, GcCell, MutationContext};

View File

@ -107,10 +107,6 @@ impl<V> PropertyMap<V> {
self.0.shift_remove(&CaseInsensitiveStr(key)) self.0.shift_remove(&CaseInsensitiveStr(key))
} }
} }
pub fn is_empty(&self) -> bool {
self.0.is_empty()
}
} }
unsafe impl<V: Collect> Collect for PropertyMap<V> { unsafe impl<V: Collect> Collect for PropertyMap<V> {

View File

@ -38,7 +38,6 @@ mod library;
pub mod loader; pub mod loader;
mod player; mod player;
mod prelude; mod prelude;
pub mod property_map;
pub mod shape_utils; pub mod shape_utils;
pub mod string_utils; pub mod string_utils;
pub mod tag_utils; pub mod tag_utils;

View File

@ -1,14 +1,13 @@
use crate::avm1::function::FunctionObject;
use crate::avm1::property_map::PropertyMap as Avm1PropertyMap;
use crate::avm2::{Domain as Avm2Domain, Object as Avm2Object};
use crate::backend::audio::SoundHandle; use crate::backend::audio::SoundHandle;
use crate::character::Character; use crate::character::Character;
use crate::display_object::{Bitmap, TDisplayObject}; use crate::display_object::{Bitmap, TDisplayObject};
use crate::font::{Font, FontDescriptor}; use crate::font::{Font, FontDescriptor};
use crate::prelude::*; use crate::prelude::*;
use crate::property_map::PropertyMap;
use crate::tag_utils::{SwfMovie, SwfSlice}; use crate::tag_utils::{SwfMovie, SwfSlice};
use crate::vminterface::AvmType; use crate::vminterface::AvmType;
use crate::{
avm1::function::FunctionObject, avm2::Domain as Avm2Domain, avm2::Object as Avm2Object,
};
use gc_arena::{Collect, Gc, GcCell, MutationContext}; use gc_arena::{Collect, Gc, GcCell, MutationContext};
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::{Arc, Weak}; use std::sync::{Arc, Weak};
@ -23,14 +22,14 @@ type Error = Box<dyn std::error::Error>;
#[derive(Collect)] #[derive(Collect)]
#[collect(no_drop)] #[collect(no_drop)]
pub struct Avm1ConstructorRegistry<'gc> { pub struct Avm1ConstructorRegistry<'gc> {
symbol_map: GcCell<'gc, PropertyMap<FunctionObject<'gc>>>, symbol_map: GcCell<'gc, Avm1PropertyMap<FunctionObject<'gc>>>,
is_case_sensitive: bool, is_case_sensitive: bool,
} }
impl<'gc> Avm1ConstructorRegistry<'gc> { impl<'gc> Avm1ConstructorRegistry<'gc> {
pub fn new(is_case_sensitive: bool, gc_context: MutationContext<'gc, '_>) -> Self { pub fn new(is_case_sensitive: bool, gc_context: MutationContext<'gc, '_>) -> Self {
Self { Self {
symbol_map: GcCell::allocate(gc_context, PropertyMap::new()), symbol_map: GcCell::allocate(gc_context, Avm1PropertyMap::new()),
is_case_sensitive, is_case_sensitive,
} }
} }
@ -135,7 +134,7 @@ impl<'gc> Avm2ConstructorRegistry<'gc> {
#[collect(no_drop)] #[collect(no_drop)]
pub struct MovieLibrary<'gc> { pub struct MovieLibrary<'gc> {
characters: HashMap<CharacterId, Character<'gc>>, characters: HashMap<CharacterId, Character<'gc>>,
export_characters: PropertyMap<Character<'gc>>, export_characters: Avm1PropertyMap<Character<'gc>>,
jpeg_tables: Option<Vec<u8>>, jpeg_tables: Option<Vec<u8>>,
fonts: HashMap<FontDescriptor, Font<'gc>>, fonts: HashMap<FontDescriptor, Font<'gc>>,
avm_type: AvmType, avm_type: AvmType,
@ -150,7 +149,7 @@ impl<'gc> MovieLibrary<'gc> {
pub fn new(avm_type: AvmType) -> Self { pub fn new(avm_type: AvmType) -> Self {
MovieLibrary { MovieLibrary {
characters: HashMap::new(), characters: HashMap::new(),
export_characters: PropertyMap::new(), export_characters: Avm1PropertyMap::new(),
jpeg_tables: None, jpeg_tables: None,
fonts: HashMap::new(), fonts: HashMap::new(),
avm_type, avm_type,