diff options
| author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-15 16:14:43 +0000 |
|---|---|---|
| committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-15 16:14:43 +0000 |
| commit | e17e71c37f8cf5fef8ff56d354c7f81357a6dce1 (patch) | |
| tree | fb97ed29bb2bc99c6a23ddd9f7599ea410453190 /parse.y | |
| parent | 4decaa2678de2ac9c0de10565f62fe6063d7cc57 (diff) | |
| download | ruby-e17e71c37f8cf5fef8ff56d354c7f81357a6dce1.tar.gz ruby-e17e71c37f8cf5fef8ff56d354c7f81357a6dce1.tar.xz ruby-e17e71c37f8cf5fef8ff56d354c7f81357a6dce1.zip | |
* ruby.c (process_options): decrement parse_in_eval to recognize
parsing main or normal eval script.
* compile.c (rb_parse_in_main): return 1 if parsing main script.
(if parse_in_eval is negative value, it means main script)
* parse.y (yycompile0): check rb_parse_in_main() to accumulate
script text. Bug #848 [ruby-core:20450]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
| -rw-r--r-- | parse.y | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -437,6 +437,7 @@ static void fixup_nodes(NODE **); extern int rb_dvar_defined(ID); extern int rb_local_defined(ID); extern int rb_parse_in_eval(void); +extern int rb_prase_in_main(void); static VALUE reg_compile_gen(struct parser_params*, VALUE, int); #define reg_compile(str,options) reg_compile_gen(parser, str, options) @@ -4983,7 +4984,7 @@ yycompile0(VALUE arg, int tracing) NODE *tree; struct parser_params *parser = (struct parser_params *)arg; - if (!compile_for_eval && rb_safe_level() == 0) { + if ((!compile_for_eval || rb_parse_in_main()) && rb_safe_level() == 0) { ruby_debug_lines = debug_lines(ruby_sourcefile); if (ruby_debug_lines && ruby_sourceline > 0) { VALUE str = STR_NEW0(); |
