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

Method passthru

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

Source from the content-addressed store, hash-verified

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