summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-18 07:55:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-18 07:55:45 +0000
commit942a54302de5bfa4665960947c403e1c0b6831ad (patch)
tree2a4be7c58259a21f0a3f04ca76ea2ee1774d00f5 /parse.y
parent31345380ac41f8b830104ea41b4b52e1e2b094a8 (diff)
* parse.y (yycompile): disable trace while creating ruby_debug_lines.
[ruby-talk:253586] * thread.c (ruby_suppress_tracing): new function to call a function with suppressing trace. * lib/debug.rb, lib/tracer.rb: for YARV. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y37
1 files changed, 23 insertions, 14 deletions
diff --git a/parse.y b/parse.y
index 21d9fd1f53..5bd59c69dd 100644
--- a/parse.y
+++ b/parse.y
@@ -4584,26 +4584,35 @@ parser_yyerror(struct parser_params *parser, const char *msg)
static void parser_prepare(struct parser_params *parser);
#ifndef RIPPER
+VALUE ruby_suppress_tracing(VALUE (*func)(ANYARGS), VALUE arg);
+
+static VALUE
+debug_lines(VALUE f)
+{
+ if (rb_const_defined_at(rb_cObject, rb_intern("SCRIPT_LINES__"))) {
+ VALUE hash = rb_const_get_at(rb_cObject, rb_intern("SCRIPT_LINES__"));
+ if (TYPE(hash) == T_HASH) {
+ VALUE fname = rb_str_new2((const char *)f);
+ VALUE lines = rb_hash_aref(hash, fname);
+ if (NIL_P(lines)) {
+ lines = rb_ary_new();
+ rb_hash_aset(hash, fname, lines);
+ }
+ return lines;
+ }
+ }
+ return 0;
+}
+
static NODE*
yycompile(struct parser_params *parser, const char *f, int line)
{
int n;
const char *kcode_save;
- if (!compile_for_eval && rb_safe_level() == 0 &&
- rb_const_defined(rb_cObject, rb_intern("SCRIPT_LINES__"))) {
- VALUE hash, fname;
-
- hash = rb_const_get(rb_cObject, rb_intern("SCRIPT_LINES__"));
- if (TYPE(hash) == T_HASH) {
- fname = rb_str_new2(f);
- ruby_debug_lines = rb_hash_aref(hash, fname);
- if (NIL_P(ruby_debug_lines)) {
- ruby_debug_lines = rb_ary_new();
- rb_hash_aset(hash, fname, ruby_debug_lines);
- }
- }
- if (line > 1) {
+ if (!compile_for_eval && rb_safe_level() == 0) {
+ ruby_debug_lines = ruby_suppress_tracing(debug_lines, (VALUE)f);
+ if (ruby_debug_lines && line > 1) {
VALUE str = rb_str_new(0,0);
n = line - 1;
do {