diff --git a/src/jastadd/ast/Trace.jrag b/src/jastadd/ast/Trace.jrag index e1926228594351ee3ecad61ae2a358eb9abeb38e..b22c6cc053d6bfd7b21cb2851695b2a64617c546 100644 --- a/src/jastadd/ast/Trace.jrag +++ b/src/jastadd/ast/Trace.jrag @@ -99,6 +99,8 @@ aspect Trace { syn String AttrDecl.traceBeginAttr() = trace("begin " + traceSignature()); syn String AttrDecl.traceEndAttr() = trace("end " + traceSignature()); syn String AttrDecl.traceEndCachedAttr() = trace("end cached " + traceSignature()); + + syn String CollEq.escapeConditionForTemplate() = getCondition().replace("\n", " ").replace("\"", "\\\""); } aspect NewTrace { diff --git a/src/template/ast/Collections.tt b/src/template/ast/Collections.tt index dda5d29c0cb19d245d93f8c8c7b5064edd4fcfcb..0e043c525c0a33fd6cf1f069cb8f34c9d7c4932a 100644 --- a/src/template/ast/Collections.tt +++ b/src/template/ast/Collections.tt @@ -234,7 +234,7 @@ $endif ]] CollEq.contributeStatement [[ -$include(CollEq.traceContributionBegin) + $include(CollEq.traceContributionCheckBegin) $if(#hasCondition) if (#getCondition) { $include(CollEq.addValueToCollection) @@ -242,16 +242,18 @@ $if(#hasCondition) $else $include(CollEq.addValueToCollection) $endif -$include(CollEq.traceContributionEnd) + $include(CollEq.traceContributionCheckEnd) ]] CollEq.addValueToCollection [[ $if(#iterableValue) for (#elementType value : #getValue) { collection.$CombOp(value); + $include(CollEq.traceContributionCheckMatch) } $else collection.$CombOp(#getValue); +$include(CollEq.traceContributionCheckMatch) $endif ]] diff --git a/src/template/trace/TraceHooks.tt b/src/template/trace/TraceHooks.tt index e99d06e2dcb7847ca91ae034e7eecca5c359891c..e23ae7abc93e416ccfbeea99dc783da2b7464923 100644 --- a/src/template/trace/TraceHooks.tt +++ b/src/template/trace/TraceHooks.tt @@ -323,14 +323,24 @@ state().trace().flushAttr(this, "#hostClassName.#signatureJavaStyle", "", #(sign $endif ]] -CollEq.traceContributionBegin [[ +CollEq.traceContributionCheckBegin [[ $if (TraceColl) -state().trace().contributionBegin(this, "#collectionId"); +state().trace().contributionCheckBegin(this, "#collectionId", "#escapeConditionForTemplate"); $endif ]] -CollEq.traceContributionEnd [[ +CollEq.traceContributionCheckEnd [[ $if (TraceColl) -state().trace().contributionEnd(this, "#collectionId"); +state().trace().contributionCheckEnd(this, "#collectionId", "#escapeConditionForTemplate"); +$endif +]] + +CollEq.traceContributionCheckMatch [[ +$if (TraceColl) +$if(#iterableValue) +state().trace().contributionCheckMatch(this, "#collectionId", "#escapeConditionForTemplate", value); +$else +state().trace().contributionCheckMatch(this, "#collectionId", "#escapeConditionForTemplate", #getValue); +$endif $endif ]] diff --git a/src/template/trace/Tracer.tt b/src/template/trace/Tracer.tt index ee3b37d304ab987e5ad521b23d42339467b51003..8c352470b634648230d7ab929c86d001bd53452b 100644 --- a/src/template/trace/Tracer.tt +++ b/src/template/trace/Tracer.tt @@ -82,8 +82,9 @@ public static class Trace { INC_FLUSH_ATTR, // Flag: --tracing=coll - CONTRIBUTION_BEGIN, - CONTRIBUTION_END; + CONTRIBUTION_CHECK_BEGIN, + CONTRIBUTION_CHECK_MATCH, + CONTRIBUTION_CHECK_END; } /** @@ -338,18 +339,26 @@ public static class Trace { } /** - * Trace that a contribution to a collection attribute begun. + * Trace that a contribution check to a collection attribute begun. */ - public void contributionBegin($ASTNode node, String attr) { - receiver.accept($StateClass.Trace.Event.CONTRIBUTION_BEGIN, node, attr, "", ""); + public void contributionCheckBegin($ASTNode node, String attr, String check) { + receiver.accept($StateClass.Trace.Event.CONTRIBUTION_CHECK_BEGIN, node, attr, check, ""); } /** - * Trace that a contribution to a collection attribute ended. + * Trace that a contribution check to a collection attribute ended. */ - public void contributionEnd($ASTNode node, String attr) { - receiver.accept($StateClass.Trace.Event.CONTRIBUTION_END, node, attr, "", ""); + public void contributionCheckEnd($ASTNode node, String attr, String check) { + receiver.accept($StateClass.Trace.Event.CONTRIBUTION_CHECK_END, node, attr, check, ""); } + + /** + * Trace that a contribution check to a collection attribute found a match. + */ + public void contributionCheckMatch($ASTNode node, String attr, String check, Object value) { + receiver.accept($StateClass.Trace.Event.CONTRIBUTION_CHECK_MATCH, node, attr, check, value); + } + } $endif ]]