| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.expr; |
| 9 |
|
| 10 |
import com.saxonica.ee.stream.Streamability; |
| 11 |
import net.sf.saxon.event.Receiver; |
| 12 |
import net.sf.saxon.event.ReceiverOptions; |
| 13 |
import net.sf.saxon.expr.flwor.LocalVariableBinding; |
| 14 |
import net.sf.saxon.expr.instruct.GlobalParam; |
| 15 |
import net.sf.saxon.expr.instruct.LocalParam; |
| 16 |
import net.sf.saxon.expr.instruct.LocalParamBlock; |
| 17 |
import net.sf.saxon.expr.parser.*; |
| 18 |
import net.sf.saxon.lib.StandardErrorListener; |
| 19 |
import net.sf.saxon.om.*; |
| 20 |
import net.sf.saxon.pattern.NodeTest; |
| 21 |
import net.sf.saxon.trace.ExpressionPresenter; |
| 22 |
import net.sf.saxon.trans.XPathException; |
| 23 |
import net.sf.saxon.type.*; |
| 24 |
import net.sf.saxon.value.Cardinality; |
| 25 |
import net.sf.saxon.value.IntegerValue; |
| 26 |
import net.sf.saxon.value.SequenceType; |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
public abstract class VariableReference extends Expression implements BindingReference { |
| 34 |
|
| 35 |
protected Binding binding = null; |
| 36 |
|
| 37 |
protected SequenceType staticType = null; |
| 38 |
protected GroundedValue<?> constantValue = null; |
| 39 |
private StructuredQName variableName = null; |
| 40 |
private boolean flattened = false; |
| 41 |
private boolean inLoop = false; |
| 42 |
private boolean filtered = false; |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
public VariableReference(StructuredQName name) { |
| 49 |
variableName = name; |
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
public VariableReference(Binding binding) { |
| 59 |
|
| 60 |
variableName = binding.getVariableQName(); |
| 61 |
fixup(binding); |
| 62 |
} |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
public void setVariableName(StructuredQName name) { |
| 71 |
variableName = name; |
| 72 |
} |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
public StructuredQName getVariableName() { |
| 81 |
return variableName; |
| 82 |
} |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
public abstract Expression copy(RebindingMap rebindings); |
| 93 |
|
| 94 |
|
| 95 |
@Override |
| 96 |
public int getNetCost() { |
| 97 |
return 0; |
| 98 |
} |
| 99 |
|
| 100 |
protected void copyFrom(VariableReference ref) { |
| 101 |
binding = ref.binding; |
| 102 |
staticType = ref.staticType; |
| 103 |
constantValue = ref.constantValue; |
| 104 |
variableName = ref.variableName; |
| 105 |
flattened = ref.flattened; |
| 106 |
inLoop = ref.inLoop; |
| 107 |
filtered = ref.filtered; |
| 108 |
|
| 109 |
Streamability.setPostureAndSweep(this, Streamability.getPostureAndSweepIfKnown(ref)); |
| 110 |
|
| 111 |
ExpressionTool.copyLocationInfo(ref, this); |
| 112 |
} |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
public void setStaticType(SequenceType type, GroundedValue<?> value, int properties) { |
| 125 |
|
| 126 |
if (type == null) { |
| 127 |
type = SequenceType.ANY_SEQUENCE; |
| 128 |
} |
| 129 |
staticType = type; |
| 130 |
constantValue = value; |
| 131 |
|
| 132 |
|
| 133 |
int dependencies = getDependencies(); |
| 134 |
staticProperties = (properties & ~StaticProperty.CONTEXT_DOCUMENT_NODESET |
| 135 |
& ~StaticProperty.ALL_NODES_NEWLY_CREATED) | |
| 136 |
StaticProperty.NO_NODES_NEWLY_CREATED | |
| 137 |
type.getCardinality() | |
| 138 |
dependencies; |
| 139 |
} |
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
public void setFlattened(boolean flattened) { |
| 150 |
this.flattened = flattened; |
| 151 |
} |
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
public boolean isFlattened() { |
| 160 |
return flattened; |
| 161 |
} |
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
public void setFiltered(boolean filtered) { |
| 169 |
this.filtered = filtered; |
| 170 |
} |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
public boolean isFiltered() { |
| 179 |
return filtered; |
| 180 |
} |
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
public boolean isInLoop() { |
| 191 |
return inLoop; |
| 192 |
} |
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
public void setInLoop(boolean inLoop) { |
| 202 |
this.inLoop = inLoop; |
| 203 |
} |
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { |
| 212 |
if (constantValue != null) { |
| 213 |
binding = null; |
| 214 |
return Literal.makeLiteral(constantValue, this); |
| 215 |
} |
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
if (binding != null) { |
| 228 |
recomputeInLoop(); |
| 229 |
binding.addReference(this, inLoop); |
| 230 |
} |
| 231 |
|
| 232 |
return this; |
| 233 |
} |
| 234 |
|
| 235 |
public void recomputeInLoop() { |
| 236 |
inLoop = ExpressionTool.isLoopingReference(this, binding); |
| 237 |
} |
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException { |
| 246 |
if (binding instanceof LetExpression && |
| 247 |
((LetExpression)binding).getSequence() instanceof Literal && |
| 248 |
!((LetExpression) binding).isIndexedVariable) { |
| 249 |
Expression val = ((LetExpression) binding).getSequence(); |
| 250 |
Optimizer.trace(visitor.getConfiguration(), "Replaced variable " + getDisplayName() + " by its value", val); |
| 251 |
binding = null; |
| 252 |
return val.copy(new RebindingMap()); |
| 253 |
} |
| 254 |
if (constantValue != null) { |
| 255 |
binding = null; |
| 256 |
Expression result = Literal.makeLiteral(constantValue, this); |
| 257 |
ExpressionTool.copyLocationInfo(this, result); |
| 258 |
Optimizer.trace(visitor.getConfiguration(), "Replaced variable " + getDisplayName() + " by its value", result); |
| 259 |
return result; |
| 260 |
} |
| 261 |
if (binding instanceof GlobalParam && ((GlobalParam)binding).isStatic()) { |
| 262 |
Expression select = ((GlobalParam)binding).getSelectExpression(); |
| 263 |
if (select instanceof Literal) { |
| 264 |
binding = null; |
| 265 |
Optimizer.trace(visitor.getConfiguration(), "Replaced static parameter " + getDisplayName() + " by its value", select); |
| 266 |
return select; |
| 267 |
} |
| 268 |
} |
| 269 |
return this; |
| 270 |
} |
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
public void fixup(Binding newBinding) { |
| 279 |
boolean indexed = binding instanceof LocalBinding && ((LocalBinding)binding).isIndexedVariable(); |
| 280 |
this.binding = newBinding; |
| 281 |
if (indexed && newBinding instanceof LocalBinding) { |
| 282 |
((LocalBinding)newBinding).setIndexedVariable(); |
| 283 |
} |
| 284 |
resetLocalStaticProperties(); |
| 285 |
} |
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
public void refineVariableType(ItemType type, int cardinality, GroundedValue<?> constantValue, int properties) { |
| 298 |
TypeHierarchy th = getConfiguration().getTypeHierarchy(); |
| 299 |
ItemType oldItemType = getItemType(); |
| 300 |
ItemType newItemType = oldItemType; |
| 301 |
if (th.isSubType(type, oldItemType)) { |
| 302 |
newItemType = type; |
| 303 |
} |
| 304 |
if (oldItemType instanceof NodeTest && type instanceof AtomicType) { |
| 305 |
|
| 306 |
newItemType = type; |
| 307 |
} |
| 308 |
int newcard = cardinality & getCardinality(); |
| 309 |
if (newcard == 0) { |
| 310 |
|
| 311 |
newcard = getCardinality(); |
| 312 |
} |
| 313 |
SequenceType seqType = SequenceType.makeSequenceType(newItemType, newcard); |
| 314 |
setStaticType(seqType, constantValue, properties); |
| 315 |
} |
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
public ItemType getItemType() { |
| 326 |
if (staticType == null || staticType.getPrimaryType() == AnyItemType.getInstance()) { |
| 327 |
if (binding != null) { |
| 328 |
SequenceType st = binding.getRequiredType(); |
| 329 |
if (st != null) { |
| 330 |
return st.getPrimaryType(); |
| 331 |
} |
| 332 |
} |
| 333 |
return AnyItemType.getInstance(); |
| 334 |
} else { |
| 335 |
return staticType.getPrimaryType(); |
| 336 |
} |
| 337 |
} |
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
@Override |
| 347 |
public UType getStaticUType(UType contextItemType) { |
| 348 |
if (binding != null) { |
| 349 |
if (binding.isGlobal() || |
| 350 |
binding instanceof LocalParam || |
| 351 |
(binding instanceof LetExpression && ((LetExpression)binding).isInstruction()) || |
| 352 |
binding instanceof LocalVariableBinding) { |
| 353 |
SequenceType st = binding.getRequiredType(); |
| 354 |
if (st != null) { |
| 355 |
return st.getPrimaryType().getUType(); |
| 356 |
} else { |
| 357 |
return UType.ANY; |
| 358 |
} |
| 359 |
} else if (binding instanceof Assignation) { |
| 360 |
return ((Assignation) binding).getSequence().getStaticUType(contextItemType); |
| 361 |
} |
| 362 |
} |
| 363 |
return UType.ANY; |
| 364 |
} |
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
@Override |
| 380 |
public IntegerValue[] getIntegerBounds() { |
| 381 |
if (binding != null) { |
| 382 |
return binding.getIntegerBoundsForVariable(); |
| 383 |
} else { |
| 384 |
return null; |
| 385 |
} |
| 386 |
} |
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
public int computeCardinality() { |
| 393 |
if (staticType == null) { |
| 394 |
if (binding == null) { |
| 395 |
return StaticProperty.ALLOWS_ZERO_OR_MORE; |
| 396 |
} else if (binding instanceof LetExpression) { |
| 397 |
return binding.getRequiredType().getCardinality(); |
| 398 |
} else if (binding instanceof Assignation) { |
| 399 |
return StaticProperty.EXACTLY_ONE; |
| 400 |
} else if (binding.getRequiredType() == null) { |
| 401 |
return StaticProperty.ALLOWS_ZERO_OR_MORE; |
| 402 |
} else { |
| 403 |
return binding.getRequiredType().getCardinality(); |
| 404 |
} |
| 405 |
} else { |
| 406 |
return staticType.getCardinality(); |
| 407 |
} |
| 408 |
} |
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
public int computeSpecialProperties() { |
| 417 |
int p = super.computeSpecialProperties(); |
| 418 |
if (binding == null || !binding.isAssignable()) { |
| 419 |
|
| 420 |
|
| 421 |
|
| 422 |
p |= StaticProperty.NO_NODES_NEWLY_CREATED; |
| 423 |
} |
| 424 |
if (binding instanceof Assignation) { |
| 425 |
Expression exp = ((Assignation) binding).getSequence(); |
| 426 |
if (exp != null) { |
| 427 |
p |= exp.getSpecialProperties() & StaticProperty.NOT_UNTYPED_ATOMIC; |
| 428 |
} |
| 429 |
} |
| 430 |
if (staticType != null && |
| 431 |
!Cardinality.allowsMany(staticType.getCardinality()) && |
| 432 |
staticType.getPrimaryType() instanceof NodeTest) { |
| 433 |
p |= StaticProperty.SINGLE_DOCUMENT_NODESET; |
| 434 |
} |
| 435 |
return p &~ StaticProperty.ALL_NODES_NEWLY_CREATED; |
| 436 |
} |
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
public boolean equals(Object other) { |
| 445 |
return other instanceof VariableReference && |
| 446 |
binding == ((VariableReference) other).binding && |
| 447 |
binding != null; |
| 448 |
} |
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
|
| 453 |
|
| 454 |
public int computeHashCode() { |
| 455 |
return binding == null ? 73619830 : binding.hashCode(); |
| 456 |
} |
| 457 |
|
| 458 |
|
| 459 |
public int getIntrinsicDependencies() { |
| 460 |
int d = 0; |
| 461 |
if (binding == null) { |
| 462 |
|
| 463 |
d |= StaticProperty.DEPENDS_ON_LOCAL_VARIABLES | |
| 464 |
StaticProperty.DEPENDS_ON_ASSIGNABLE_GLOBALS | |
| 465 |
StaticProperty.DEPENDS_ON_RUNTIME_ENVIRONMENT; |
| 466 |
} else if (binding.isGlobal()) { |
| 467 |
if (binding.isAssignable()) { |
| 468 |
d |= StaticProperty.DEPENDS_ON_ASSIGNABLE_GLOBALS; |
| 469 |
} |
| 470 |
if (binding instanceof GlobalParam) { |
| 471 |
d |= StaticProperty.DEPENDS_ON_RUNTIME_ENVIRONMENT; |
| 472 |
} |
| 473 |
} else { |
| 474 |
d |= StaticProperty.DEPENDS_ON_LOCAL_VARIABLES; |
| 475 |
} |
| 476 |
return d; |
| 477 |
} |
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
public int getImplementationMethod() { |
| 486 |
return (Cardinality.allowsMany(getCardinality()) ? 0 : EVALUATE_METHOD) |
| 487 |
| ITERATE_METHOD | PROCESS_METHOD; |
| 488 |
} |
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
|
| 501 |
@Override |
| 502 |
public Expression getScopingExpression() { |
| 503 |
if (binding instanceof Expression) { |
| 504 |
if (binding instanceof LocalParam && ((LocalParam)binding).getParentExpression() instanceof LocalParamBlock) { |
| 505 |
LocalParamBlock block = (LocalParamBlock)((LocalParam) binding).getParentExpression(); |
| 506 |
return block.getParentExpression(); |
| 507 |
} else { |
| 508 |
return (Expression) binding; |
| 509 |
} |
| 510 |
} |
| 511 |
Expression parent = getParentExpression(); |
| 512 |
while (parent != null) { |
| 513 |
if (parent.hasVariableBinding(binding)) { |
| 514 |
return parent; |
| 515 |
} |
| 516 |
parent = parent.getParentExpression(); |
| 517 |
} |
| 518 |
return null; |
| 519 |
} |
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
public PathMap.PathMapNodeSet addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet) { |
| 542 |
return pathMap.getPathForVariable(getBinding()); |
| 543 |
} |
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
public SequenceIterator<?> iterate(XPathContext c) throws XPathException { |
| 555 |
try { |
| 556 |
Sequence<?> actual = evaluateVariable(c); |
| 557 |
assert actual != null; |
| 558 |
return actual.iterate(); |
| 559 |
} catch (XPathException err) { |
| 560 |
err.maybeSetLocation(getLocation()); |
| 561 |
throw err; |
| 562 |
} catch (NullPointerException err) { |
| 563 |
err.printStackTrace(); |
| 564 |
String msg = "Internal error: no value for variable $" + getDisplayName() + |
| 565 |
" at line " + getLocation().getLineNumber() + (getLocation().getSystemId() == null ? "" : " of " + getLocation().getSystemId()); |
| 566 |
StandardErrorListener.printStackTrace(c, c.getConfiguration().getLogger(), 2); |
| 567 |
throw new AssertionError(msg); |
| 568 |
} catch (AssertionError err) { |
| 569 |
err.printStackTrace(); |
| 570 |
String msg = err.getMessage() + ". Variable reference $" + getDisplayName() + |
| 571 |
" at line " + getLocation().getLineNumber() + (getLocation().getSystemId() == null ? "" : " of " + getLocation().getSystemId()); |
| 572 |
StandardErrorListener.printStackTrace(c, c.getConfiguration().getLogger(), 2); |
| 573 |
throw new AssertionError(msg); |
| 574 |
} |
| 575 |
} |
| 576 |
|
| 577 |
public Item evaluateItem(XPathContext c) throws XPathException { |
| 578 |
try { |
| 579 |
Sequence<?> actual = evaluateVariable(c); |
| 580 |
assert actual != null; |
| 581 |
return actual.head(); |
| 582 |
} catch (XPathException err) { |
| 583 |
err.maybeSetLocation(getLocation()); |
| 584 |
throw err; |
| 585 |
} |
| 586 |
} |
| 587 |
|
| 588 |
public void process(XPathContext c) throws XPathException { |
| 589 |
try { |
| 590 |
SequenceIterator<?> iter = evaluateVariable(c).iterate(); |
| 591 |
Receiver out = c.getReceiver(); |
| 592 |
Location loc = getLocation(); |
| 593 |
iter.forEachOrFail(item -> out.append(item, loc, ReceiverOptions.ALL_NAMESPACES)); |
| 594 |
} catch (XPathException err) { |
| 595 |
err.maybeSetLocation(getLocation()); |
| 596 |
throw err; |
| 597 |
} |
| 598 |
} |
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
public Sequence<?> evaluateVariable(XPathContext c) throws XPathException { |
| 610 |
try { |
| 611 |
return binding.evaluateVariable(c); |
| 612 |
} catch (NullPointerException err) { |
| 613 |
if (binding == null) { |
| 614 |
throw new IllegalStateException("Variable $" + variableName.getDisplayName() + " has not been fixed up"); |
| 615 |
} else { |
| 616 |
throw err; |
| 617 |
} |
| 618 |
} |
| 619 |
} |
| 620 |
|
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
|
| 627 |
public Binding getBinding() { |
| 628 |
return binding; |
| 629 |
} |
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
|
| 637 |
public String getDisplayName() { |
| 638 |
if (binding != null) { |
| 639 |
return binding.getVariableQName().getDisplayName(); |
| 640 |
} else { |
| 641 |
return variableName.getDisplayName(); |
| 642 |
} |
| 643 |
} |
| 644 |
|
| 645 |
|
| 646 |
|
| 647 |
|
| 648 |
|
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
|
| 653 |
public String getEQName() { |
| 654 |
if (binding != null) { |
| 655 |
StructuredQName q = binding.getVariableQName(); |
| 656 |
if (q.hasURI("")) { |
| 657 |
return q.getLocalPart(); |
| 658 |
} else { |
| 659 |
return q.getEQName(); |
| 660 |
} |
| 661 |
} else { |
| 662 |
return variableName.getEQName(); |
| 663 |
} |
| 664 |
} |
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
|
| 671 |
|
| 672 |
public String toString() { |
| 673 |
String d = getEQName(); |
| 674 |
return "$" + (d == null ? "$" : d); |
| 675 |
} |
| 676 |
|
| 677 |
|
| 678 |
|
| 679 |
|
| 680 |
|
| 681 |
|
| 682 |
|
| 683 |
@Override |
| 684 |
public String toShortString() { |
| 685 |
return "$" + getDisplayName(); |
| 686 |
} |
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
@Override |
| 696 |
public String getExpressionName() { |
| 697 |
return "varRef"; |
| 698 |
} |
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
public void export(ExpressionPresenter destination) throws XPathException { |
| 706 |
destination.startElement("varRef", this); |
| 707 |
destination.emitAttribute("name", variableName); |
| 708 |
if (binding instanceof LocalBinding) { |
| 709 |
destination.emitAttribute("slot", "" + ((LocalBinding) binding).getLocalSlotNumber()); |
| 710 |
} |
| 711 |
|
| 712 |
destination.endElement(); |
| 713 |
} |
| 714 |
|
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
|
| 721 |
@Override |
| 722 |
public String getStreamerName() { |
| 723 |
return "VariableReference"; |
| 724 |
} |
| 725 |
} |
| 726 |
|