浏览代码

HPCC-12341 Improve syntax checking for FORWARD modules (and fix core)

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 10 年之前
父节点
当前提交
7abd2f76a5
共有 2 个文件被更改,包括 14 次插入0 次删除
  1. 9 0
      ecl/eclcc/eclcc.cpp
  2. 5 0
      ecl/hql/hqlutil.cpp

+ 9 - 0
ecl/eclcc/eclcc.cpp

@@ -1117,6 +1117,15 @@ void EclCC::processSingleQuery(EclCompileInstance & instance,
                 }
             }
 
+            if (syntaxChecking && instance.query && instance.query->getOperator() == no_forwardscope)
+            {
+                IHqlScope * scope = instance.query->queryScope();
+                //Have the side effect of resolving the symbols and triggering any syntax errors
+                IHqlScope * resolved = scope->queryResolvedScope(&ctx);
+                if (resolved)
+                    instance.query.set(resolved->queryExpression());
+            }
+
             gatherParseWarnings(ctx.errs, instance.query, parseCtx.orphanedWarnings);
 
             if (instance.query && !syntaxChecking && !optGenerateMeta && !optEvaluateResult)

+ 5 - 0
ecl/hql/hqlutil.cpp

@@ -6670,6 +6670,11 @@ public:
     virtual void doAnalyse(IHqlExpression * expr)
     {
         IHqlExpression * body = expr->queryBody();
+        //Ugly...  If the syntax check is called on something containing a forward module then this code
+        //might be called with a placeholder symbol (which has a NULL body).
+        if (!body)
+            return;
+
         if (isGlobalOnWarning(body))
             mapper.addOnWarning(body);
         QuickHqlTransformer::doAnalyse(body);