/[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 157 by siliconforks, Sat Sep 13 03:56:45 2008 UTC revision 159 by siliconforks, Sat Sep 13 04:47:17 2008 UTC
# Line 877  Line 877 
877    free(lines);    free(lines);
878    lines = NULL;    lines = NULL;
879    
880      /* copy the instrumented source code to the output */
881      Stream_write(output, instrumented->data, instrumented->length);
882      Stream_write_char(output, '\n');
883    
884    /* conditionals */    /* conditionals */
885    bool has_conditionals = false;    bool has_conditionals = false;
886    size_t line_number = 0;    size_t line_number = 0;
# Line 910  Line 914 
914          has_conditionals = true;          has_conditionals = true;
915          Stream_printf(output, "_$jscoverage['%s'].conditionals = [];\n", file_id);          Stream_printf(output, "_$jscoverage['%s'].conditionals = [];\n", file_id);
916        }        }
917        Stream_printf(output, "_$jscoverage['%s'].conditionals[%d] = {condition: function () {return %s;}, ", file_id, line_number, line + 16);        Stream_printf(output, "if (!%s) {\n", line + 16);
918          Stream_printf(output, "  _$jscoverage['%s'].conditionals[%d] = ", file_id, line_number);
919      }      }
920      else if (str_starts_with(line, "//#JSCOVERAGE_ENDIF")) {      else if (str_starts_with(line, "//#JSCOVERAGE_ENDIF")) {
921        Stream_printf(output, "end: %d};\n", line_number);        Stream_printf(output, "%d;\n", line_number);
922          Stream_printf(output, "}\n");
923      }      }
924      JS_free(context, line);      JS_free(context, line);
925    }    }
926    
   /* copy the instrumented source code to the output */  
   Stream_write(output, instrumented->data, instrumented->length);  
   Stream_write_char(output, '\n');  
   
927    /* copy the original source to the output */    /* copy the original source to the output */
928    i = 0;    i = 0;
929    while (i < input_length) {    while (i < input_length) {

Legend:
Removed from v.157  
changed lines
  Added in v.159

  ViewVC Help
Powered by ViewVC 1.1.24