Skip to content

Commit

Permalink
vaev-style: Reduced debug spam for not implemented selectors.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Nov 5, 2024
1 parent 810026c commit ee66b6b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/vaev-style/decls.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Res<T> parseDeclarationValue(Cursor<Css::Sst> &c) {

return Ok(std::move(t));
} else {
logError("missing parser for declaration: {}", T::name());
logDebug("missing parser for declaration: {}", T::name());
return Error::notImplemented("missing parser for declaration");
}
}
Expand Down
12 changes: 7 additions & 5 deletions src/vaev-style/select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Vaev::Style {

static constexpr bool DEBUG_SELECTORS = false;

// MARK: Selector Specificity ---------------------------------------------------

// https://www.w3.org/TR/selectors-3/#specificity
Expand Down Expand Up @@ -43,7 +45,7 @@ Spec spec(Selector const &s) {
return Spec::ZERO;
},
[](auto const &s) {
logWarn("unimplemented selector: {}", s);
logWarnIf(DEBUG_SELECTORS, "unimplemented selector: {}", s);
return Spec::ZERO;
}
});
Expand Down Expand Up @@ -117,7 +119,7 @@ static bool _match(Infix const &s, Markup::Element const &e) {
return _matchSubsequent(*s.lhs, e);

default:
logWarn("unimplemented selector: {}", s);
logWarnIf(DEBUG_SELECTORS, "unimplemented selector: {}", s);
return false;
}
}
Expand Down Expand Up @@ -148,7 +150,7 @@ static bool _match(Nfix const &s, Markup::Element const &el) {
return not s.inners[0].match(el);

default:
logWarn("unimplemented selector: {}", s);
logWarnIf(DEBUG_SELECTORS, "unimplemented selector: {}", s);
return false;
}
}
Expand Down Expand Up @@ -221,7 +223,7 @@ static bool _match(Pseudo const &s, Markup::Element const &el) {
return _matchLastOfType(el);

default:
logDebug("unimplemented pseudo class: {}", s);
logDebugIf(DEBUG_SELECTORS, "unimplemented pseudo class: {}", s);
return false;
}
}
Expand All @@ -240,7 +242,7 @@ bool Selector::match(Markup::Element const &el) const {
if constexpr (requires { _match(s, el); })
return _match(s, el);

logWarn("unimplemented selector: {}", s);
logWarnIf(DEBUG_SELECTORS, "unimplemented selector: {}", s);
return false;
}
);
Expand Down

0 comments on commit ee66b6b

Please sign in to comment.