From 664a9c2a08fefb2b41856a4f76a60b2ea83f02c7 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 15 Dec 2018 19:00:01 +0000 Subject: [PATCH] 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 --- src/ast_selectors.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ast_selectors.cpp b/src/ast_selectors.cpp index 76547d86b..3327350ac 100644 --- a/src/ast_selectors.cpp +++ b/src/ast_selectors.cpp @@ -88,7 +88,7 @@ namespace Sass { bool Selector_Schema::has_parent_ref() const { if (String_Schema_Obj schema = Cast(contents())) { - return schema->length() > 0 && Cast(schema->at(0)) != NULL; + return !schema->empty() && typeid(*schema->at(0)) == typeid(Parent_Selector); } return false; } @@ -96,8 +96,7 @@ namespace Sass { bool Selector_Schema::has_real_parent_ref() const { if (String_Schema_Obj schema = Cast(contents())) { - if (schema->length() == 0) return false; - return Cast(schema->at(0)); + return !schema->empty() && typeid(*schema->at(0)) == typeid(Parent_Reference); } return false; }