Skip to content

Commit

Permalink
Fix VS2013 warning C4800 in src/ast_selectors.cpp
Browse files Browse the repository at this point in the history
Fixes the following warning when compiling with VS2013:

> ..\..\src\ast_selectors.cpp(100): warning C4800: 'Sass::Parent_Reference *' : forcing value to bool 'true' or 'false' (performance warning)

This warning is visible in AppVeyor: https://ci.appveyor.com/project/sass/libsass/builds/21035726/job/dyi132vi6qnqy0ir
  • Loading branch information
glebm authored and xzyfer committed Dec 16, 2018
1 parent 83e8513 commit 664a9c2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/ast_selectors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,15 @@ namespace Sass {
bool Selector_Schema::has_parent_ref() const
{
if (String_Schema_Obj schema = Cast<String_Schema>(contents())) {
return schema->length() > 0 && Cast<Parent_Selector>(schema->at(0)) != NULL;
return !schema->empty() && typeid(*schema->at(0)) == typeid(Parent_Selector);
}
return false;
}

bool Selector_Schema::has_real_parent_ref() const
{
if (String_Schema_Obj schema = Cast<String_Schema>(contents())) {
if (schema->length() == 0) return false;
return Cast<Parent_Reference>(schema->at(0));
return !schema->empty() && typeid(*schema->at(0)) == typeid(Parent_Reference);
}
return false;
}
Expand Down

0 comments on commit 664a9c2

Please sign in to comment.