| 705 | } |
| 706 | |
| 707 | static void ts_walk_export(ts_walk_t *w, TSNode stmt) { |
| 708 | w->module_syntax = true; |
| 709 | TSNode src = ts_source_of(stmt); |
| 710 | TSNode decl = ts_node_child_by_field_name(stmt, TS_FIELD("declaration")); |
| 711 | bool dflt = ts_has_default(stmt); |
| 712 | if (!ts_node_is_null(decl)) { |
| 713 | ts_walk_decl(w, decl, true, dflt, NULL, 0); |
| 714 | return; |
| 715 | } |
| 716 | uint32_t nc = ts_node_child_count(stmt); |
| 717 | bool star = false; |
| 718 | for (uint32_t i = 0; i < nc; i++) { |
| 719 | TSNode c = ts_node_child(stmt, i); |
| 720 | if (ts_kind(c, "export_clause")) { |
| 721 | ts_walk_export_clause(w, c, src); |
| 722 | return; |
| 723 | } |
| 724 | if (ts_kind(c, "namespace_export") && !ts_node_is_null(src)) { |
| 725 | TSNode id = ts_node_named_child(c, 0); |
| 726 | if (!ts_node_is_null(id)) { |
| 727 | ts_sb_puts(w->sb, "\nS"); |
| 728 | ts_node_field(w, id); |
| 729 | ts_string_field(w, src); |
| 730 | } |
| 731 | return; |
| 732 | } |
| 733 | star = star || ts_kind(c, "*"); |
| 734 | } |
| 735 | if (star && !ts_node_is_null(src)) { |
| 736 | ts_sb_puts(w->sb, "\nA"); |
| 737 | ts_string_field(w, src); |
| 738 | return; |
| 739 | } |
| 740 | TSNode value = ts_node_child_by_field_name(stmt, TS_FIELD("value")); |
| 741 | if (dflt && ts_kind(value, "identifier")) { |
| 742 | ts_sb_puts(w->sb, "\nL\tdefault"); |
| 743 | ts_node_field(w, value); |
| 744 | } |
| 745 | } |
| 746 | |
| 747 | static bool ts_is_function_like(TSNode n) { |
| 748 | static const char *const kinds[] = {"function_declaration", "generator_function_declaration", |
no test coverage detected