[flang] last minute changes for recent PR that were not pushed, sorry
authorpeter klausler <pklausler@nvidia.com>
Tue, 4 Dec 2018 18:21:38 +0000 (10:21 -0800)
committerpeter klausler <pklausler@nvidia.com>
Tue, 4 Dec 2018 18:21:38 +0000 (10:21 -0800)
Original-commit: flang-compiler/f18@9f9258e0067bfe9406f61f5f67d37b54f004e266
Reviewed-on: https://github.com/flang-compiler/f18/pull/235

flang/lib/semantics/expression.cc
flang/lib/semantics/expression.h

index d8ab52f..03219f8 100644 (file)
@@ -42,14 +42,12 @@ using common::TypeCategory;
 
 // Constraint checking
 void ExpressionAnalysisContext::CheckConstraints(MaybeExpr &expr) {
-  if (expr.has_value()) {
-    if (inner_ != nullptr) {
-      inner_->CheckConstraints(expr);
-    }
-    if (constraint_ != nullptr) {
-      if (!(this->*constraint_)(*expr)) {
-        expr.reset();
-      }
+  if (inner_ != nullptr) {
+    inner_->CheckConstraints(expr);
+  }
+  if (constraint_ != nullptr && expr.has_value()) {
+    if (!(this->*constraint_)(*expr)) {
+      expr.reset();
     }
   }
 }
index 13133a8..bfcf044 100644 (file)
@@ -16,6 +16,7 @@
 #define FORTRAN_SEMANTICS_EXPRESSION_H_
 
 #include "semantics.h"
+#include "../common/indirection.h"
 #include "../evaluate/expression.h"
 #include "../evaluate/type.h"
 #include <optional>