avm2: Compare QNames by local name first
This commit is contained in:
parent
c2d521df41
commit
da4ed75bc8
|
@ -139,13 +139,22 @@ impl<'gc> Namespace<'gc> {
|
||||||
/// `QName`. All other forms of names and multinames are either versions of
|
/// `QName`. All other forms of names and multinames are either versions of
|
||||||
/// `QName` with unspecified parameters, or multiple names to be checked in
|
/// `QName` with unspecified parameters, or multiple names to be checked in
|
||||||
/// order.
|
/// order.
|
||||||
#[derive(Clone, Collect, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Collect, Debug, Hash)]
|
||||||
#[collect(no_drop)]
|
#[collect(no_drop)]
|
||||||
pub struct QName<'gc> {
|
pub struct QName<'gc> {
|
||||||
ns: Namespace<'gc>,
|
ns: Namespace<'gc>,
|
||||||
name: AvmString<'gc>,
|
name: AvmString<'gc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'gc> PartialEq for QName<'gc> {
|
||||||
|
fn eq(&self, other: &Self) -> bool {
|
||||||
|
// Implemented by hand to enforce order of comparisons for perf
|
||||||
|
self.name == other.name && self.ns == other.ns
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'gc> Eq for QName<'gc> {}
|
||||||
|
|
||||||
impl<'gc> QName<'gc> {
|
impl<'gc> QName<'gc> {
|
||||||
pub fn new(ns: Namespace<'gc>, name: impl Into<AvmString<'gc>>) -> Self {
|
pub fn new(ns: Namespace<'gc>, name: impl Into<AvmString<'gc>>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|
Loading…
Reference in New Issue