327 |
static void instrument_declarations(JSParseNode * list, Stream * f) { |
static void instrument_declarations(JSParseNode * list, Stream * f) { |
328 |
assert(list->pn_arity == PN_LIST); |
assert(list->pn_arity == PN_LIST); |
329 |
for (JSParseNode * p = list->pn_head; p != NULL; p = p->pn_next) { |
for (JSParseNode * p = list->pn_head; p != NULL; p = p->pn_next) { |
330 |
assert(p->pn_type == TOK_NAME); |
switch (p->pn_type) { |
331 |
assert(p->pn_arity == PN_NAME); |
case TOK_NAME: |
332 |
if (p != list->pn_head) { |
assert(p->pn_arity == PN_NAME); |
333 |
Stream_write_string(f, ", "); |
if (p != list->pn_head) { |
334 |
} |
Stream_write_string(f, ", "); |
335 |
print_string_atom(p->pn_atom, f); |
} |
336 |
if (p->pn_expr != NULL) { |
print_string_atom(p->pn_atom, f); |
337 |
Stream_write_string(f, " = "); |
if (p->pn_expr != NULL) { |
338 |
instrument_expression(p->pn_expr, f); |
Stream_write_string(f, " = "); |
339 |
|
instrument_expression(p->pn_expr, f); |
340 |
|
} |
341 |
|
break; |
342 |
|
case TOK_ASSIGN: |
343 |
|
case TOK_RB: |
344 |
|
case TOK_RC: |
345 |
|
/* destructuring */ |
346 |
|
instrument_expression(p, f); |
347 |
|
break; |
348 |
|
default: |
349 |
|
abort(); |
350 |
|
break; |
351 |
} |
} |
352 |
} |
} |
353 |
} |
} |
895 |
assert(catch->pn_type == TOK_CATCH); |
assert(catch->pn_type == TOK_CATCH); |
896 |
Stream_printf(f, "%*s", indent, ""); |
Stream_printf(f, "%*s", indent, ""); |
897 |
Stream_write_string(f, "catch ("); |
Stream_write_string(f, "catch ("); |
898 |
|
/* this may not be a name - destructuring assignment */ |
899 |
|
/* |
900 |
assert(catch->pn_kid1->pn_arity == PN_NAME); |
assert(catch->pn_kid1->pn_arity == PN_NAME); |
901 |
print_string_atom(catch->pn_kid1->pn_atom, f); |
print_string_atom(catch->pn_kid1->pn_atom, f); |
902 |
|
*/ |
903 |
|
instrument_expression(catch->pn_kid1, f); |
904 |
if (catch->pn_kid2) { |
if (catch->pn_kid2) { |
905 |
Stream_write_string(f, " if "); |
Stream_write_string(f, " if "); |
906 |
instrument_expression(catch->pn_kid2, f); |
instrument_expression(catch->pn_kid2, f); |