/[jscoverage]/trunk/instrument-js.c
ViewVC logotype

Diff of /trunk/instrument-js.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 351 by siliconforks, Fri Oct 24 16:17:59 2008 UTC revision 356 by siliconforks, Fri Oct 24 21:48:02 2008 UTC
# Line 315  Line 315 
315        Stream_write_string(f, ", ");        Stream_write_string(f, ", ");
316      }      }
317      JSAtom * param = JS_LOCAL_NAME_TO_ATOM(local_names[i]);      JSAtom * param = JS_LOCAL_NAME_TO_ATOM(local_names[i]);
318        if (param == NULL) {
319          fatal("unsupported parameter type for function: %s", file_id);
320        }
321      print_string_atom(param, f);      print_string_atom(param, f);
322    }    }
323    JS_FinishArenaPool(&pool);    JS_FinishArenaPool(&pool);
# Line 541  Line 544 
544        instrument_expression(node->pn_kid, f);        instrument_expression(node->pn_kid, f);
545        break;        break;
546      default:      default:
547        abort();        fatal("%s: unknown operator (%d) in file", file_id, node->pn_op);
548        break;        break;
549      }      }
550      break;      break;
# Line 650  Line 653 
653    case TOK_RC:    case TOK_RC:
654      Stream_write_char(f, '{');      Stream_write_char(f, '{');
655      for (struct JSParseNode * p = node->pn_head; p != NULL; p = p->pn_next) {      for (struct JSParseNode * p = node->pn_head; p != NULL; p = p->pn_next) {
656        assert(p->pn_type == TOK_COLON);        if (p->pn_type != TOK_COLON) {
657            fatal("unsupported node type in file %s: %d", file_id, p->pn_type);
658          }
659        if (p != node->pn_head) {        if (p != node->pn_head) {
660          Stream_write_string(f, ", ");          Stream_write_string(f, ", ");
661        }        }
# Line 756  Line 761 
761      break;      break;
762    case TOK_YIELD:    case TOK_YIELD:
763      assert(node->pn_arity == PN_UNARY);      assert(node->pn_arity == PN_UNARY);
764      Stream_write_string(f, "yield ");      Stream_write_string(f, "yield");
765      instrument_expression(node->pn_kid, f);      if (node->pn_kid != NULL) {
766          Stream_write_char(f, ' ');
767          instrument_expression(node->pn_kid, f);
768        }
769      break;      break;
770    case TOK_ARRAYCOMP:    case TOK_ARRAYCOMP:
771      assert(node->pn_arity == PN_LIST);      assert(node->pn_arity == PN_LIST);
# Line 779  Line 787 
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();
# Line 797  Line 810 
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);

Legend:
Removed from v.351  
changed lines
  Added in v.356

  ViewVC Help
Powered by ViewVC 1.1.24