/[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 240 by siliconforks, Fri Oct 3 23:51:32 2008 UTC revision 245 by siliconforks, Sun Oct 5 18:05:12 2008 UTC
# Line 1456  Line 1456 
1456        file_coverage->id = id;        file_coverage->id = id;
1457        file_coverage->num_coverage_lines = array->pn_count;        file_coverage->num_coverage_lines = array->pn_count;
1458        file_coverage->coverage_lines = xnew(int, array->pn_count);        file_coverage->coverage_lines = xnew(int, array->pn_count);
1459        if (source == NULL) {        file_coverage->source_lines = NULL;
         file_coverage->source_lines = NULL;  
       }  
       else {  
         file_coverage->num_source_lines = source->pn_count;  
         file_coverage->source_lines = xnew(char *, source->pn_count);  
         uint32 i = 0;  
         for (JSParseNode * element = source->pn_head; element != NULL; element = element->pn_next, i++) {  
           if (element->pn_type != TOK_STRING) {  
             return -1;  
           }  
           file_coverage->source_lines[i] = xstrdup(JS_GetStringBytes(ATOM_TO_STRING(element->pn_atom)));  
         }  
         assert(i == source->pn_count);  
       }  
1460    
1461        /* set coverage for all lines */        /* set coverage for all lines */
1462        uint32 i = 0;        uint32 i = 0;
# Line 1520  Line 1506 
1506          }          }
1507        }        }
1508        assert(i == array->pn_count);        assert(i == array->pn_count);
1509        }
1510    
1511        /* if this JSON file has source, use it */      /* if this JSON file has source, use it */
1512        if (file_coverage->source_lines == NULL && source != NULL) {      if (file_coverage->source_lines == NULL && source != NULL) {
1513          file_coverage->num_source_lines = source->pn_count;        file_coverage->num_source_lines = source->pn_count;
1514          file_coverage->source_lines = xnew(char *, source->pn_count);        file_coverage->source_lines = xnew(char *, source->pn_count);
1515          uint32 i = 0;        uint32 i = 0;
1516          for (JSParseNode * element = source->pn_head; element != NULL; element = element->pn_next, i++) {        for (JSParseNode * element = source->pn_head; element != NULL; element = element->pn_next, i++) {
1517            if (element->pn_type != TOK_STRING) {          if (element->pn_type != TOK_STRING) {
1518              return -1;            return -1;
           }  
           file_coverage->source_lines[i] = xstrdup(JS_GetStringBytes(ATOM_TO_STRING(element->pn_atom)));  
1519          }          }
1520          assert(i == source->pn_count);          file_coverage->source_lines[i] = xstrdup(JS_GetStringBytes(ATOM_TO_STRING(element->pn_atom)));
1521        }        }
1522          assert(i == source->pn_count);
1523      }      }
1524    }    }
1525    

Legend:
Removed from v.240  
changed lines
  Added in v.245

  ViewVC Help
Powered by ViewVC 1.1.24