(InstanceScope scope, String templateName, Map<String, Object> attrs)
| 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; |
no test coverage detected