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

Method passthru

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

Source from the content-addressed store, hash-verified

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