This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
Relax typing for comparison operators - #12537
Merged
Merged
Conversation
jfirebaugh
approved these changes
Aug 2, 2018
| void CollatorComparison::eachChild(const std::function<void(const Expression&)>& visit) const { | ||
| visit(*lhs); | ||
| visit(*rhs); | ||
| if (collator) { |
Contributor
There was a problem hiding this comment.
Is the null check needed?
Contributor
Author
There was a problem hiding this comment.
Ah, nope, it's leftover
| if (e.getKind() == Kind::Comparison) { | ||
| auto comp = static_cast<const CollatorComparison*>(&e); | ||
| return comp->op == op && | ||
| comp->collator && *comp->collator == *collator && |
Contributor
There was a problem hiding this comment.
Is the null check needed?
| bool gteqCollate(std::string a, std::string b, Collator c) { return c.compare(a, b) >= 0; } | ||
|
|
||
| static BasicComparison::CompareFunctionType getBasicCompareFunction(const std::string& op) { | ||
| static std::unordered_map<std::string, const BasicComparison::CompareFunctionType> map { |
Contributor
There was a problem hiding this comment.
unordered_map is somewhat expensive for binary size, and it's probably faster anyway to just cascade if statements.
| std::unique_ptr<Expression> lhs_, | ||
| std::unique_ptr<Expression> rhs_) | ||
| : Expression(Kind::Comparison, type::Boolean), | ||
| op(op_), |
added 2 commits
August 2, 2018 12:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports mapbox/mapbox-gl-js#6961