bool PropertyDescriptor::equalTo(ExecState* exec, const PropertyDescriptor& other) const
{
    if (other.m_value.isEmpty() != m_value.isEmpty()
        || other.m_getter.isEmpty() != m_getter.isEmpty()
        || other.m_setter.isEmpty() != m_setter.isEmpty())
        return false;
    return (!m_value || sameValue(exec, other.m_value, m_value))
        && (!m_getter || JSValue::strictEqual(exec, other.m_getter, m_getter))
        && (!m_setter || JSValue::strictEqual(exec, other.m_setter, m_setter))
        && attributesEqual(other);
}
bool PropertyDescriptor::equalTo(const PropertyDescriptor& other) const
{
    if (!other.m_value == m_value ||
        !other.m_getter == m_getter ||
        !other.m_setter == m_setter)
        return false;
    return (!m_value || JSValue::strictEqual(other.m_value, m_value)) && 
           (!m_getter || JSValue::strictEqual(other.m_getter, m_getter)) && 
           (!m_setter || JSValue::strictEqual(other.m_setter, m_setter)) &&
           attributesEqual(other);
}
示例#3
0
static int nodesEqual(DFNode *a, DFNode *b)
{
    if ((a == NULL) && (b == NULL))
        return 1;

    if ((a == NULL) || (b == NULL))
        return 0;

    if (a->tag != b->tag)
        return 0;

    if (a->tag < MIN_ELEMENT_TAG)
        return 0;

    // First check if the number and type of children are the same
    DFNode *aChild = a->first;
    DFNode *bChild = b->first;
    while ((aChild != NULL) || (bChild != NULL)) {
        if ((aChild != NULL) && (bChild == NULL))
            return 0;
        if ((aChild == NULL) && (bChild != NULL))
            return 0;
        if (aChild->tag != bChild->tag)
            return 0;
        aChild = aChild->next;
        bChild = bChild->next;
    }

    // Next check the attributes
    if (!attributesEqual(a,b))
        return 0;

    // Now check the *content* of the children. We do this after the above as it is more expensive.
    aChild = a->first;
    bChild = b->first;
    while ((aChild != NULL) || (bChild != NULL)) {
        if (!nodesEqual(aChild,bChild))
            return 0;
        aChild = aChild->next;
        bChild = bChild->next;
    }
    return 1;
}