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

Method passthru

output/java/1.4.13/Interpreter.java:526–556  ·  view source on GitHub ↗
(InstanceScope scope, String templateName, Map<String, Object> attrs)

Source from the content-addressed store, hash-verified

524 }
525
526 void passthru(InstanceScope scope, String templateName, Map<String, Object> attrs) {
527 CompiledST c = group.lookupTemplate(templateName);
528 if ( c==null ) return; // will get error later
529 if ( c.formalArguments==null ) return;
530 for (FormalArgument arg : c.formalArguments.values()) {
531 // if not already set by user, set to value from outer scope
532 if ( !attrs.containsKey(arg.name) ) {
533 //System.out.println("arg "+arg.name+" missing");
534 try {
535 Object o = getAttribute(scope, arg.name);
536 // If the attribute exists but there is no value and
537 // the formal argument has no default value, make it null.
538 if ( o== ST.EMPTY_ATTR && arg.defaultValueToken==null ) {
539 attrs.put(arg.name, null);
540 }
541 // Else, the attribute has an existing value, set arg.
542 else if ( o != ST.EMPTY_ATTR ) {
543 attrs.put(arg.name, o);
544 }
545 }
546 catch (STNoSuchAttributeException nsae) {
547 // if no such attribute exists for arg.name, set parameter
548 // if no default value
549 if ( arg.defaultValueToken==null ) {
550 errMgr.runTimeError(this, scope, ErrorType.NO_SUCH_ATTRIBUTE_PASS_THROUGH, arg.name);
551 attrs.put(arg.name, null);
552 }
553 }
554 }
555 }
556 }
557
558 void storeArgs(InstanceScope scope, Map<String, Object> attrs, ST st) {
559 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