diff options
author | Nobuyoshi Nakada <[email protected]> | 2020-11-02 19:48:17 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2020-12-14 19:19:16 +0900 |
commit | 7060aeedbd69c0888379cbf91f0bb2208bc59308 (patch) | |
tree | f3153ca57eec7182f4d1b931b0cc40cc39332901 /parse.y | |
parent | 25cf1aca927946595b1325e4fde7f642bba2a706 (diff) |
shareable_constant_value: is effective only in comment-only line
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3681
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -7999,6 +7999,13 @@ parser_set_compile_option_flag(struct parser_params *p, const char *name, const static void parser_set_shareable_constant_value(struct parser_params *p, const char *name, const char *val) { + for (const char *s = p->lex.pbeg, *e = p->lex.pcur; s < e; ++s) { + if (*s == ' ' || *s == '\t') continue; + if (*s == '#') break; + rb_warning1("`%s' is ignored unless in comment-only line", WARN_S(name)); + return; + } + int b = parser_get_bool(p, name, val); if (b >= 0) p->ctxt.shareable_constant_value = b; } |