MCPcopy Create free account
hub / github.com/antlr/codebuff / writeObjectWithOptions

Method writeObjectWithOptions

output/java/1.4.14/Interpreter.java:680–703  ·  view source on GitHub ↗

Write out an expression result that uses expression options. E.g.,

(STWriter out, InstanceScope scope, Object o, Object[] options)

Source from the content-addressed store, hash-verified

678 */
679
680 protected int writeObjectWithOptions(STWriter out, InstanceScope scope, Object o, Object[] options) {
681 int start = out.index(); // track char we're about to write
682 // precompute all option values (render all the way to strings)
683 String[] optionStrings = null;
684 if ( options !=null ) {
685 optionStrings = new String[options.length];
686 for (int i = 0; i <Compiler.NUM_OPTIONS; i++) {
687 optionStrings[i] = toString(out, scope, options[i]);
688 }
689 }
690 if ( options !=null && options[Option.ANCHOR.ordinal()]!=null ) {
691 out.pushAnchorPoint();
692 }
693
694 int n = writeObject(out, scope, o, optionStrings);
695 if ( options !=null && options[Option.ANCHOR.ordinal()]!=null ) {
696 out.popAnchorPoint();
697 }
698 if ( debug ) {
699 EvalExprEvent e = new EvalExprEvent(scope, start, out.index()-1, getExprStartChar(scope), getExprStopChar(scope));
700 trackDebugEvent(scope, e);
701 }
702 return n;
703 }
704
705 /** Generic method to emit text for an object. It differentiates
706 * between templates, iterable objects, and plain old Java objects (POJOs)

Callers 1

_execMethod · 0.95

Calls 9

toStringMethod · 0.95
writeObjectMethod · 0.95
getExprStartCharMethod · 0.95
getExprStopCharMethod · 0.95
trackDebugEventMethod · 0.95
indexMethod · 0.65
ordinalMethod · 0.65
pushAnchorPointMethod · 0.65
popAnchorPointMethod · 0.65

Tested by

no test coverage detected