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

Method passthru

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

Source from the content-addressed store, hash-verified

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