(InstanceScope scope, String templateName, Map<String, Object> attrs)
| 496 | } |
| 497 | |
| 498 | void passthru(InstanceScope scope, String templateName, Map<String, Object> attrs) { |
| 499 | CompiledST c = group.lookupTemplate(templateName); |
| 500 | if ( c==null ) return; // will get error later |
| 501 | if ( c.formalArguments==null ) return; |
| 502 | for (FormalArgument arg : c.formalArguments.values()) { |
| 503 | // if not already set by user, set to value from outer scope |
| 504 | if ( !attrs.containsKey(arg.name) ) { |
| 505 | //System.out.println("arg "+arg.name+" missing"); |
| 506 | try { |
| 507 | Object o = getAttribute(scope, arg.name); |
| 508 | // If the attribute exists but there is no value and |
| 509 | // the formal argument has no default value, make it null. |
| 510 | if ( o==ST.EMPTY_ATTR && arg.defaultValueToken==null ) { |
| 511 | attrs.put(arg.name, null); |
| 512 | } |
| 513 | // Else, the attribute has an existing value, set arg. |
| 514 | else if ( o!= ST.EMPTY_ATTR ) { |
| 515 | attrs.put(arg.name, o); |
| 516 | } |
| 517 | } |
| 518 | catch (STNoSuchAttributeException nsae) { |
| 519 | // if no such attribute exists for arg.name, set parameter |
| 520 | // if no default value |
| 521 | if ( arg.defaultValueToken==null ) { |
| 522 | errMgr.runTimeError(this, |
| 523 | scope, |
| 524 | ErrorType.NO_SUCH_ATTRIBUTE_PASS_THROUGH, |
| 525 | arg.name); |
| 526 | attrs.put(arg.name, null); |
| 527 | } |
| 528 | } |
| 529 | } |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | void storeArgs(InstanceScope scope, Map<String, Object> attrs, ST st) { |
| 534 | boolean noSuchAttributeReported = false; |
no test coverage detected