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