This commit is contained in:
Kevin Newton 2024-02-01 12:21:57 -05:00
Родитель ef427123ad
Коммит e9f1324464
10 изменённых файлов: 7 добавлений и 55 удалений

Просмотреть файл

@ -311,9 +311,6 @@ module Prism
template << "C"
values << (options.fetch(:frozen_string_literal, false) ? 1 : 0)
template << "C"
values << (options.fetch(:verbose, true) ? 0 : 1)
template << "C"
values << { nil => 0, "3.3.0" => 1, "latest" => 0 }.fetch(options[:version])

Просмотреть файл

@ -2,7 +2,7 @@
Gem::Specification.new do |spec|
spec.name = "prism"
spec.version = "0.19.0"
spec.version = "0.20.0"
spec.authors = ["Shopify"]
spec.email = ["ruby@shopify.com"]

Просмотреть файл

@ -21,7 +21,6 @@ ID rb_option_id_filepath;
ID rb_option_id_encoding;
ID rb_option_id_line;
ID rb_option_id_frozen_string_literal;
ID rb_option_id_verbose;
ID rb_option_id_version;
ID rb_option_id_scopes;
@ -130,8 +129,6 @@ build_options_i(VALUE key, VALUE value, VALUE argument) {
if (!NIL_P(value)) pm_options_line_set(options, NUM2INT(value));
} else if (key_id == rb_option_id_frozen_string_literal) {
if (!NIL_P(value)) pm_options_frozen_string_literal_set(options, value == Qtrue);
} else if (key_id == rb_option_id_verbose) {
pm_options_suppress_warnings_set(options, value != Qtrue);
} else if (key_id == rb_option_id_version) {
if (!NIL_P(value)) {
const char *version = check_string(value);
@ -667,8 +664,6 @@ parse_input(pm_string_t *input, const pm_options_t *options) {
* integer or nil. Note that this is 1-indexed.
* * `frozen_string_literal` - whether or not the frozen string literal pragma
* has been set. This should be a boolean or nil.
* * `verbose` - the current level of verbosity. This controls whether or not
* the parser emits warnings. This should be a boolean or nil.
* * `version` - the version of prism that should be used to parse Ruby code. By
* default prism assumes you want to parse with the latest vesion of
* prism (which you can trigger with `nil` or `"latest"`). If you want to
@ -1079,7 +1074,6 @@ Init_prism(void) {
rb_option_id_encoding = rb_intern_const("encoding");
rb_option_id_line = rb_intern_const("line");
rb_option_id_frozen_string_literal = rb_intern_const("frozen_string_literal");
rb_option_id_verbose = rb_intern_const("verbose");
rb_option_id_version = rb_intern_const("version");
rb_option_id_scopes = rb_intern_const("scopes");

Просмотреть файл

@ -1,7 +1,7 @@
#ifndef PRISM_EXT_NODE_H
#define PRISM_EXT_NODE_H
#define EXPECTED_PRISM_VERSION "0.19.0"
#define EXPECTED_PRISM_VERSION "0.20.0"
#include <ruby.h>
#include <ruby/encoding.h>

Просмотреть файл

@ -32,14 +32,6 @@ pm_options_frozen_string_literal_set(pm_options_t *options, bool frozen_string_l
options->frozen_string_literal = frozen_string_literal;
}
/**
* Set the suppress warnings option on the given options struct.
*/
PRISM_EXPORTED_FUNCTION void
pm_options_suppress_warnings_set(pm_options_t *options, bool suppress_warnings) {
options->suppress_warnings = suppress_warnings;
}
/**
* Set the version option on the given options struct by parsing the given
* string. If the string contains an invalid option, this returns false.
@ -189,7 +181,6 @@ pm_options_read(pm_options_t *options, const char *data) {
}
options->frozen_string_literal = *data++;
options->suppress_warnings = *data++;
options->version = (pm_options_version_t) *data++;
uint32_t scopes_count = pm_options_read_u32(data);

Просмотреть файл

@ -78,13 +78,6 @@ typedef struct {
/** Whether or not the frozen string literal option has been set. */
bool frozen_string_literal;
/**
* Whether or not we should suppress warnings. This is purposefully negated
* so that the default is to not suppress warnings, which allows us to still
* create an options struct with zeroed memory.
*/
bool suppress_warnings;
} pm_options_t;
/**
@ -119,14 +112,6 @@ PRISM_EXPORTED_FUNCTION void pm_options_encoding_set(pm_options_t *options, cons
*/
PRISM_EXPORTED_FUNCTION void pm_options_frozen_string_literal_set(pm_options_t *options, bool frozen_string_literal);
/**
* Set the suppress warnings option on the given options struct.
*
* @param options The options struct to set the suppress warnings value on.
* @param suppress_warnings The suppress warnings value to set.
*/
PRISM_EXPORTED_FUNCTION void pm_options_suppress_warnings_set(pm_options_t *options, bool suppress_warnings);
/**
* Set the version option on the given options struct by parsing the given
* string. If the string contains an invalid option, this returns false.

Просмотреть файл

@ -727,13 +727,6 @@ struct pm_parser {
* a true value.
*/
bool frozen_string_literal;
/**
* Whether or not we should emit warnings. This will be set to false if the
* consumer of the library specified it, usually because they are parsing
* when $VERBOSE is nil.
*/
bool suppress_warnings;
};
#endif

Просмотреть файл

@ -553,9 +553,7 @@ pm_parser_err_token(pm_parser_t *parser, const pm_token_t *token, pm_diagnostic_
*/
static inline void
pm_parser_warn(pm_parser_t *parser, const uint8_t *start, const uint8_t *end, pm_diagnostic_id_t diag_id) {
if (!parser->suppress_warnings) {
pm_diagnostic_list_append(&parser->warning_list, start, end, diag_id);
}
pm_diagnostic_list_append(&parser->warning_list, start, end, diag_id);
}
/**
@ -17767,8 +17765,7 @@ pm_parser_init(pm_parser_t *parser, const uint8_t *source, size_t size, const pm
.in_keyword_arg = false,
.current_param_name = 0,
.semantic_token_seen = false,
.frozen_string_literal = false,
.suppress_warnings = false
.frozen_string_literal = false
};
// Initialize the constant pool. We're going to completely guess as to the
@ -17814,11 +17811,6 @@ pm_parser_init(pm_parser_t *parser, const uint8_t *source, size_t size, const pm
parser->frozen_string_literal = true;
}
// suppress_warnings option
if (options->suppress_warnings) {
parser->suppress_warnings = true;
}
// version option
parser->version = options->version;

Просмотреть файл

@ -20,7 +20,7 @@ module Prism
# The minor version of prism that we are expecting to find in the serialized
# strings.
MINOR_VERSION = 19
MINOR_VERSION = 20
# The patch version of prism that we are expecting to find in the serialized
# strings.

Просмотреть файл

@ -14,7 +14,7 @@
/**
* The minor version of the Prism library as an int.
*/
#define PRISM_VERSION_MINOR 19
#define PRISM_VERSION_MINOR 20
/**
* The patch version of the Prism library as an int.
@ -24,6 +24,6 @@
/**
* The version of the Prism library as a constant string.
*/
#define PRISM_VERSION "0.19.0"
#define PRISM_VERSION "0.20.0"
#endif