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

Method rot_map

output/java/1.4.12/Interpreter.java:803–828  ·  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

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