1 |
/* |
/* |
2 |
instrument-js.c - JavaScript instrumentation routines |
instrument-js.c - JavaScript instrumentation routines |
3 |
Copyright (C) 2007 siliconforks.com |
Copyright (C) 2007, 2008 siliconforks.com |
4 |
|
|
5 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
6 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
385 |
the dot syntax. |
the dot syntax. |
386 |
*/ |
*/ |
387 |
instrument_expression(node->pn_expr, f); |
instrument_expression(node->pn_expr, f); |
388 |
/* |
assert(ATOM_IS_STRING(node->pn_atom)); |
389 |
fputc('.', f); |
{ |
390 |
print_string_atom(node->pn_atom, f); |
JSString * s = ATOM_TO_STRING(node->pn_atom); |
391 |
*/ |
/* XXX - semantics changed in 1.7 */ |
392 |
fputc('[', f); |
if (! ATOM_KEYWORD(node->pn_atom) && js_IsIdentifier(s)) { |
393 |
print_quoted_string_atom(node->pn_atom, f); |
fputc('.', f); |
394 |
fputc(']', f); |
print_string_atom(node->pn_atom, f); |
395 |
|
} |
396 |
|
else { |
397 |
|
fputc('[', f); |
398 |
|
print_quoted_string_atom(node->pn_atom, f); |
399 |
|
fputc(']', f); |
400 |
|
} |
401 |
|
} |
402 |
break; |
break; |
403 |
case TOK_LB: |
case TOK_LB: |
404 |
instrument_expression(node->pn_left, f); |
instrument_expression(node->pn_left, f); |
845 |
} |
} |
846 |
} |
} |
847 |
fprintf(output, "}\n"); |
fprintf(output, "}\n"); |
848 |
|
free(lines); |
849 |
lines = NULL; |
lines = NULL; |
850 |
|
|
851 |
/* copy the temporary to the output */ |
/* copy the temporary to the output */ |