diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-03-07 15:01:09 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-03-07 15:01:09 +0900 |
| commit | 63dbed00946afda34178a479cfa38fa78d620a00 (patch) | |
| tree | 5cc68503e6a51808b548cbc16932e5ce5d21283b /mrbgems/mruby-compiler/core/parse.y | |
| parent | 513f4fbf141e7920158ae068b92e200ad960969d (diff) | |
| download | mruby-63dbed00946afda34178a479cfa38fa78d620a00.tar.gz mruby-63dbed00946afda34178a479cfa38fa78d620a00.zip | |
`__FILE__` should not update `p->filename`; fix #3485
Diffstat (limited to 'mrbgems/mruby-compiler/core/parse.y')
| -rw-r--r-- | mrbgems/mruby-compiler/core/parse.y | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y index 6548eb18c..306036275 100644 --- a/mrbgems/mruby-compiler/core/parse.y +++ b/mrbgems/mruby-compiler/core/parse.y @@ -2936,10 +2936,11 @@ var_ref : variable } | keyword__FILE__ { - if (!p->filename) { - p->filename = "(null)"; + const char *fn = p->filename; + if (!fn) { + fn = "(null)"; } - $$ = new_str(p, p->filename, strlen(p->filename)); + $$ = new_str(p, fn, strlen(fn)); } | keyword__LINE__ { |
