MCPcopy Index your code
hub / github.com/antlr/codebuff / passthru

Method passthru

output/java8/1.4.12/Interpreter.java:488–518  ·  view source on GitHub ↗
(InstanceScope scope, String templateName, Map<String, Object> attrs)

Source from the content-addressed store, hash-verified

486 }
487
488 void passthru(InstanceScope scope, String templateName, Map<String, Object> attrs) {
489 CompiledST c = group.lookupTemplate(templateName);
490 if ( c==null ) return; // will get error later
491 if ( c.formalArguments==null ) return;
492 for (FormalArgument arg : c.formalArguments.values()) {
493 // if not already set by user, set to value from outer scope
494 if ( !attrs.containsKey(arg.name) ) {
495 //System.out.println("arg "+arg.name+" missing");
496 try {
497 Object o = getAttribute(scope, arg.name);
498 // If the attribute exists but there is no value and
499 // the formal argument has no default value, make it null.
500 if ( o==ST.EMPTY_ATTR && arg.defaultValueToken==null ) {
501 attrs.put(arg.name, null);
502 }
503 // Else, the attribute has an existing value, set arg.
504 else if ( o!= ST.EMPTY_ATTR ) {
505 attrs.put(arg.name, o);
506 }
507 }
508 catch (STNoSuchAttributeException nsae) {
509 // if no such attribute exists for arg.name, set parameter
510 // if no default value
511 if ( arg.defaultValueToken==null ) {
512 errMgr.runTimeError(this, scope, ErrorType.NO_SUCH_ATTRIBUTE_PASS_THROUGH, arg.name);
513 attrs.put(arg.name, null);
514 }
515 }
516 }
517 }
518 }
519
520 void storeArgs(InstanceScope scope, Map<String, Object> attrs, ST st) {
521 boolean noSuchAttributeReported = false;

Callers 1

_execMethod · 0.95

Calls 6

getAttributeMethod · 0.95
valuesMethod · 0.65
containsKeyMethod · 0.65
putMethod · 0.65
runTimeErrorMethod · 0.65
lookupTemplateMethod · 0.45

Tested by

no test coverage detected