MCPcopy Create free account
hub / github.com/antlr/codebuff / rot_map

Method rot_map

output/java/1.4.14/Interpreter.java:807–832  ·  view source on GitHub ↗

Renders expressions of the form or .

(InstanceScope scope, Object attr, List<ST> prototypes)

Source from the content-addressed store, hash-verified

805 */
806
807 protected void rot_map(InstanceScope scope, Object attr, List<ST> prototypes) {
808 if ( attr==null ) {
809 operands[++sp] = null;
810 return;
811 }
812 attr = convertAnythingIteratableToIterator(scope, attr);
813 if ( attr instanceof Iterator) {
814 List<ST> mapped = rot_map_iterator(scope, (Iterator)attr, prototypes);
815 operands[++sp] = mapped;
816 }
817 else { // if only single value, just apply first template to sole value
818 ST proto = prototypes.get(0);
819 ST st = group.createStringTemplateInternally(proto);
820 if ( st !=null ) {
821 setFirstArgument(scope, st, attr);
822 if ( st.impl.isAnonSubtemplate) {
823 st.rawSetAttribute("i0", 0);
824 st.rawSetAttribute("i", 1);
825 }
826 operands[++sp] = st;
827 }
828 else {
829 operands[++sp] = null;
830 }
831 }
832 }
833
834 protected List<ST> rot_map_iterator(InstanceScope scope, Iterator<?> attr, List<ST> prototypes) {
835 List<ST> mapped = new ArrayList<ST>();

Callers 2

_execMethod · 0.95
mapMethod · 0.95

Calls 6

rot_map_iteratorMethod · 0.95
setFirstArgumentMethod · 0.95
rawSetAttributeMethod · 0.95
getMethod · 0.65

Tested by

no test coverage detected