Exemplo n.º 1
0
bool
Projection::operator==(const Projection &Other) const {
    if (isNominalKind() && Other.isNominalKind()) {
        return Other.getDecl() == Decl;
    } else {
        return !Other.isNominalKind() && Index == Other.getIndex();
    }
}
Exemplo n.º 2
0
bool
Projection::operator<(Projection Other) const {
    // If we have a nominal kind...
    if (isNominalKind()) {
        // And Other is also nominal...
        if (Other.isNominalKind()) {
            // Just compare the value decl pointers.
            return getDeclIndex() < Other.getDeclIndex();
        }

        // Otherwise if Other is not nominal, return true since we always sort
        // decls before indices.
        return true;
    } else {
        // If this is not a nominal kind and Other is nominal, return
        // false. Nominal kinds are always sorted before non-nominal kinds.
        if (Other.isNominalKind())
            return false;

        // Otherwise, we are both index projections. Compare the indices.
        return getIndex() < Other.getIndex();
    }
}