[ruby/prism] Only call encoding_changed callback on change
https://github.com/ruby/prism/commit/7d0bea3ce0
This commit is contained in:
parent
bf680af7b2
commit
2b2e61e6f9
@ -6605,9 +6605,12 @@ parser_lex_magic_comment_encoding_value(pm_parser_t *parser, const uint8_t *star
|
||||
const pm_encoding_t *encoding = pm_encoding_find(start, end);
|
||||
|
||||
if (encoding != NULL) {
|
||||
parser->encoding = encoding;
|
||||
if (parser->encoding != encoding) {
|
||||
parser->encoding = encoding;
|
||||
if (parser->encoding_changed_callback != NULL) parser->encoding_changed_callback(parser);
|
||||
}
|
||||
|
||||
parser->encoding_changed = (encoding != PM_ENCODING_UTF_8_ENTRY);
|
||||
if (parser->encoding_changed_callback != NULL) parser->encoding_changed_callback(parser);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user