summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-02-01 12:21:57 -0500
committerKevin Newton <kddnewton@gmail.com>2024-02-01 12:52:16 -0500
commite9f132446425089e8e732f68f49e10b3748c8684 (patch)
treeecd31d81617ab2e42283665cab29f2373cfed6e7
parentef427123ad51269fd5b45eeba327bd626e420974 (diff)
Sync to latest prism
-rw-r--r--lib/prism/ffi.rb3
-rw-r--r--lib/prism/prism.gemspec2
-rw-r--r--prism/extension.c6
-rw-r--r--prism/extension.h2
-rw-r--r--prism/options.c9
-rw-r--r--prism/options.h15
-rw-r--r--prism/parser.h7
-rw-r--r--prism/prism.c12
-rw-r--r--prism/templates/lib/prism/serialize.rb.erb2
-rw-r--r--prism/version.h4
10 files changed, 7 insertions, 55 deletions
diff --git a/lib/prism/ffi.rb b/lib/prism/ffi.rb
index 43f414504c..12177450f4 100644
--- a/lib/prism/ffi.rb
+++ b/lib/prism/ffi.rb
@@ -312,9 +312,6 @@ module Prism
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])
template << "L"
diff --git a/lib/prism/prism.gemspec b/lib/prism/prism.gemspec
index 80d5abcaef..65cfb74edd 100644
--- a/lib/prism/prism.gemspec
+++ b/lib/prism/prism.gemspec
@@ -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"]
diff --git a/prism/extension.c b/prism/extension.c
index 7467aa5709..e1fcfef20a 100644
--- a/prism/extension.c
+++ b/prism/extension.c
@@ -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");
diff --git a/prism/extension.h b/prism/extension.h
index a21370cfa4..08baad84b9 100644
--- a/prism/extension.h
+++ b/prism/extension.h
@@ -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>
diff --git a/prism/options.c b/prism/options.c
index 0dcae0d16f..4187abf9fa 100644
--- a/prism/options.c
+++ b/prism/options.c
@@ -33,14 +33,6 @@ pm_options_frozen_string_literal_set(pm_options_t *options, bool frozen_string_l
}
/**
- * 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.
* Otherwise, it returns true.
@@ -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);
diff --git a/prism/options.h b/prism/options.h
index 3e371d6666..e8e9646260 100644
--- a/prism/options.h
+++ b/prism/options.h
@@ -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;
/**
@@ -120,14 +113,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.
* Otherwise, it returns true.
diff --git a/prism/parser.h b/prism/parser.h
index 5079c59c5f..9a7ff53cd1 100644
--- a/prism/parser.h
+++ b/prism/parser.h
@@ -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
diff --git a/prism/prism.c b/prism/prism.c
index 9cc983ba34..12942704ec 100644
--- a/prism/prism.c
+++ b/prism/prism.c
@@ -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;
diff --git a/prism/templates/lib/prism/serialize.rb.erb b/prism/templates/lib/prism/serialize.rb.erb
index 62379fa149..5290df3c63 100644
--- a/prism/templates/lib/prism/serialize.rb.erb
+++ b/prism/templates/lib/prism/serialize.rb.erb
@@ -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.
diff --git a/prism/version.h b/prism/version.h
index 1472c58be6..8292aa424a 100644
--- a/prism/version.h
+++ b/prism/version.h
@@ -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