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