示例#1
0
/// Returns true if we are accessing different fields.
static bool areProjectionsToDifferentFields(const Projection &P1,
        const Projection &P2) {
    // If operands have the same type and we are accessing different fields,
    // returns true. Operand's type is not saved in Projection. Instead we check
    // Decl's context.
    if (!P1.isNominalKind() || !P2.isNominalKind())
        return false;

    return P1.getDecl()->getDeclContext() == P2.getDecl()->getDeclContext() &&
           P1 != P2;
}
示例#2
0
bool
Projection::operator==(const Projection &Other) const {
    if (isNominalKind() && Other.isNominalKind()) {
        return Other.getDecl() == Decl;
    } else {
        return !Other.isNominalKind() && Index == Other.getIndex();
    }
}