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