From 0d206996cd68b9f08ae1b4d9da6f16293984302c Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 4 Feb 2019 12:11:18 -0500 Subject: Feature/casting tidyup (#822) * Use 'is' over 'as' where appropriate. * dynamic_cast -> dynamicCast * Replace 'dynamicCast' with 'as' where has no change in behavior/ambiguity. * Replace dynamicCast with as where doesn't change behavior/non ambiguous. --- source/slang/parser.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'source/slang/parser.cpp') diff --git a/source/slang/parser.cpp b/source/slang/parser.cpp index 0c6419ae3..076111711 100644 --- a/source/slang/parser.cpp +++ b/source/slang/parser.cpp @@ -795,7 +795,7 @@ namespace Slang return nullptr; auto decl = lookupResult.item.declRef.getDecl(); - if( auto syntaxDecl = dynamic_cast(decl) ) + if( auto syntaxDecl = as(decl) ) { return syntaxDecl; } @@ -1323,7 +1323,7 @@ namespace Slang static RefPtr CreateVarDeclForContext( ContainerDecl* containerDecl ) { - if (dynamic_cast(containerDecl)) + if (as(containerDecl)) { // Function parameters always use their dedicated syntax class. // @@ -1685,15 +1685,7 @@ namespace Slang if (!lookupResult.isValid() || lookupResult.isOverloaded()) return false; - auto decl = lookupResult.item.declRef.getDecl(); - if (auto genericDecl = dynamic_cast(decl)) - { - return true; - } - else - { - return false; - } + return lookupResult.item.declRef.is(); } static RefPtr tryParseGenericApp( @@ -3321,11 +3313,11 @@ namespace Slang return false; auto decl = lookupResult.item.declRef.getDecl(); - if( auto typeDecl = dynamic_cast(decl) ) + if( auto typeDecl = as(decl) ) { return true; } - else if( auto typeVarDecl = dynamic_cast(decl) ) + else if( auto typeVarDecl = as(decl) ) { return true; } -- cgit v1.2.3