[flang] Semantics checker for STOP and ERROR STOP statements - better variable names
authorPaul Osmialowski <pawel.osmialowski@arm.com>
Thu, 11 Apr 2019 20:43:35 +0000 (21:43 +0100)
committerGitHub <noreply@github.com>
Wed, 17 Apr 2019 21:13:23 +0000 (14:13 -0700)
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
Original-commit: flang-compiler/f18@8b32caa287149e72834aad3cdc45473678b57605
Reviewed-on: https://github.com/flang-compiler/f18/pull/367
Tree-same-pre-rewrite: false

flang/lib/semantics/check-stop.cc

index 69b7cb9..575b63a 100644 (file)
 namespace Fortran::semantics {
 
 void StopChecker::Enter(const parser::StopStmt &stmt) {
-  const auto &sc{std::get<std::optional<parser::StopCode>>(stmt.t)};
-  const auto &sle{std::get<std::optional<parser::ScalarLogicalExpr>>(stmt.t)};
+  const auto &stopCode{std::get<std::optional<parser::StopCode>>(stmt.t)};
+  const auto &scalarLogicalExpr{
+      std::get<std::optional<parser::ScalarLogicalExpr>>(stmt.t)};
 
-  if (sc.has_value()) {
-    const parser::CharBlock &source{sc.value().v.thing.source};
-    const auto &expr{*(sc.value().v.thing.typedExpr)};
+  if (stopCode.has_value()) {
+    const parser::CharBlock &source{stopCode.value().v.thing.source};
+    const auto &expr{*(stopCode.value().v.thing.typedExpr)};
 
     if (!(ExprIsScalar(expr))) {
       context_.Say(source, "Stop code must be a scalar"_err_en_US);
@@ -51,9 +52,11 @@ void StopChecker::Enter(const parser::StopStmt &stmt) {
       }
     }
   }
-  if (sle.has_value()) {
-    const parser::CharBlock &source{sle.value().thing.thing.value().source};
-    const auto &expr{*(sle.value().thing.thing.value().typedExpr)};
+  if (scalarLogicalExpr.has_value()) {
+    const parser::CharBlock &source{
+        scalarLogicalExpr.value().thing.thing.value().source};
+    const auto &expr{
+        *(scalarLogicalExpr.value().thing.thing.value().typedExpr)};
 
     if (!(ExprIsScalar(expr))) {
       context_.Say(source,