Debian Codegraph @

net/sf/saxon/trace/XSLTTraceCodeInjector.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.trace;
9
10 import net.sf.saxon.expr.Expression;
11 import net.sf.saxon.expr.StaticContext;
12 import net.sf.saxon.om.StructuredQName;
13
14 /**
15 * A code injector that wraps every expression (other than a literal) in a TraceExpression, which causes
16 * a TraceListener to be notified when the expression is evaluated
17 */
18 public class XSLTTraceCodeInjector extends TraceCodeInjector {
19
20 /**
21 * If tracing, wrap an expression in a trace instruction
22 *
23 * @param exp the expression to be wrapped
24 * @param env the static context
25 * @param construct integer constant identifying the kind of construct
26 * @param qName the name of the construct (if applicable)
27 * @return the expression that does the tracing
28 */
29
30 public Expression inject(Expression exp, /*@NotNull*/ StaticContext env, int construct, StructuredQName qName) {
31 if (XSLTTraceListener.tagName(construct) != null) {
32 return super.inject(exp, env, construct, qName);
33 } else {
34 return exp;
35 }
36 }
37 }
38