[flang] Avoid copying scope. Improve readability.

Original-commit: flang-compiler/f18@5d2213cd7a
Tree-same-pre-rewrite: false
This commit is contained in:
Steve Scalpone 2019-04-15 09:41:27 -07:00
parent e2d6bbc016
commit 05f0145be5
1 changed files with 2 additions and 2 deletions

View File

@ -38,8 +38,8 @@ void ReturnStmtChecker::Leave(const parser::ReturnStmt &returnStmt) {
// subroutine subprogram.
// C1575 The scalar-int-expr is allowed only in the inclusive scope of a
// subroutine subprogram.
auto scope{context_.FindScope(*context_.location())};
auto subprogramScope{FindContainingSubprogram(scope)};
const auto &scope{context_.FindScope(*context_.location())};
const auto &subprogramScope{FindContainingSubprogram(scope)};
if (subprogramScope == nullptr) {
context_.Say(
"RETURN must in the inclusive scope of a SUBPROGRAM"_err_en_US);