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

Diff of /trunk/instrument-js.cpp

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

revision 401 by siliconforks, Tue Dec 9 09:47:21 2008 UTC revision 402 by siliconforks, Tue Dec 9 09:47:43 2008 UTC
# Line 305  Line 305 
305      assert(if_node->pn_arity == PN_TERNARY);      assert(if_node->pn_arity == PN_TERNARY);
306      p = if_node->pn_kid2;      p = if_node->pn_kid2;
307    }    }
308    assert(p->pn_arity == PN_UNARY);    switch (p->pn_arity) {
309    p = p->pn_kid;    case PN_UNARY:
   if (p->pn_type == TOK_YIELD) {  
     /* for generator expressions */  
310      p = p->pn_kid;      p = p->pn_kid;
311        if (p->pn_type == TOK_YIELD) {
312          /* for generator expressions */
313          p = p->pn_kid;
314        }
315        output_expression(p, f, false);
316        break;
317      case PN_LIST:
318        /*
319        When the array comprehension contains "if (0)", it will be optimized away and
320        the result will be an empty TOK_LC list.
321        */
322        assert(p->pn_type == TOK_LC);
323        assert(p->pn_head == NULL);
324        /* the "1" is arbitrary (since the list is empty) */
325        Stream_write_char(f, '1');
326        break;
327      default:
328        abort();
329        break;
330    }    }
331    
   output_expression(p, f, false);  
332    p = for_node;    p = for_node;
333    while (p->pn_type == TOK_FOR) {    while (p->pn_type == TOK_FOR) {
334      Stream_write_char(f, ' ');      Stream_write_char(f, ' ');
335      output_for_in(p, f);      output_for_in(p, f);
336      p = p->pn_right;      p = p->pn_right;
337    }    }
338    if (if_node) {    if (p->pn_type == TOK_LC) {
339        /* this is the optimized-away "if (0)" */
340        Stream_write_string(f, " if (0)");
341      }
342      else if (if_node) {
343      Stream_write_string(f, " if (");      Stream_write_string(f, " if (");
344      output_expression(if_node->pn_kid1, f, false);      output_expression(if_node->pn_kid1, f, false);
345      Stream_write_char(f, ')');      Stream_write_char(f, ')');

Legend:
Removed from v.401  
changed lines
  Added in v.402

  ViewVC Help
Powered by ViewVC 1.1.24