|
@@ -19,6 +19,8 @@
|
|
|
#include "jiface.hpp"
|
|
|
#include "hqlir.hpp"
|
|
|
|
|
|
+//#define ADD_ACTIVE_SCOPE_AS_COMMENT
|
|
|
+
|
|
|
namespace EclIR
|
|
|
{
|
|
|
|
|
@@ -821,6 +823,7 @@ public:
|
|
|
_ATOM name;
|
|
|
unsigned __int64 sequence;
|
|
|
IdArray args;
|
|
|
+ IdArray comment;
|
|
|
};
|
|
|
|
|
|
class ExprAnnotationBuilderInfo
|
|
@@ -1442,6 +1445,17 @@ protected:
|
|
|
line.append(" : ");
|
|
|
appendId(info.type);
|
|
|
}
|
|
|
+ if (info.comment.ordinality())
|
|
|
+ {
|
|
|
+ line.append(" // ");
|
|
|
+ ForEachItemIn(i, info.comment)
|
|
|
+ {
|
|
|
+ if (i)
|
|
|
+ line.append(",");
|
|
|
+ appendId(info.comment.item(i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
void appendConstantText(const ConstantBuilderInfo & info)
|
|
@@ -1884,6 +1898,7 @@ id_t ExpressionIRPlayer::processExpr(IHqlExpression * expr)
|
|
|
IInterface * match = expr->queryTransformExtra();
|
|
|
if (match)
|
|
|
{
|
|
|
+ //Check for recursion
|
|
|
if (match == expr)
|
|
|
throwUnexpected();
|
|
|
return static_cast<ExpressionId *>(match)->id;
|
|
@@ -1926,6 +1941,18 @@ id_t ExpressionIRPlayer::doProcessExpr(IHqlExpression * expr)
|
|
|
ForEachChild(i, expr)
|
|
|
info.args.append(processExpr(expr->queryChild(i)));
|
|
|
|
|
|
+#ifdef ADD_ACTIVE_SCOPE_AS_COMMENT
|
|
|
+ HqlExprCopyArray inScope;
|
|
|
+ expr->gatherTablesUsed(NULL, &inScope);
|
|
|
+ ForEachItemIn(i, inScope)
|
|
|
+ {
|
|
|
+ IHqlExpression * cur = &inScope.item(i);
|
|
|
+ if (cur == expr) // add 0 to list if is own active selector
|
|
|
+ cur = NULL;
|
|
|
+ info.comment.append(processExpr(cur));
|
|
|
+ }
|
|
|
+#endif
|
|
|
+
|
|
|
if (getRequiredTypeCode(op) == type_none)
|
|
|
info.type = processType(expr->queryType());
|
|
|
info.sequence = expr->querySequenceExtra();
|
|
@@ -2086,6 +2113,20 @@ extern HQL_API void dump_ir(IHqlExpression * expr1, IHqlExpression * expr2)
|
|
|
reader.play(expr2);
|
|
|
}
|
|
|
|
|
|
+extern HQL_API void dump_irn(unsigned n, ...)
|
|
|
+{
|
|
|
+ FileIRBuilder output(defaultDumpOptions, stdout);
|
|
|
+ ExpressionIRPlayer reader(&output);
|
|
|
+ va_list args;
|
|
|
+ va_start(args, n);
|
|
|
+ for (unsigned i=0; i < n;i++)
|
|
|
+ {
|
|
|
+ IHqlExpression * expr = va_arg(args, IHqlExpression *);
|
|
|
+ reader.play(expr);
|
|
|
+ }
|
|
|
+ va_end(args);
|
|
|
+}
|
|
|
+
|
|
|
//-- Dump the IR for the expression(s)/type to DBGLOG ----------------------------------------------------------------
|
|
|
|
|
|
extern HQL_API void dbglogIR(IHqlExpression * expr)
|