Renders expressions of the form or .
(InstanceScope scope, Object attr, List<ST> prototypes)
| 811 | */ |
| 812 | |
| 813 | protected void rot_map(InstanceScope scope, Object attr, List<ST> prototypes) { |
| 814 | if ( attr==null ) { |
| 815 | operands[++sp] = null; |
| 816 | return; |
| 817 | } |
| 818 | attr = convertAnythingIteratableToIterator(scope, attr); |
| 819 | if ( attr instanceof Iterator) { |
| 820 | List<ST> mapped = rot_map_iterator(scope, (Iterator)attr, prototypes); |
| 821 | operands[++sp] = mapped; |
| 822 | } |
| 823 | else { // if only single value, just apply first template to sole value |
| 824 | ST proto = prototypes.get(0); |
| 825 | ST st = group.createStringTemplateInternally(proto); |
| 826 | if ( st !=null ) { |
| 827 | setFirstArgument(scope, st, attr); |
| 828 | if ( st.impl.isAnonSubtemplate) { |
| 829 | st.rawSetAttribute("i0", 0); |
| 830 | st.rawSetAttribute("i", 1); |
| 831 | } |
| 832 | operands[++sp] = st; |
| 833 | } |
| 834 | else { |
| 835 | operands[++sp] = null; |
| 836 | } |
| 837 | } |
| 838 | } |
| 839 | |
| 840 | protected List<ST> rot_map_iterator(InstanceScope scope, Iterator<?> attr, List<ST> prototypes) { |
| 841 | List<ST> mapped = new ArrayList<ST>(); |
no test coverage detected