Skip to content

Commit

Permalink
Merge pull request #1707 from mgreter/clang-warnings
Browse files Browse the repository at this point in the history
Avoid some clang compiler warnings
  • Loading branch information
mgreter committed Nov 14, 2015
2 parents b799509 + 00c64fe commit 78f6009
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,15 @@ namespace Sass {
{
for (i = 0, L = rhs->length(); i < L; ++i)
{
if ((typeid(*(*rhs)[i]) == typeid(Pseudo_Selector) || typeid(*(*rhs)[i]) == typeid(Wrapped_Selector)) && (*rhs)[L-1]->is_pseudo_element())
if ((dynamic_cast<Pseudo_Selector*>((*rhs)[i]) || dynamic_cast<Wrapped_Selector*>((*rhs)[i])) && (*rhs)[L-1]->is_pseudo_element())
{ found = true; break; }
}
}
else
{
for (i = 0, L = rhs->length(); i < L; ++i)
{
if (typeid(*(*rhs)[i]) == typeid(Pseudo_Selector) || typeid(*(*rhs)[i]) == typeid(Wrapped_Selector))
if (dynamic_cast<Pseudo_Selector*>((*rhs)[i]) || dynamic_cast<Wrapped_Selector*>((*rhs)[i]))
{ found = true; break; }
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/ast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ namespace Sass {
virtual ~Vectorized() = 0;
size_t length() const { return elements_.size(); }
bool empty() const { return elements_.empty(); }
T last() { return elements_.back(); }
T first() { return elements_.front(); }
T last() const { return elements_.back(); }
T first() const { return elements_.front(); }
T& operator[](size_t i) { return elements_[i]; }
virtual const T& at(size_t i) const { return elements_.at(i); }
const T& operator[](size_t i) const { return elements_[i]; }
Expand Down Expand Up @@ -2079,9 +2079,9 @@ namespace Sass {
}
const Simple_Selector* base() const {
if (length() == 0) return 0;
if (typeid(*(*this)[0]) == typeid(Type_Selector))
// ToDo: why is this needed?
if (dynamic_cast<Type_Selector*>((*this)[0]))
return (*this)[0];
// else cerr << "SERIOUSELY " << "\n";
return 0;
}
virtual bool is_superselector_of(Compound_Selector* sub, std::string wrapped = "");
Expand All @@ -2098,7 +2098,7 @@ namespace Sass {
bool is_empty_reference()
{
return length() == 1 &&
typeid(*(*this)[0]) == typeid(Parent_Selector);
dynamic_cast<Parent_Selector*>((*this)[0]);
}
std::vector<std::string> to_str_vec(); // sometimes need to convert to a flat "by-value" data structure

Expand Down
2 changes: 1 addition & 1 deletion src/eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ namespace Sass {
To_String to_string(&ctx);
// Special cases: +/- variables which evaluate to null ouput just +/-,
// but +/- null itself outputs the string
if (operand->concrete_type() == Expression::NULL_VAL && typeid(*(u->operand())) == typeid(Variable)) {
if (operand->concrete_type() == Expression::NULL_VAL && dynamic_cast<Variable*>(u->operand())) {
u->operand(SASS_MEMORY_NEW(ctx.mem, String_Quoted, u->pstate(), ""));
}
else u->operand(operand);
Expand Down

0 comments on commit 78f6009

Please sign in to comment.