From eed93abebc20e59f861c7e8b6322f7ef3681c59e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 31 Mar 2022 13:20:37 +0200 Subject: Get rid of unnecessary dynamic_cast call --- libbuild2/search.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libbuild2/search.cxx b/libbuild2/search.cxx index fca19ea..d3638d7 100644 --- a/libbuild2/search.cxx +++ b/libbuild2/search.cxx @@ -86,6 +86,10 @@ namespace build2 const target_key& ctk (cpk.tk); const scope* s (cpk.scope); + // Has to be a file target. + // + assert (ctk.type->is_a ()); + path f; if (ctk.dir->absolute ()) @@ -191,9 +195,7 @@ namespace build2 target_decl::prereq_file, trace)); - // Has to be a file_target. - // - const file& t (dynamic_cast (r.first)); + const file& t (r.first.as ()); l5 ([&]{trace << (r.second ? "new" : "existing") << " target " << t << " for prerequisite " << cpk;}); -- cgit v1.1