787 |
JSParseNode * for_node = block_node->pn_expr; |
JSParseNode * for_node = block_node->pn_expr; |
788 |
assert(for_node->pn_type == TOK_FOR); |
assert(for_node->pn_type == TOK_FOR); |
789 |
assert(for_node->pn_arity == PN_BINARY); |
assert(for_node->pn_arity == PN_BINARY); |
790 |
|
JSParseNode * p = for_node; |
791 |
|
while (p->pn_type == TOK_FOR) { |
792 |
|
p = p->pn_right; |
793 |
|
} |
794 |
JSParseNode * if_node = NULL; |
JSParseNode * if_node = NULL; |
795 |
JSParseNode * push_node; |
JSParseNode * push_node; |
796 |
switch (for_node->pn_right->pn_type) { |
switch (p->pn_type) { |
797 |
case TOK_ARRAYPUSH: |
case TOK_ARRAYPUSH: |
798 |
push_node = for_node->pn_right; |
push_node = p; |
799 |
assert(push_node->pn_arity == PN_UNARY); |
assert(push_node->pn_arity == PN_UNARY); |
800 |
break; |
break; |
801 |
case TOK_IF: |
case TOK_IF: |
802 |
if_node = for_node->pn_right; |
if_node = p; |
803 |
assert(if_node->pn_arity == PN_TERNARY); |
assert(if_node->pn_arity == PN_TERNARY); |
804 |
push_node = if_node->pn_kid2; |
push_node = if_node->pn_kid2; |
805 |
|
assert(push_node->pn_arity == PN_UNARY); |
806 |
break; |
break; |
807 |
default: |
default: |
808 |
abort(); |
abort(); |
810 |
} |
} |
811 |
Stream_write_char(f, '['); |
Stream_write_char(f, '['); |
812 |
instrument_expression(push_node->pn_kid, f); |
instrument_expression(push_node->pn_kid, f); |
813 |
Stream_write_char(f, ' '); |
p = for_node; |
814 |
output_for_in(for_node, f); |
while (p->pn_type == TOK_FOR) { |
815 |
|
Stream_write_char(f, ' '); |
816 |
|
output_for_in(p, f); |
817 |
|
p = p->pn_right; |
818 |
|
} |
819 |
if (if_node) { |
if (if_node) { |
820 |
Stream_write_string(f, " if ("); |
Stream_write_string(f, " if ("); |
821 |
instrument_expression(if_node->pn_kid1, f); |
instrument_expression(if_node->pn_kid1, f); |