Skip to content

Commit 664a9c2

Browse files
glebmxzyfer
authored andcommitted
Fix VS2013 warning C4800 in src/ast_selectors.cpp
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
1 parent 83e8513 commit 664a9c2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/ast_selectors.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,15 @@ namespace Sass {
8888
bool Selector_Schema::has_parent_ref() const
8989
{
9090
if (String_Schema_Obj schema = Cast<String_Schema>(contents())) {
91-
return schema->length() > 0 && Cast<Parent_Selector>(schema->at(0)) != NULL;
91+
return !schema->empty() && typeid(*schema->at(0)) == typeid(Parent_Selector);
9292
}
9393
return false;
9494
}
9595

9696
bool Selector_Schema::has_real_parent_ref() const
9797
{
9898
if (String_Schema_Obj schema = Cast<String_Schema>(contents())) {
99-
if (schema->length() == 0) return false;
100-
return Cast<Parent_Reference>(schema->at(0));
99+
return !schema->empty() && typeid(*schema->at(0)) == typeid(Parent_Reference);
101100
}
102101
return false;
103102
}

0 commit comments

Comments
 (0)