summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler/core/parse.y
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-03-07 15:01:09 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-03-07 15:01:09 +0900
commit63dbed00946afda34178a479cfa38fa78d620a00 (patch)
tree5cc68503e6a51808b548cbc16932e5ce5d21283b /mrbgems/mruby-compiler/core/parse.y
parent513f4fbf141e7920158ae068b92e200ad960969d (diff)
downloadmruby-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.y7
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__
{