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

Method passthru

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

Source from the content-addressed store, hash-verified

496 }
497
498 void passthru(InstanceScope scope, String templateName, Map<String, Object> attrs) {
499 CompiledST c = group.lookupTemplate(templateName);
500 if ( c==null ) return; // will get error later
501 if ( c.formalArguments==null ) return;
502 for (FormalArgument arg : c.formalArguments.values()) {
503 // if not already set by user, set to value from outer scope
504 if ( !attrs.containsKey(arg.name) ) {
505 //System.out.println("arg "+arg.name+" missing");
506 try {
507 Object o = getAttribute(scope, arg.name);
508 // If the attribute exists but there is no value and
509 // the formal argument has no default value, make it null.
510 if ( o==ST.EMPTY_ATTR && arg.defaultValueToken==null ) {
511 attrs.put(arg.name, null);
512 }
513 // Else, the attribute has an existing value, set arg.
514 else if ( o!= ST.EMPTY_ATTR ) {
515 attrs.put(arg.name, o);
516 }
517 }
518 catch (STNoSuchAttributeException nsae) {
519 // if no such attribute exists for arg.name, set parameter
520 // if no default value
521 if ( arg.defaultValueToken==null ) {
522 errMgr.runTimeError(this,
523 scope,
524 ErrorType.NO_SUCH_ATTRIBUTE_PASS_THROUGH,
525 arg.name);
526 attrs.put(arg.name, null);
527 }
528 }
529 }
530 }
531 }
532
533 void storeArgs(InstanceScope scope, Map<String, Object> attrs, ST st) {
534 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