Browse Source

HPCC-15714 Fix row incorrectly tagged as a member variable

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 9 years ago
parent
commit
1218382759
4 changed files with 15 additions and 3 deletions
  1. 1 1
      ecl/hqlcpp/hqlcpp.cpp
  2. 2 2
      ecl/hqlcpp/hqlhtcpp.cpp
  3. 11 0
      ecl/hqlcpp/hqlstmt.cpp
  4. 1 0
      ecl/hqlcpp/hqlstmt.hpp

+ 1 - 1
ecl/hqlcpp/hqlcpp.cpp

@@ -4406,7 +4406,7 @@ void HqlCppTranslator::buildTempExpr(BuildCtx & ctx, BuildCtx & declareCtx, CHql
         }
     }
 
-    typemod_t modifier = (&ctx != &declareCtx) ? typemod_member : typemod_none;
+    typemod_t modifier = !ctx.isSameLocation(declareCtx) ? typemod_member : typemod_none;
     OwnedITypeInfo type = makeModifier(expr->getType(), modifier);
     BuildCtx subctx(ctx);
     switch (type->getTypeCode())

+ 2 - 2
ecl/hqlcpp/hqlhtcpp.cpp

@@ -1529,7 +1529,7 @@ BoundRow * HqlCppTranslator::declareStaticRow(BuildCtx & ctx, IHqlExpression * e
     if (maxRecordSize > options.maxLocalRowSize)
         getInvariantMemberContext(ctx, &declarectx, NULL, false, false);
 
-    if (declarectx != &ctx)
+    if (!declarectx->isSameLocation(ctx))
         rowType.setown(makeModifier(rowType.getClear(), typemod_member, NULL));
     else
         declarectx->setNextPriority(BuildCtx::OutermostScopePrio);
@@ -1552,7 +1552,7 @@ BoundRow * HqlCppTranslator::declareTempRow(BuildCtx & ctx, BuildCtx & codectx,
     bool createRowDynamically = tempRowRequiresFinalize(record) || (maxRecordSize > options.maxLocalRowSize);
     if (createRowDynamically)
     {
-        return declareLinkedRow(ctx, expr, &ctx != &codectx);
+        return declareLinkedRow(ctx, expr, !ctx.isSameLocation(codectx));
     }
     else
     {

+ 11 - 0
ecl/hqlcpp/hqlstmt.cpp

@@ -669,6 +669,17 @@ bool BuildCtx::hasAssociation(HqlExprAssociation & search, bool unconditional)
 }
 
 
+bool BuildCtx::isSameLocation(const BuildCtx & other) const
+{
+    if (this == &other)
+        return true;
+    if (curStmts != other.curStmts)
+        return false;
+    if (nextPriority != other.nextPriority)
+        return false;
+    return true;
+}
+
 bool BuildCtx::isOuterContext() const
 {
     HqlStmts * searchStmts = curStmts;

+ 1 - 0
ecl/hqlcpp/hqlstmt.hpp

@@ -134,6 +134,7 @@ public:
     HqlExprAssociation *        associateExpr(IHqlExpression * represents, IHqlExpression * expr);
     HqlExprAssociation *        associateExpr(IHqlExpression * represents, const CHqlBoundExpr & bound);
     bool                        hasAssociation(HqlExprAssociation & search, bool unconditional);
+    bool                        isSameLocation(const BuildCtx & other) const;
     HqlExprAssociation *        queryAssociation(IHqlExpression * dataset, AssocKind kind, HqlExprCopyArray * selectors);
     HqlExprAssociation *        queryFirstAssociation(AssocKind kind);
     HqlExprAssociation *        queryFirstCommonAssociation(AssocKind kind);