Renders expressions of the form or .
(InstanceScope scope, Object attr, List<ST> prototypes)
| 777 | */ |
| 778 | |
| 779 | protected void rot_map(InstanceScope scope, Object attr, List<ST> prototypes) { |
| 780 | if ( attr==null ) { |
| 781 | operands[++sp] = null; |
| 782 | return; |
| 783 | } |
| 784 | attr = convertAnythingIteratableToIterator(scope, attr); |
| 785 | if ( attr instanceof Iterator ) { |
| 786 | List<ST> mapped = rot_map_iterator(scope, (Iterator)attr, prototypes); |
| 787 | operands[++sp] = mapped; |
| 788 | } |
| 789 | else { // if only single value, just apply first template to sole value |
| 790 | ST proto = prototypes.get(0); |
| 791 | ST st = group.createStringTemplateInternally(proto); |
| 792 | if ( st!=null ) { |
| 793 | setFirstArgument(scope, st, attr); |
| 794 | if ( st.impl.isAnonSubtemplate ) { |
| 795 | st.rawSetAttribute("i0", 0); |
| 796 | st.rawSetAttribute("i", 1); |
| 797 | } |
| 798 | operands[++sp] = st; |
| 799 | } |
| 800 | else { |
| 801 | operands[++sp] = null; |
| 802 | } |
| 803 | } |
| 804 | } |
| 805 | |
| 806 | protected List<ST> rot_map_iterator(InstanceScope scope, Iterator<?> attr, List<ST> prototypes) { |
| 807 | List<ST> mapped = new ArrayList<ST>(); |
no test coverage detected