Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
asl committed Mar 12, 2024
1 parent a49985c commit f3c91ac
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion lib/enumerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,12 @@ class IteratorEnumerator : public Enumerator<typename Iter::value_type> {

/////////////////////////////////////////////////////////////////////

/// Always returns false
/// Always empty iterator (equivalent to end())
template <typename T>
class EmptyEnumerator : public Enumerator<T> {
public:
[[nodiscard]] std::string toString() const { return "EmptyEnumerator"; }
/// Always returns false
bool moveNext() { return false; }
T getCurrent() const {
throw std::logic_error("You cannot call 'getCurrent' on an EmptyEnumerator");
Expand Down
4 changes: 2 additions & 2 deletions lib/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ class IterKeys {
}
bool operator==(const iterator &i) const { return it == i.it; }
bool operator!=(const iterator &i) const { return it != i.it; }
auto operator*() const { return it->first; }
auto operator->() const { return &it->first; }
reference operator*() const { return it->first; }
pointer operator->() const { return &it->first; }
} b, e;

public:
Expand Down
11 changes: 6 additions & 5 deletions tools/ir-generator/irclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,11 +528,12 @@ bool IrClass::shouldSkip(cstring feature) const {
// (except for validate)
if (feature == "validate") return false;

bool provided =
Util::enumerate(elements)
->where([](IrElement *e) { return e->is<IrMethod>(); })
->where([feature](IrElement *e) { return e->to<IrMethod>()->name == feature; })
->any();
bool provided = Util::enumerate(elements)
->where([feature](IrElement *e) {
const auto *m = e->to<IrMethod>();
return m && m->name == feature;
})
->any();
return provided;
}

Expand Down

0 comments on commit f3c91ac

Please sign in to comment.