[ruby/prism] Remove warnings check from parse_success? method

https://github.com/ruby/prism/commit/e30a241fb3
This commit is contained in:
Kevin Newton 2023-12-07 09:34:16 -05:00 committed by git
parent 8e86a4347e
commit 10bc0bd4ab
3 changed files with 8 additions and 12 deletions

View File

@ -68,7 +68,7 @@ module Prism
# :call-seq:
# Prism::parse_failure?(source, **options) -> bool
#
# Returns true if the source is invalid Ruby code.
# Returns true if the source parses with errors.
def self.parse_failure?(source, **options)
!parse_success?(source, **options)
end
@ -76,7 +76,7 @@ module Prism
# :call-seq:
# Prism::parse_file_failure?(filepath, **options) -> bool
#
# Returns true if the file at filepath is invalid Ruby code.
# Returns true if the file at filepath parses with errors.
def self.parse_file_failure?(filepath, **options)
!parse_file_success?(filepath, **options)
end

View File

@ -799,8 +799,7 @@ parse_lex_file(int argc, VALUE *argv, VALUE self) {
}
/**
* Parse the given input and return true if it parses without errors or
* warnings.
* Parse the given input and return true if it parses without errors.
*/
static VALUE
parse_input_success_p(pm_string_t *input, const pm_options_t *options) {
@ -810,7 +809,7 @@ parse_input_success_p(pm_string_t *input, const pm_options_t *options) {
pm_node_t *node = pm_parse(&parser);
pm_node_destroy(&parser, node);
VALUE result = parser.error_list.size == 0 && parser.warning_list.size == 0 ? Qtrue : Qfalse;
VALUE result = parser.error_list.size == 0 ? Qtrue : Qfalse;
pm_parser_free(&parser);
return result;
@ -820,8 +819,8 @@ parse_input_success_p(pm_string_t *input, const pm_options_t *options) {
* call-seq:
* Prism::parse_success?(source, **options) -> Array
*
* Parse the given string and return true if it parses without errors or
* warnings. For supported options, see Prism::parse.
* Parse the given string and return true if it parses without errors. For
* supported options, see Prism::parse.
*/
static VALUE
parse_success_p(int argc, VALUE *argv, VALUE self) {
@ -840,8 +839,8 @@ parse_success_p(int argc, VALUE *argv, VALUE self) {
* call-seq:
* Prism::parse_file_success?(filepath, **options) -> Array
*
* Parse the given file and return true if it parses without errors or warnings.
* For supported options, see Prism::parse.
* Parse the given file and return true if it parses without errors. For
* supported options, see Prism::parse.
*/
static VALUE
parse_file_success_p(int argc, VALUE *argv, VALUE self) {

View File

@ -23,9 +23,6 @@ module Prism
def test_parse_success?
assert Prism.parse_success?("1")
refute Prism.parse_success?("<>")
assert Prism.parse_success?("m //", verbose: false)
refute Prism.parse_success?("m //", verbose: true)
end
def test_parse_file_success?