From 8675c453158a4e6447fcb3e970ff47a6d2b0d785 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Mon, 23 Mar 2026 10:07:13 -0400 Subject: [PATCH] Comments revisit --- .gitignore | 2 + config.yml | 413 +++ ext/prism/extension.c | 5 +- gemfiles/typecheck/Gemfile.lock | 3 +- include/prism/comments.h | 43 - include/prism/internal/comments.h | 15 + include/prism/internal/options.h | 7 + include/prism/internal/parser.h | 10 + include/prism/options.h | 16 + include/prism/parser.h | 10 + .../org/ruby_lang/prism/ParsingOptions.java | 3 + javascript/src/parsePrism.js | 5 + lib/prism.rb | 1 + lib/prism/ffi.rb | 3 + lib/prism/node_ext.rb | 4 +- lib/prism/parse_result.rb | 80 +- lib/prism/parse_result/comments.rb | 219 -- lib/prism/relocation.rb | 98 - lib/prism/translation/ruby_parser.rb | 57 +- prism.gemspec | 7 +- rakelib/check_manifest.rake | 1 + rbi/generated/prism/comments.rbi | 525 ++++ rbi/generated/prism/dsl.rbi | 2 +- rbi/generated/prism/node.rbi | 1848 ++++-------- rbi/generated/prism/parse_result.rbi | 42 +- rbi/generated/prism/parse_result/comments.rbi | 90 - rbi/generated/prism/relocation.rbi | 60 - rbi/generated/prism/serialize.rbi | 16 +- sample/prism/find_comments.rb | 100 - sig/generated/prism/comments.rbs | 465 +++ sig/generated/prism/dsl.rbs | 4 +- sig/generated/prism/node.rbs | 2025 ++++--------- sig/generated/prism/parse_result.rbs | 55 +- sig/generated/prism/parse_result/comments.rbs | 108 - sig/generated/prism/relocation.rbs | 74 - sig/generated/prism/serialize.rbs | 16 +- src/comments.c | 2590 +++++++++++++++++ src/options.c | 17 + src/prism.c | 19 + templates/ext/prism/api_node.c.erb | 100 +- templates/include/prism/ast.h.erb | 5 +- templates/include/prism/comments.h.erb | 99 + .../org/ruby_lang/prism/Loader.java.erb | 3 + templates/javascript/src/deserialize.js.erb | 3 + templates/lib/prism/comments.rb.erb | 33 + templates/lib/prism/dsl.rb.erb | 4 +- templates/lib/prism/node.rb.erb | 56 +- templates/lib/prism/serialize.rb.erb | 148 +- templates/src/json.c.erb | 1 + templates/src/node.c.erb | 1 + templates/src/prettyprint.c.erb | 3 +- templates/src/serialize.c.erb | 67 +- templates/template.rb | 71 +- test/prism/comments_test.rb | 2229 ++++++++++++++ test/prism/newline_test.rb | 1 + test/prism/result/comments_test.rb | 24 - test/prism/ruby/relocation_test.rb | 44 - test/prism/ruby/ruby_parser_test.rb | 10 + 58 files changed, 8199 insertions(+), 3761 deletions(-) delete mode 100644 include/prism/comments.h delete mode 100644 lib/prism/parse_result/comments.rb create mode 100644 rbi/generated/prism/comments.rbi delete mode 100644 rbi/generated/prism/parse_result/comments.rbi delete mode 100644 sample/prism/find_comments.rb create mode 100644 sig/generated/prism/comments.rbs delete mode 100644 sig/generated/prism/parse_result/comments.rbs create mode 100644 src/comments.c create mode 100644 templates/include/prism/comments.h.erb create mode 100644 templates/lib/prism/comments.rb.erb create mode 100644 test/prism/comments_test.rb diff --git a/.gitignore b/.gitignore index 0447b6ef70..ebb7b7bc74 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ out.svg /fuzz/output/ /gemfiles/typecheck/bin/ /include/prism/ast.h +/include/prism/comments.h /include/prism/internal/diagnostic.h /javascript/node_modules/ /javascript/package-lock.json @@ -43,6 +44,7 @@ out.svg /java/org/ruby_lang/prism/Loader.java /java/org/ruby_lang/prism/Nodes.java /java/wasm/src/main/wasm/prism.wasm +/lib/prism/comments.rb /lib/prism/compiler.rb /lib/prism/dispatcher.rb /lib/prism/dot_visitor.rb diff --git a/config.yml b/config.yml index bbbc5f3d33..7a9eb92c59 100644 --- a/config.yml +++ b/config.yml @@ -4738,3 +4738,416 @@ nodes: yield 1 ^^^^^^^ +comments: + - name: AliasMethodComments + comment: | + Comments for alias method nodes, which can have comments between the + two arguments. + + alias a + # comment + # comment + b + fields: + - name: gap_comments + type: list + comment: The comments in the gap between the two arguments. + - name: BinaryComments + comment: | + Comments for binary expressions like &&. Captures a comment trailing the + operator and any comments in the gap between the operator and the + right-hand side. + + a && # comment + # comment + b + fields: + - name: operator_comment + type: comment + comment: The comment trailing the operator. + - name: gap_comments + type: list + comment: The comments in the gap between the operator and the right-hand side. + - name: BodyComments + comment: | + Comments for nodes with a body delimited by a keyword and end, such as + begin, while, until, if, unless, and similar nodes. The opening comment + trails the keyword (or the last token on the opening line). + + begin # opening comment + bar + end # trailing comment + fields: + - name: opening_comment + type: comment + comment: The comment trailing the opening keyword. + - name: trailing_comment + type: comment + comment: The comment trailing the end keyword. + - name: CallComments + comment: | + Comments for call nodes with a call operator (e.g., dot or &.). + Captures a trailing comment, gap comments between the receiver and + operator, the operator comment, and gap comments between the operator + and the message. + + foo + # receiver gap comment + . # operator comment + # message gap comment + bar # trailing comment + fields: + - name: trailing_comment + type: comment + comment: The comment trailing the call. + - name: receiver_gap_comments + type: list + comment: The comments between the receiver and the call operator. + - name: operator_comment + type: comment + comment: The comment trailing the call operator. + - name: message_gap_comments + type: list + comment: The comments between the call operator and the message. + - name: CallWriteComments + comment: | + Comments for call-write nodes (e.g., foo.bar = 1, foo.bar += 1) which + have both a call operator and an assignment operator with potential + comments on each. + + foo. # call operator comment + # call gap comment + bar += # operator comment + # operator gap comment + 1 + fields: + - name: call_operator_comment + type: comment + comment: The comment trailing the call operator. + - name: call_gap_comments + type: list + comment: The comments between the call operator and the message. + - name: operator_comment + type: comment + comment: The comment trailing the assignment operator. + - name: operator_gap_comments + type: list + comment: The comments between the assignment operator and the value. + - name: CaseComments + comment: | + Comments for case/case-in nodes. Captures the comment on the case + keyword, comments between the keyword and predicate, comments between + the predicate and the first when/in clause, and the trailing comment + on end. + + case # keyword comment + # keyword gap comment + foo + # predicate gap comment + when bar + baz + end # trailing comment + fields: + - name: keyword_comment + type: comment + comment: The comment trailing the case keyword. + - name: keyword_gap_comments + type: list + comment: The comments between the case keyword and the predicate. + - name: predicate_gap_comments + type: list + comment: The comments between the predicate and the first when/in clause. + - name: trailing_comment + type: comment + comment: The comment trailing the end keyword. + - name: ClassComments + comment: | + Comments for class nodes, which can have comments on the class keyword, + in the gap between the keyword and the constant, on the inheritance + operator, in the gap between the operator and the superclass, and on + the end keyword. + + class # opening comment + # keyword gap comment + Foo < # inheritance operator comment + # inheritance gap comment + Bar + baz + end # trailing comment + fields: + - name: opening_comment + type: comment + comment: The comment trailing the class keyword. + - name: keyword_gap_comments + type: list + comment: The comments between the class keyword and the constant. + - name: inheritance_operator_comment + type: comment + comment: The comment trailing the inheritance operator. + - name: inheritance_gap_comments + type: list + comment: The comments between the inheritance operator and the superclass. + - name: trailing_comment + type: comment + comment: The comment trailing the end keyword. + - name: ClauseComments + comment: | + Comments for clause nodes such as when, in, rescue, else, and ensure + that have a single opening keyword. + + when foo # opening comment + fields: + - name: opening_comment + type: comment + comment: The comment trailing the opening keyword. + - name: CollectionComments + comment: | + Comments for collection nodes with opening and closing delimiters, + such as arrays, hashes, block parameters, and similar nodes. + + [ # opening comment + 1, 2, 3 + ] # closing comment + fields: + - name: opening_comment + type: comment + comment: The comment trailing the opening delimiter. + - name: closing_comment + type: comment + comment: The comment trailing the closing delimiter. + - name: DefComments + comment: | + Comments for def nodes, which can have comments on the def keyword, + in the gap between the keyword and the method name, the opening and + closing parentheses of the parameter list, and a trailing comment on + end. + + def # opening comment + # keyword gap comment + foo( # lparen comment + a, b + ) # rparen comment + bar + end # trailing comment + fields: + - name: opening_comment + type: comment + comment: The comment trailing the def keyword. + - name: keyword_gap_comments + type: list + comment: The comments between the def keyword and the method name. + - name: lparen_comment + type: comment + comment: The comment trailing the opening parenthesis. + - name: rparen_comment + type: comment + comment: The comment trailing the closing parenthesis. + - name: trailing_comment + type: comment + comment: The comment trailing the end keyword. + - name: EmbeddedStatementsComments + comment: | + Comments for embedded statements nodes (e.g., string interpolation). + + "foo #{ # opening comment + bar + }" + fields: + - name: opening_comment + type: comment + comment: The comment trailing the opening delimiter. + - name: EndlessDefComments + comment: | + Comments for endless def nodes (def foo = body), which can have + comments on the def keyword, in the gap between the keyword and the + method name, the parentheses, and the = operator. + + def # opening comment + # keyword gap comment + foo( # lparen comment + a + ) = # operator comment + bar + fields: + - name: opening_comment + type: comment + comment: The comment trailing the def keyword. + - name: keyword_gap_comments + type: list + comment: The comments between the def keyword and the method name. + - name: lparen_comment + type: comment + comment: The comment trailing the opening parenthesis. + - name: rparen_comment + type: comment + comment: The comment trailing the closing parenthesis. + - name: operator_comment + type: comment + comment: The comment trailing the = operator. + - name: FindPatternComments + comment: | + Comments for find pattern nodes (e.g., [*a, b, *c] in pattern matching), + which have opening and closing delimiters and gap comments around the + left and right splat operators. + + in [ # opening comment + # pre left gap comment + *a, b, + # post right gap comment + ] # closing comment + fields: + - name: opening_comment + type: comment + comment: The comment trailing the opening delimiter. + - name: closing_comment + type: comment + comment: The comment trailing the closing delimiter. + - name: pre_left_gap_comments + type: list + comment: The comments before the left splat operator. + - name: post_right_gap_comments + type: list + comment: The comments after the right splat operator. + - name: ForComments + comment: | + Comments for for loop nodes, which have for, in, and optionally do + keywords, each of which may have a trailing comment. + + for a in # in comment + b + do # do comment + c + end # trailing comment + fields: + - name: for_comment + type: comment + comment: The comment trailing the for keyword. + - name: in_comment + type: comment + comment: The comment trailing the in keyword. + - name: do_comment + type: comment + comment: The comment trailing the do keyword. + - name: trailing_comment + type: comment + comment: The comment trailing the end keyword. + - name: HashPatternComments + comment: | + Comments for hash pattern nodes (e.g., { a:, **b } in pattern matching), + which have opening and closing delimiters and gap comments after the + rest operator. + + in { a:, **b, + # post rest gap comment + } # closing comment + fields: + - name: opening_comment + type: comment + comment: The comment trailing the opening delimiter. + - name: closing_comment + type: comment + comment: The comment trailing the closing delimiter. + - name: post_rest_gap_comments + type: list + comment: The comments after the rest operator. + - name: KeywordCallComments + comment: | + Comments for keyword call nodes with parentheses, such as yield and + super. + + yield( # lparen comment + foo + ) # rparen comment + fields: + - name: lparen_comment + type: comment + comment: The comment trailing the opening parenthesis. + - name: rparen_comment + type: comment + comment: The comment trailing the closing parenthesis. + - name: LeafComments + comment: | + Comments for leaf nodes that can only have a trailing comment on the + same line (e.g., variable reads, literals, break/next/return keywords). + + foo # trailing comment + fields: + - name: trailing_comment + type: comment + comment: The comment trailing the node. + - name: LogicalKeywordComments + comment: | + Comments for logical keyword operators (and, or) which have comments + in the gaps before and after the keyword operator. + + a + # left gap comment + and # operator comment + # right gap comment + b + fields: + - name: operator_comment + type: comment + comment: The comment trailing the operator keyword. + - name: left_gap_comments + type: list + comment: The comments between the left operand and the operator. + - name: right_gap_comments + type: list + comment: The comments between the operator and the right operand. + - name: ModuleComments + comment: | + Comments for module nodes, which can have comments on the module keyword, + in the gap between the keyword and the constant, and on the end keyword. + + module # opening comment + # keyword gap comment + Foo + bar + end # trailing comment + fields: + - name: opening_comment + type: comment + comment: The comment trailing the module keyword. + - name: keyword_gap_comments + type: list + comment: The comments between the module keyword and the constant. + - name: trailing_comment + type: comment + comment: The comment trailing the end keyword. + - name: ParenthesizedComments + comment: | + Comments for nodes wrapped in parentheses, such as parenthesized + expressions or ternary if/unless with parenthesized predicates. + + ( # opening comment + # opening gap comment + foo + # closing gap comment + ) + fields: + - name: opening_comment + type: comment + comment: The comment trailing the opening parenthesis. + - name: opening_gap_comments + type: list + comment: The comments between the opening parenthesis and the body. + - name: closing_gap_comments + type: list + comment: The comments between the body and the closing parenthesis. + - name: PrefixComments + comment: | + Comments for prefix operator nodes (e.g., !, ~, not, splat, block + argument) where a comment can trail the operator and gap comments can + appear before the operand. + + ! # operator comment + # gap comment + foo + fields: + - name: operator_comment + type: comment + comment: The comment trailing the operator. + - name: gap_comments + type: list + comment: The comments between the operator and the operand. diff --git a/ext/prism/extension.c b/ext/prism/extension.c index 9f9169cfff..785739d292 100644 --- a/ext/prism/extension.c +++ b/ext/prism/extension.c @@ -31,6 +31,7 @@ VALUE rb_cPrismCurrentVersionError; VALUE rb_cPrismDebugEncoding; +ID rb_id_option_attach_comments; ID rb_id_option_command_line; ID rb_id_option_encoding; ID rb_id_option_filepath; @@ -233,6 +234,8 @@ build_options_i(VALUE key, VALUE value, VALUE argument) { if (!NIL_P(value)) pm_options_partial_script_set(options, RTEST(value)); } else if (key_id == rb_id_option_freeze) { if (!NIL_P(value)) pm_options_freeze_set(options, RTEST(value)); + } else if (key_id == rb_id_option_attach_comments) { + if (!NIL_P(value)) pm_options_attach_comments_set(options, RTEST(value)); } else { rb_raise(rb_eArgError, "unknown keyword: %" PRIsVALUE, key); } @@ -900,7 +903,6 @@ parse_input(const uint8_t *input, size_t input_length, const pm_options_t *optio if (freeze) { rb_obj_freeze(source); } - pm_parser_free(parser); pm_arena_free(arena); @@ -1437,6 +1439,7 @@ Init_prism(void) { // Intern all of the IDs eagerly that we support so that we don't have to do // it every time we parse. + rb_id_option_attach_comments = rb_intern_const("attach_comments"); rb_id_option_command_line = rb_intern_const("command_line"); rb_id_option_encoding = rb_intern_const("encoding"); rb_id_option_filepath = rb_intern_const("filepath"); diff --git a/gemfiles/typecheck/Gemfile.lock b/gemfiles/typecheck/Gemfile.lock index d7df041091..8d89b5658e 100644 --- a/gemfiles/typecheck/Gemfile.lock +++ b/gemfiles/typecheck/Gemfile.lock @@ -23,8 +23,7 @@ GEM csv (3.3.5) drb (2.2.3) erubi (1.13.1) - ffi (1.17.4-arm64-darwin) - ffi (1.17.4-x86_64-linux-gnu) + ffi (1.17.4) fileutils (1.8.0) i18n (1.14.7) concurrent-ruby (~> 1.0) diff --git a/include/prism/comments.h b/include/prism/comments.h deleted file mode 100644 index 2270d53889..0000000000 --- a/include/prism/comments.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @file comments.h - * - * Types and functions related to comments found during parsing. - */ -#ifndef PRISM_COMMENTS_H -#define PRISM_COMMENTS_H - -#include "prism/compiler/exported.h" -#include "prism/compiler/nodiscard.h" -#include "prism/compiler/nonnull.h" - -#include "prism/ast.h" - -#include - -/** This is the type of a comment that we've found while parsing. */ -typedef enum { - PM_COMMENT_INLINE, - PM_COMMENT_EMBDOC -} pm_comment_type_t; - -/** An opaque pointer to a comment found while parsing. */ -typedef struct pm_comment_t pm_comment_t; - -/** - * Returns the location associated with the given comment. - * - * @param comment the comment whose location we want to get - * @returns the location associated with the given comment - */ -PRISM_EXPORTED_FUNCTION pm_location_t pm_comment_location(const pm_comment_t *comment) PRISM_NONNULL(1); - -/** - * Returns the type associated with the given comment. - * - * @param comment the comment whose type we want to get - * @returns the type associated with the given comment. This can either be - * PM_COMMENT_INLINE or PM_COMMENT_EMBDOC. - */ -PRISM_EXPORTED_FUNCTION pm_comment_type_t pm_comment_type(const pm_comment_t *comment) PRISM_NONNULL(1); - -#endif diff --git a/include/prism/internal/comments.h b/include/prism/internal/comments.h index bb3039a658..ea12a2ad4e 100644 --- a/include/prism/internal/comments.h +++ b/include/prism/internal/comments.h @@ -2,6 +2,7 @@ #define PRISM_INTERNAL_COMMENTS_H #include "prism/comments.h" +#include "prism/parser.h" #include "prism/internal/list.h" @@ -17,4 +18,18 @@ struct pm_comment_t { pm_comment_type_t type; }; +/** + * The comment attachment map, storing pointers indexed by node_id. + */ +typedef struct { + const pm_comments_t **entries; + size_t size; +} pm_comments_map_t; + +/** + * Attach comments to the AST. This modifies the AST in place and populates the + * comment map on the parser. + */ +void pm_attach_comments(pm_parser_t *parser, pm_node_t *root); + #endif diff --git a/include/prism/internal/options.h b/include/prism/internal/options.h index 7e37742a8b..02da8cf632 100644 --- a/include/prism/internal/options.h +++ b/include/prism/internal/options.h @@ -135,6 +135,13 @@ struct pm_options_t { * between concurrency primitives. */ bool freeze; + + /* + * Whether or not the parser should attach comments to the AST nodes after + * parsing. When this is set to true, comments will be attached to the + * nearest relevant nodes in the tree. + */ + bool attach_comments; }; /* Free the internal memory associated with the options. */ diff --git a/include/prism/internal/parser.h b/include/prism/internal/parser.h index 3afe226757..1821c53571 100644 --- a/include/prism/internal/parser.h +++ b/include/prism/internal/parser.h @@ -4,6 +4,7 @@ #include "prism/compiler/accel.h" #include "prism/internal/arena.h" +#include "prism/internal/comments.h" #include "prism/internal/constant_pool.h" #include "prism/internal/encoding.h" #include "prism/internal/list.h" @@ -862,6 +863,9 @@ struct pm_parser_t { */ bool partial_script; + /** Whether to run comment attachment after parsing. */ + bool attach_comments; + /* Whether or not we're at the beginning of a command. */ bool command_start; @@ -939,6 +943,12 @@ struct pm_parser_t { uint64_t table[4]; } strpbrk_cache; #endif + + /** + * The comments map, populated by pm_parse when the attach_comments option + * is set. + */ + pm_comments_map_t *comments_map; }; /* diff --git a/include/prism/options.h b/include/prism/options.h index 1b6ff4af1f..8246eb43c4 100644 --- a/include/prism/options.h +++ b/include/prism/options.h @@ -249,6 +249,22 @@ PRISM_EXPORTED_FUNCTION bool pm_options_freeze(const pm_options_t *options) PRIS */ PRISM_EXPORTED_FUNCTION void pm_options_freeze_set(pm_options_t *options, bool freeze) PRISM_NONNULL(1); +/** + * Return the attach_comments option on the given options struct. + * + * @param options The options struct to read the attach_comments value from. + * @returns The attach_comments value. + */ +PRISM_EXPORTED_FUNCTION bool pm_options_attach_comments(const pm_options_t *options) PRISM_NONNULL(1); + +/** + * Set the attach_comments option on the given options struct. + * + * @param options The options struct to set the attach_comments value on. + * @param attach_comments The attach_comments value to set. + */ +PRISM_EXPORTED_FUNCTION void pm_options_attach_comments_set(pm_options_t *options, bool attach_comments) PRISM_NONNULL(1); + /** * Allocate and zero out the scopes array on the given options struct. * diff --git a/include/prism/parser.h b/include/prism/parser.h index 2c8c4b3a7a..78328b82a2 100644 --- a/include/prism/parser.h +++ b/include/prism/parser.h @@ -337,6 +337,16 @@ PRISM_EXPORTED_FUNCTION void pm_parser_constants_each(const pm_parser_t *parser, */ PRISM_EXPORTED_FUNCTION const pm_constant_t * pm_parser_constant(const pm_parser_t *parser, pm_constant_id_t constant_id) PRISM_NONNULL(1); +/** + * Returns the comments object for the given node_id, or NULL if the node has no + * attached comments or comment attachment was not requested. + * + * @param parser the parser to query + * @param node_id the node_id to look up + * @returns the comments object for the given node_id, or NULL + */ +PRISM_EXPORTED_FUNCTION const pm_comments_t *pm_parser_comments(const pm_parser_t *parser, uint32_t node_id) PRISM_NONNULL(1); + /** * Initiate the parser with the given parser. * diff --git a/java/api/src/main/java/org/ruby_lang/prism/ParsingOptions.java b/java/api/src/main/java/org/ruby_lang/prism/ParsingOptions.java index c702e3c7b3..e43431f12e 100644 --- a/java/api/src/main/java/org/ruby_lang/prism/ParsingOptions.java +++ b/java/api/src/main/java/org/ruby_lang/prism/ParsingOptions.java @@ -151,6 +151,9 @@ public static byte[] serialize(byte[] filepath, int line, byte[] encoding, boole // freeze output.write(0); + // attach_comments + output.write(0); + // scopes // number of scopes diff --git a/javascript/src/parsePrism.js b/javascript/src/parsePrism.js index 615cc83d13..df90ec9078 100644 --- a/javascript/src/parsePrism.js +++ b/javascript/src/parsePrism.js @@ -160,6 +160,11 @@ function dumpOptions(options) { template.push("C"); values.push(dumpBooleanOption(options.partial_script)); + // freeze + template.push("C"); + values.push(0); + + // attach_comments template.push("C"); values.push(0); diff --git a/lib/prism.rb b/lib/prism.rb index 8f0342724a..2cf4d1c216 100644 --- a/lib/prism.rb +++ b/lib/prism.rb @@ -124,6 +124,7 @@ def self.find(callable, rubyvm: !!defined?(RubyVM)) require_relative "prism/polyfill/byteindex" require_relative "prism/polyfill/warn" +require_relative "prism/comments" require_relative "prism/node" require_relative "prism/node_ext" require_relative "prism/parse_result" diff --git a/lib/prism/ffi.rb b/lib/prism/ffi.rb index 6b9bde51ea..a060b19e9f 100644 --- a/lib/prism/ffi.rb +++ b/lib/prism/ffi.rb @@ -524,6 +524,9 @@ def dump_options(options) template << "C" values << (options.fetch(:freeze, false) ? 1 : 0) + template << "C" + values << (options.fetch(:attach_comments, false) ? 1 : 0) + template << "L" if (scopes = options[:scopes]) values << scopes.length diff --git a/lib/prism/node_ext.rb b/lib/prism/node_ext.rb index 8a6624e76d..6561ba8f3a 100644 --- a/lib/prism/node_ext.rb +++ b/lib/prism/node_ext.rb @@ -126,6 +126,7 @@ def to_interpolated -1, location, frozen? ? InterpolatedStringNodeFlags::FROZEN : 0, + nil, opening_loc, [copy(location: content_loc, opening_loc: nil, closing_loc: nil)], closing_loc @@ -151,8 +152,9 @@ def to_interpolated -1, location, flags, + nil, opening_loc, - [StringNode.new(source, node_id, content_loc, 0, nil, content_loc, nil, unescaped)], + [StringNode.new(source, node_id, content_loc, 0, nil, nil, content_loc, nil, unescaped)], closing_loc ) end diff --git a/lib/prism/parse_result.rb b/lib/prism/parse_result.rb index 4f7bcf07d6..065088ce36 100644 --- a/lib/prism/parse_result.rb +++ b/lib/prism/parse_result.rb @@ -392,9 +392,6 @@ class Location # The length of this location in bytes. attr_reader :length #: Integer - # @rbs @leading_comments: Array[Comment]? - # @rbs @trailing_comments: Array[Comment]? - # Create a new location object with the given source, start byte offset, and # byte length. #-- @@ -403,50 +400,6 @@ def initialize(source, start_offset, length) @source = source @start_offset = start_offset @length = length - - # These are used to store comments that are associated with this location. - # They are initialized to `nil` to save on memory when there are no - # comments to be attached and/or the comment-related APIs are not used. - @leading_comments = nil - @trailing_comments = nil - end - - # These are the comments that are associated with this location that exist - # before the start of this location. - #-- - #: () -> Array[Comment] - def leading_comments - @leading_comments ||= [] - end - - # Attach a comment to the leading comments of this location. - #-- - #: (Comment comment) -> void - def leading_comment(comment) - leading_comments << comment - end - - # These are the comments that are associated with this location that exist - # after the end of this location. - #-- - #: () -> Array[Comment] - def trailing_comments - @trailing_comments ||= [] - end - - # Attach a comment to the trailing comments of this location. - #-- - #: (Comment comment) -> void - def trailing_comment(comment) - trailing_comments << comment - end - - # Returns all comments that are associated with this location (both leading - # and trailing comments). - #-- - #: () -> Array[Comment] - def comments - [*@leading_comments, *@trailing_comments] #: Array[Comment] end # Create a new location object with the given options. @@ -697,6 +650,30 @@ def initialize(location) @location = location end + # Returns a symbol representing the type of this node, for compatibility + # when comments are interleaved into node arrays. + #-- + #: () -> Symbol + def type + :comment + end + + # Returns the byte offset from the beginning of the source where this + # comment starts. + #-- + #: () -> Integer + def start_offset + location.start_offset + end + + # Returns the byte offset from the beginning of the source where this + # comment ends. + #-- + #: () -> Integer + def end_offset + location.end_offset + end + # Implement the hash pattern matching interface for Comment. #-- #: (Array[Symbol]? keys) -> Hash[Symbol, untyped] @@ -986,11 +963,9 @@ def code_units_cache(encoding) # This is a result specific to the `parse` and `parse_file` methods. class ParseResult < Result - autoload :Comments, "prism/parse_result/comments" autoload :Errors, "prism/parse_result/errors" autoload :Newlines, "prism/parse_result/newlines" - private_constant :Comments private_constant :Errors private_constant :Newlines @@ -1012,13 +987,6 @@ def deconstruct_keys(keys) # :nodoc: super.merge!(value: value) end - # Attach the list of comments to their respective locations in the tree. - #-- - #: () -> void - def attach_comments! - Comments.new(self).attach! # steep:ignore - end - # Walk the tree and mark nodes that are on a new line, loosely emulating # the behavior of CRuby's `:line` tracepoint event. #-- diff --git a/lib/prism/parse_result/comments.rb b/lib/prism/parse_result/comments.rb deleted file mode 100644 index df80792d39..0000000000 --- a/lib/prism/parse_result/comments.rb +++ /dev/null @@ -1,219 +0,0 @@ -# frozen_string_literal: true -# :markup: markdown -#-- -# rbs_inline: enabled - -module Prism - class ParseResult < Result - # When we've parsed the source, we have both the syntax tree and the list of - # comments that we found in the source. This class is responsible for - # walking the tree and finding the nearest location to attach each comment. - # - # It does this by first finding the nearest locations to each comment. - # Locations can either come from nodes directly or from location fields on - # nodes. For example, a `ClassNode` has an overall location encompassing the - # entire class, but it also has a location for the `class` keyword. - # - # Once the nearest locations are found, it determines which one to attach - # to. If it's a trailing comment (a comment on the same line as other source - # code), it will favor attaching to the nearest location that occurs before - # the comment. Otherwise it will favor attaching to the nearest location - # that is after the comment. - class Comments - # @rbs! - # # An internal interface for a target that comments can be attached - # # to. This is either going to be a NodeTarget or a CommentTarget. - # interface _CommentTarget - # def start_offset: () -> Integer - # def end_offset: () -> Integer - # def encloses?: (Comment) -> bool - # def leading_comment: (Comment) -> void - # def trailing_comment: (Comment) -> void - # end - - # A target for attaching comments that is based on a specific node's - # location. - class NodeTarget # :nodoc: - attr_reader :node #: node - - #: (node node) -> void - def initialize(node) - @node = node - end - - #: () -> Integer - def start_offset - node.start_offset - end - - #: () -> Integer - def end_offset - node.end_offset - end - - #: (Comment comment) -> bool - def encloses?(comment) - start_offset <= comment.location.start_offset && - comment.location.end_offset <= end_offset - end - - #: (Comment comment) -> void - def leading_comment(comment) - node.location.leading_comment(comment) - end - - #: (Comment comment) -> void - def trailing_comment(comment) - node.location.trailing_comment(comment) - end - end - - # A target for attaching comments that is based on a location field on a - # node. For example, the `end` token of a ClassNode. - class LocationTarget # :nodoc: - attr_reader :location #: Location - - #: (Location location) -> void - def initialize(location) - @location = location - end - - #: () -> Integer - def start_offset - location.start_offset - end - - #: () -> Integer - def end_offset - location.end_offset - end - - #: (Comment comment) -> bool - def encloses?(comment) - false - end - - #: (Comment comment) -> void - def leading_comment(comment) - location.leading_comment(comment) - end - - #: (Comment comment) -> void - def trailing_comment(comment) - location.trailing_comment(comment) - end - end - - # The parse result that we are attaching comments to. - attr_reader :parse_result #: ParseResult - - # Create a new Comments object that will attach comments to the given - # parse result. - #-- - #: (ParseResult parse_result) -> void - def initialize(parse_result) - @parse_result = parse_result - end - - # Attach the comments to their respective locations in the tree by - # mutating the parse result. - #-- - #: () -> void - def attach! - parse_result.comments.each do |comment| - preceding, enclosing, following = nearest_targets(parse_result.value, comment) - - if comment.trailing? - if preceding - preceding.trailing_comment(comment) - else - (following || enclosing || NodeTarget.new(parse_result.value)).leading_comment(comment) - end - else - # If a comment exists on its own line, prefer a leading comment. - if following - following.leading_comment(comment) - elsif preceding - preceding.trailing_comment(comment) - else - (enclosing || NodeTarget.new(parse_result.value)).leading_comment(comment) - end - end - end - end - - private - - # Responsible for finding the nearest targets to the given comment within - # the context of the given encapsulating node. - #-- - #: (node node, Comment comment) -> [_CommentTarget?, _CommentTarget?, _CommentTarget?] - def nearest_targets(node, comment) - comment_start = comment.location.start_offset - comment_end = comment.location.end_offset - - targets = [] #: Array[_CommentTarget] - node.comment_targets.map do |value| - case value - when StatementsNode - targets.concat(value.body.map { |node| NodeTarget.new(node) }) - when Node - targets << NodeTarget.new(value) - when Location - targets << LocationTarget.new(value) - end - end - - targets.sort_by!(&:start_offset) - preceding = nil #: _CommentTarget? - following = nil #: _CommentTarget? - - left = 0 - right = targets.length - - # This is a custom binary search that finds the nearest nodes to the - # given comment. When it finds a node that completely encapsulates the - # comment, it recurses downward into the tree. - while left < right - middle = (left + right) / 2 - target = targets[middle] - - target_start = target.start_offset - target_end = target.end_offset - - if target.encloses?(comment) - # @type var target: NodeTarget - # The comment is completely contained by this target. Abandon the - # binary search at this level. - return nearest_targets(target.node, comment) - end - - if target_end <= comment_start - # This target falls completely before the comment. Because we will - # never consider this target or any targets before it again, this - # target must be the closest preceding target we have encountered so - # far. - preceding = target - left = middle + 1 - next - end - - if comment_end <= target_start - # This target falls completely after the comment. Because we will - # never consider this target or any targets after it again, this - # target must be the closest following target we have encountered so - # far. - following = target - right = middle - next - end - - # This should only happen if there is a bug in this parser. - raise "Comment location overlaps with a target location" - end - - [preceding, NodeTarget.new(node), following] - end - end - end -end diff --git a/lib/prism/relocation.rb b/lib/prism/relocation.rb index af0f792827..2b395920e7 100644 --- a/lib/prism/relocation.rb +++ b/lib/prism/relocation.rb @@ -33,8 +33,6 @@ module Relocation # def end_character_column: () -> Integer # def cached_start_code_units_column: (_CodeUnitsCache cache) -> Integer # def cached_end_code_units_column: (_CodeUnitsCache cache) -> Integer - # def leading_comments: () -> Array[Comment] - # def trailing_comments: () -> Array[Comment] # end # # interface _Field @@ -170,27 +168,6 @@ def end_code_units_column fetch_value(:end_code_units_column) end - # Fetch the leading comments of the value. - #-- - #: () -> Array[CommentsField::Comment] - def leading_comments - fetch_value(:leading_comments) - end - - # Fetch the trailing comments of the value. - #-- - #: () -> Array[CommentsField::Comment] - def trailing_comments - fetch_value(:trailing_comments) - end - - # Fetch the leading and trailing comments of the value. - #-- - #: () -> Array[CommentsField::Comment] - def comments - [*leading_comments, *trailing_comments] - end - # Reify the values on this entry with the given values. This is an # internal-only API that is called from the repository when it is time to # reify the values. @@ -427,51 +404,6 @@ def cache end end - # An abstract field used as the parent class of the two comments fields. - class CommentsField - # An object that represents a slice of a comment. - class Comment - # The slice of the comment. - attr_reader :slice #: String - - # Initialize a new comment with the given slice. - # - #: (String slice) -> void - def initialize(slice) - @slice = slice - end - end - - private - - # Create comment objects from the given values. - #-- - #: (entry_value values) -> Array[Comment] - def comments(values) - values.map { |value| Comment.new(value.slice) } - end - end - - # A field representing the leading comments. - class LeadingCommentsField < CommentsField - # Fetches the leading comments of a value. - #-- - #: (_Value value) -> entry_values - def fields(value) - { leading_comments: comments(value.leading_comments) } - end - end - - # A field representing the trailing comments. - class TrailingCommentsField < CommentsField - # Fetches the trailing comments of a value. - #-- - #: (_Value value) -> entry_values - def fields(value) - { trailing_comments: comments(value.trailing_comments) } - end - end - # A repository is a configured collection of fields and a set of entries # that knows how to reparse a source and reify the values. class Repository @@ -567,30 +499,6 @@ def code_unit_columns(encoding) field(:code_unit_columns, CodeUnitColumnsField.new(self, encoding)) end - # Configure the leading comments field for this repository and return - # self. - #-- - #: () -> self - def leading_comments - field(:leading_comments, LeadingCommentsField.new) - end - - # Configure the trailing comments field for this repository and return - # self. - #-- - #: () -> self - def trailing_comments - field(:trailing_comments, TrailingCommentsField.new) - end - - # Configure both the leading and trailing comment fields for this - # repository and return self. - #-- - #: () -> self - def comments - leading_comments.trailing_comments - end - # This method is called from nodes and locations when they want to enter # themselves into the repository. It it internal-only and meant to be # called from the #save* APIs. @@ -610,12 +518,6 @@ def enter(node_id, field_name) # :nodoc: def reify! # :nodoc: result = source.result - # Attach the comments if they have been requested as part of the - # configuration of this repository. - if fields.key?(:leading_comments) || fields.key?(:trailing_comments) - result.attach_comments! - end - queue = [result.value] #: Array[Prism::node] while (node = queue.shift) @entries[node.node_id].each do |field_name, entry| diff --git a/lib/prism/translation/ruby_parser.rb b/lib/prism/translation/ruby_parser.rb index d2246042ed..f113e39129 100644 --- a/lib/prism/translation/ruby_parser.rb +++ b/lib/prism/translation/ruby_parser.rb @@ -33,11 +33,19 @@ class Compiler < ::Prism::Compiler # :nodoc: # pattern, so we need to track that state. attr_reader :in_pattern + # The list of comments from the parse result, sorted by start offset. + attr_reader :parse_comments + + # The source string being compiled. + attr_reader :source_string + # Initialize a new compiler with the given file name. - def initialize(file, in_def: false, in_pattern: false) + def initialize(file, in_def: false, in_pattern: false, parse_comments: [], source_string: "") @file = file @in_def = in_def @in_pattern = in_pattern + @parse_comments = parse_comments + @source_string = source_string end # alias foo bar @@ -1559,20 +1567,48 @@ def visit_yield_node(node) private - # Attach prism comments to the given sexp. + # Attach leading comments to the given sexp, mirroring ruby_parser's + # behavior: all comments preceding the class/module/def keyword are + # attached as long as no source code appears between the last comment + # and the keyword. Blank lines between comments are preserved. def attach_comments(sexp, node) - return unless node.comments - return if node.comments.empty? + node_start = node.location.start_offset + leading = [] + + parse_comments.each do |comment| + if comment.location.start_offset < node_start + leading << comment + end + end + + return if leading.empty? + + # Walk backwards and drop comments that have source code between + # them and the node (or between them and the next kept comment). + result = [] + boundary = node_start + + leading.reverse_each do |comment| + gap = source_string[comment.location.end_offset...boundary] + + if gap.match?(/\S/) + break + end + + result.unshift(comment) + boundary = comment.location.start_offset + end + + return if result.empty? - extra = node.location.start_line - node.comments.last.location.start_line - comments = node.comments.map(&:slice) - comments.concat([nil] * [0, extra].max) - sexp.comments = comments.join("\n") + # Build the comment string from the first comment through to the + # keyword, preserving blank lines (mirroring ruby_parser's lexer). + sexp.comments = source_string[result.first.location.start_offset...node_start].gsub(/^ +#/, "#").gsub(/^ +$/, "") end # Create a new compiler with the given options. def copy_compiler(in_def: self.in_def, in_pattern: self.in_pattern) - Compiler.new(file, in_def: in_def, in_pattern: in_pattern) + Compiler.new(file, in_def: in_def, in_pattern: in_pattern, parse_comments: parse_comments, source_string: source_string) end # Create a new Sexp object from the given prism node and arguments. @@ -1680,8 +1716,7 @@ def translate(result, filepath) raise ::RubyParser::SyntaxError, "#{filepath}:#{error.location.start_line} :: #{error.message}" end - result.attach_comments! - result.value.accept(Compiler.new(filepath)) + result.value.accept(Compiler.new(filepath, parse_comments: result.comments, source_string: result.source.source)) end end end diff --git a/prism.gemspec b/prism.gemspec index aac056b3f8..4b604a7a14 100644 --- a/prism.gemspec +++ b/prism.gemspec @@ -107,6 +107,7 @@ Gem::Specification.new do |spec| "include/prism/stringy.h", "include/prism/version.h", "lib/prism.rb", + "lib/prism/comments.rb", "lib/prism/compiler.rb", "lib/prism/desugar_compiler.rb", "lib/prism/dispatcher.rb", @@ -120,7 +121,6 @@ Gem::Specification.new do |spec| "lib/prism/node_find.rb", "lib/prism/node.rb", "lib/prism/parse_result.rb", - "lib/prism/parse_result/comments.rb", "lib/prism/parse_result/errors.rb", "lib/prism/parse_result/newlines.rb", "lib/prism/pattern.rb", @@ -149,6 +149,7 @@ Gem::Specification.new do |spec| "lib/prism/visitor.rb", "prism.gemspec", "rbi/generated/prism.rbi", + "rbi/generated/prism/comments.rbi", "rbi/generated/prism/compiler.rbi", "rbi/generated/prism/desugar_compiler.rbi", "rbi/generated/prism/dispatcher.rbi", @@ -168,7 +169,6 @@ Gem::Specification.new do |spec| "rbi/generated/prism/string_query.rbi", "rbi/generated/prism/translation.rbi", "rbi/generated/prism/visitor.rbi", - "rbi/generated/prism/parse_result/comments.rbi", "rbi/generated/prism/parse_result/errors.rbi", "rbi/generated/prism/parse_result/newlines.rbi", "rbi/prism/translation/parser.rbi", @@ -176,6 +176,7 @@ Gem::Specification.new do |spec| "rbi/prism/translation/ripper.rbi", "rbi/rubyvm/node_find.rbi", "sig/generated/prism.rbs", + "sig/generated/prism/comments.rbs", "sig/generated/prism/compiler.rbs", "sig/generated/prism/desugar_compiler.rbs", "sig/generated/prism/dispatcher.rbs", @@ -195,12 +196,12 @@ Gem::Specification.new do |spec| "sig/generated/prism/string_query.rbs", "sig/generated/prism/translation.rbs", "sig/generated/prism/visitor.rbs", - "sig/generated/prism/parse_result/comments.rbs", "sig/generated/prism/parse_result/errors.rbs", "sig/generated/prism/parse_result/newlines.rbs", "src/arena.c", "src/buffer.c", "src/char.c", + "src/comments.c", "src/constant_pool.c", "src/diagnostic.c", "src/encoding.c", diff --git a/rakelib/check_manifest.rake b/rakelib/check_manifest.rake index 4c53b963ec..185f643851 100644 --- a/rakelib/check_manifest.rake +++ b/rakelib/check_manifest.rake @@ -4,6 +4,7 @@ task check_manifest: :templates do ignore_directories = %w[ .bundle + .claude .idea .git .github diff --git a/rbi/generated/prism/comments.rbi b/rbi/generated/prism/comments.rbi new file mode 100644 index 0000000000..82f2a884b0 --- /dev/null +++ b/rbi/generated/prism/comments.rbi @@ -0,0 +1,525 @@ +# typed: true + +module Prism + # The module containing definitions of all of the various comment attachment + # objects. + module Comments + # The base class for all comment attachment types. + class Base; end + + # Comments for alias method nodes, which can have comments between the + # two arguments. + # + # alias a + # # comment + # # comment + # b + class AliasMethodComments < Base + # The comments in the gap between the two arguments. + sig { returns(T::Array[Comment]) } + attr_reader :gap_comments + + sig { params(gap_comments: T::Array[Comment]).void } + def initialize(gap_comments); end + end + + # Comments for binary expressions like &&. Captures a comment trailing the + # operator and any comments in the gap between the operator and the + # right-hand side. + # + # a && # comment + # # comment + # b + class BinaryComments < Base + # The comment trailing the operator. + sig { returns(::T.nilable(Comment)) } + attr_reader :operator_comment + + # The comments in the gap between the operator and the right-hand side. + sig { returns(T::Array[Comment]) } + attr_reader :gap_comments + + sig { params(operator_comment: ::T.nilable(Comment), gap_comments: T::Array[Comment]).void } + def initialize(operator_comment, gap_comments); end + end + + # Comments for nodes with a body delimited by a keyword and end, such as + # begin, while, until, if, unless, and similar nodes. The opening comment + # trails the keyword (or the last token on the opening line). + # + # begin # opening comment + # bar + # end # trailing comment + class BodyComments < Base + # The comment trailing the opening keyword. + sig { returns(::T.nilable(Comment)) } + attr_reader :opening_comment + + # The comment trailing the end keyword. + sig { returns(::T.nilable(Comment)) } + attr_reader :trailing_comment + + sig { params(opening_comment: ::T.nilable(Comment), trailing_comment: ::T.nilable(Comment)).void } + def initialize(opening_comment, trailing_comment); end + end + + # Comments for call nodes with a call operator (e.g., dot or &.). + # Captures a trailing comment, gap comments between the receiver and + # operator, the operator comment, and gap comments between the operator + # and the message. + # + # foo + # # receiver gap comment + # . # operator comment + # # message gap comment + # bar # trailing comment + class CallComments < Base + # The comment trailing the call. + sig { returns(::T.nilable(Comment)) } + attr_reader :trailing_comment + + # The comments between the receiver and the call operator. + sig { returns(T::Array[Comment]) } + attr_reader :receiver_gap_comments + + # The comment trailing the call operator. + sig { returns(::T.nilable(Comment)) } + attr_reader :operator_comment + + # The comments between the call operator and the message. + sig { returns(T::Array[Comment]) } + attr_reader :message_gap_comments + + sig { params(trailing_comment: ::T.nilable(Comment), receiver_gap_comments: T::Array[Comment], operator_comment: ::T.nilable(Comment), message_gap_comments: T::Array[Comment]).void } + def initialize(trailing_comment, receiver_gap_comments, operator_comment, message_gap_comments); end + end + + # Comments for call-write nodes (e.g., foo.bar = 1, foo.bar += 1) which + # have both a call operator and an assignment operator with potential + # comments on each. + # + # foo. # call operator comment + # # call gap comment + # bar += # operator comment + # # operator gap comment + # 1 + class CallWriteComments < Base + # The comment trailing the call operator. + sig { returns(::T.nilable(Comment)) } + attr_reader :call_operator_comment + + # The comments between the call operator and the message. + sig { returns(T::Array[Comment]) } + attr_reader :call_gap_comments + + # The comment trailing the assignment operator. + sig { returns(::T.nilable(Comment)) } + attr_reader :operator_comment + + # The comments between the assignment operator and the value. + sig { returns(T::Array[Comment]) } + attr_reader :operator_gap_comments + + sig { params(call_operator_comment: ::T.nilable(Comment), call_gap_comments: T::Array[Comment], operator_comment: ::T.nilable(Comment), operator_gap_comments: T::Array[Comment]).void } + def initialize(call_operator_comment, call_gap_comments, operator_comment, operator_gap_comments); end + end + + # Comments for case/case-in nodes. Captures the comment on the case + # keyword, comments between the keyword and predicate, comments between + # the predicate and the first when/in clause, and the trailing comment + # on end. + # + # case # keyword comment + # # keyword gap comment + # foo + # # predicate gap comment + # when bar + # baz + # end # trailing comment + class CaseComments < Base + # The comment trailing the case keyword. + sig { returns(::T.nilable(Comment)) } + attr_reader :keyword_comment + + # The comments between the case keyword and the predicate. + sig { returns(T::Array[Comment]) } + attr_reader :keyword_gap_comments + + # The comments between the predicate and the first when/in clause. + sig { returns(T::Array[Comment]) } + attr_reader :predicate_gap_comments + + # The comment trailing the end keyword. + sig { returns(::T.nilable(Comment)) } + attr_reader :trailing_comment + + sig { params(keyword_comment: ::T.nilable(Comment), keyword_gap_comments: T::Array[Comment], predicate_gap_comments: T::Array[Comment], trailing_comment: ::T.nilable(Comment)).void } + def initialize(keyword_comment, keyword_gap_comments, predicate_gap_comments, trailing_comment); end + end + + # Comments for class nodes, which can have comments on the class keyword, + # in the gap between the keyword and the constant, on the inheritance + # operator, in the gap between the operator and the superclass, and on + # the end keyword. + # + # class # opening comment + # # keyword gap comment + # Foo < # inheritance operator comment + # # inheritance gap comment + # Bar + # baz + # end # trailing comment + class ClassComments < Base + # The comment trailing the class keyword. + sig { returns(::T.nilable(Comment)) } + attr_reader :opening_comment + + # The comments between the class keyword and the constant. + sig { returns(T::Array[Comment]) } + attr_reader :keyword_gap_comments + + # The comment trailing the inheritance operator. + sig { returns(::T.nilable(Comment)) } + attr_reader :inheritance_operator_comment + + # The comments between the inheritance operator and the superclass. + sig { returns(T::Array[Comment]) } + attr_reader :inheritance_gap_comments + + # The comment trailing the end keyword. + sig { returns(::T.nilable(Comment)) } + attr_reader :trailing_comment + + sig { params(opening_comment: ::T.nilable(Comment), keyword_gap_comments: T::Array[Comment], inheritance_operator_comment: ::T.nilable(Comment), inheritance_gap_comments: T::Array[Comment], trailing_comment: ::T.nilable(Comment)).void } + def initialize(opening_comment, keyword_gap_comments, inheritance_operator_comment, inheritance_gap_comments, trailing_comment); end + end + + # Comments for clause nodes such as when, in, rescue, else, and ensure + # that have a single opening keyword. + # + # when foo # opening comment + class ClauseComments < Base + # The comment trailing the opening keyword. + sig { returns(::T.nilable(Comment)) } + attr_reader :opening_comment + + sig { params(opening_comment: ::T.nilable(Comment)).void } + def initialize(opening_comment); end + end + + # Comments for collection nodes with opening and closing delimiters, + # such as arrays, hashes, block parameters, and similar nodes. + # + # [ # opening comment + # 1, 2, 3 + # ] # closing comment + class CollectionComments < Base + # The comment trailing the opening delimiter. + sig { returns(::T.nilable(Comment)) } + attr_reader :opening_comment + + # The comment trailing the closing delimiter. + sig { returns(::T.nilable(Comment)) } + attr_reader :closing_comment + + sig { params(opening_comment: ::T.nilable(Comment), closing_comment: ::T.nilable(Comment)).void } + def initialize(opening_comment, closing_comment); end + end + + # Comments for def nodes, which can have comments on the def keyword, + # in the gap between the keyword and the method name, the opening and + # closing parentheses of the parameter list, and a trailing comment on + # end. + # + # def # opening comment + # # keyword gap comment + # foo( # lparen comment + # a, b + # ) # rparen comment + # bar + # end # trailing comment + class DefComments < Base + # The comment trailing the def keyword. + sig { returns(::T.nilable(Comment)) } + attr_reader :opening_comment + + # The comments between the def keyword and the method name. + sig { returns(T::Array[Comment]) } + attr_reader :keyword_gap_comments + + # The comment trailing the opening parenthesis. + sig { returns(::T.nilable(Comment)) } + attr_reader :lparen_comment + + # The comment trailing the closing parenthesis. + sig { returns(::T.nilable(Comment)) } + attr_reader :rparen_comment + + # The comment trailing the end keyword. + sig { returns(::T.nilable(Comment)) } + attr_reader :trailing_comment + + sig { params(opening_comment: ::T.nilable(Comment), keyword_gap_comments: T::Array[Comment], lparen_comment: ::T.nilable(Comment), rparen_comment: ::T.nilable(Comment), trailing_comment: ::T.nilable(Comment)).void } + def initialize(opening_comment, keyword_gap_comments, lparen_comment, rparen_comment, trailing_comment); end + end + + # Comments for embedded statements nodes (e.g., string interpolation). + # + # "foo #{ # opening comment + # bar + # }" + class EmbeddedStatementsComments < Base + # The comment trailing the opening delimiter. + sig { returns(::T.nilable(Comment)) } + attr_reader :opening_comment + + sig { params(opening_comment: ::T.nilable(Comment)).void } + def initialize(opening_comment); end + end + + # Comments for endless def nodes (def foo = body), which can have + # comments on the def keyword, in the gap between the keyword and the + # method name, the parentheses, and the = operator. + # + # def # opening comment + # # keyword gap comment + # foo( # lparen comment + # a + # ) = # operator comment + # bar + class EndlessDefComments < Base + # The comment trailing the def keyword. + sig { returns(::T.nilable(Comment)) } + attr_reader :opening_comment + + # The comments between the def keyword and the method name. + sig { returns(T::Array[Comment]) } + attr_reader :keyword_gap_comments + + # The comment trailing the opening parenthesis. + sig { returns(::T.nilable(Comment)) } + attr_reader :lparen_comment + + # The comment trailing the closing parenthesis. + sig { returns(::T.nilable(Comment)) } + attr_reader :rparen_comment + + # The comment trailing the = operator. + sig { returns(::T.nilable(Comment)) } + attr_reader :operator_comment + + sig { params(opening_comment: ::T.nilable(Comment), keyword_gap_comments: T::Array[Comment], lparen_comment: ::T.nilable(Comment), rparen_comment: ::T.nilable(Comment), operator_comment: ::T.nilable(Comment)).void } + def initialize(opening_comment, keyword_gap_comments, lparen_comment, rparen_comment, operator_comment); end + end + + # Comments for find pattern nodes (e.g., [*a, b, *c] in pattern matching), + # which have opening and closing delimiters and gap comments around the + # left and right splat operators. + # + # in [ # opening comment + # # pre left gap comment + # *a, b, + # # post right gap comment + # ] # closing comment + class FindPatternComments < Base + # The comment trailing the opening delimiter. + sig { returns(::T.nilable(Comment)) } + attr_reader :opening_comment + + # The comment trailing the closing delimiter. + sig { returns(::T.nilable(Comment)) } + attr_reader :closing_comment + + # The comments before the left splat operator. + sig { returns(T::Array[Comment]) } + attr_reader :pre_left_gap_comments + + # The comments after the right splat operator. + sig { returns(T::Array[Comment]) } + attr_reader :post_right_gap_comments + + sig { params(opening_comment: ::T.nilable(Comment), closing_comment: ::T.nilable(Comment), pre_left_gap_comments: T::Array[Comment], post_right_gap_comments: T::Array[Comment]).void } + def initialize(opening_comment, closing_comment, pre_left_gap_comments, post_right_gap_comments); end + end + + # Comments for for loop nodes, which have for, in, and optionally do + # keywords, each of which may have a trailing comment. + # + # for a in # in comment + # b + # do # do comment + # c + # end # trailing comment + class ForComments < Base + # The comment trailing the for keyword. + sig { returns(::T.nilable(Comment)) } + attr_reader :for_comment + + # The comment trailing the in keyword. + sig { returns(::T.nilable(Comment)) } + attr_reader :in_comment + + # The comment trailing the do keyword. + sig { returns(::T.nilable(Comment)) } + attr_reader :do_comment + + # The comment trailing the end keyword. + sig { returns(::T.nilable(Comment)) } + attr_reader :trailing_comment + + sig { params(for_comment: ::T.nilable(Comment), in_comment: ::T.nilable(Comment), do_comment: ::T.nilable(Comment), trailing_comment: ::T.nilable(Comment)).void } + def initialize(for_comment, in_comment, do_comment, trailing_comment); end + end + + # Comments for hash pattern nodes (e.g., { a:, **b } in pattern matching), + # which have opening and closing delimiters and gap comments after the + # rest operator. + # + # in { a:, **b, + # # post rest gap comment + # } # closing comment + class HashPatternComments < Base + # The comment trailing the opening delimiter. + sig { returns(::T.nilable(Comment)) } + attr_reader :opening_comment + + # The comment trailing the closing delimiter. + sig { returns(::T.nilable(Comment)) } + attr_reader :closing_comment + + # The comments after the rest operator. + sig { returns(T::Array[Comment]) } + attr_reader :post_rest_gap_comments + + sig { params(opening_comment: ::T.nilable(Comment), closing_comment: ::T.nilable(Comment), post_rest_gap_comments: T::Array[Comment]).void } + def initialize(opening_comment, closing_comment, post_rest_gap_comments); end + end + + # Comments for keyword call nodes with parentheses, such as yield and + # super. + # + # yield( # lparen comment + # foo + # ) # rparen comment + class KeywordCallComments < Base + # The comment trailing the opening parenthesis. + sig { returns(::T.nilable(Comment)) } + attr_reader :lparen_comment + + # The comment trailing the closing parenthesis. + sig { returns(::T.nilable(Comment)) } + attr_reader :rparen_comment + + sig { params(lparen_comment: ::T.nilable(Comment), rparen_comment: ::T.nilable(Comment)).void } + def initialize(lparen_comment, rparen_comment); end + end + + # Comments for leaf nodes that can only have a trailing comment on the + # same line (e.g., variable reads, literals, break/next/return keywords). + # + # foo # trailing comment + class LeafComments < Base + # The comment trailing the node. + sig { returns(::T.nilable(Comment)) } + attr_reader :trailing_comment + + sig { params(trailing_comment: ::T.nilable(Comment)).void } + def initialize(trailing_comment); end + end + + # Comments for logical keyword operators (and, or) which have comments + # in the gaps before and after the keyword operator. + # + # a + # # left gap comment + # and # operator comment + # # right gap comment + # b + class LogicalKeywordComments < Base + # The comment trailing the operator keyword. + sig { returns(::T.nilable(Comment)) } + attr_reader :operator_comment + + # The comments between the left operand and the operator. + sig { returns(T::Array[Comment]) } + attr_reader :left_gap_comments + + # The comments between the operator and the right operand. + sig { returns(T::Array[Comment]) } + attr_reader :right_gap_comments + + sig { params(operator_comment: ::T.nilable(Comment), left_gap_comments: T::Array[Comment], right_gap_comments: T::Array[Comment]).void } + def initialize(operator_comment, left_gap_comments, right_gap_comments); end + end + + # Comments for module nodes, which can have comments on the module keyword, + # in the gap between the keyword and the constant, and on the end keyword. + # + # module # opening comment + # # keyword gap comment + # Foo + # bar + # end # trailing comment + class ModuleComments < Base + # The comment trailing the module keyword. + sig { returns(::T.nilable(Comment)) } + attr_reader :opening_comment + + # The comments between the module keyword and the constant. + sig { returns(T::Array[Comment]) } + attr_reader :keyword_gap_comments + + # The comment trailing the end keyword. + sig { returns(::T.nilable(Comment)) } + attr_reader :trailing_comment + + sig { params(opening_comment: ::T.nilable(Comment), keyword_gap_comments: T::Array[Comment], trailing_comment: ::T.nilable(Comment)).void } + def initialize(opening_comment, keyword_gap_comments, trailing_comment); end + end + + # Comments for nodes wrapped in parentheses, such as parenthesized + # expressions or ternary if/unless with parenthesized predicates. + # + # ( # opening comment + # # opening gap comment + # foo + # # closing gap comment + # ) + class ParenthesizedComments < Base + # The comment trailing the opening parenthesis. + sig { returns(::T.nilable(Comment)) } + attr_reader :opening_comment + + # The comments between the opening parenthesis and the body. + sig { returns(T::Array[Comment]) } + attr_reader :opening_gap_comments + + # The comments between the body and the closing parenthesis. + sig { returns(T::Array[Comment]) } + attr_reader :closing_gap_comments + + sig { params(opening_comment: ::T.nilable(Comment), opening_gap_comments: T::Array[Comment], closing_gap_comments: T::Array[Comment]).void } + def initialize(opening_comment, opening_gap_comments, closing_gap_comments); end + end + + # Comments for prefix operator nodes (e.g., !, ~, not, splat, block + # argument) where a comment can trail the operator and gap comments can + # appear before the operand. + # + # ! # operator comment + # # gap comment + # foo + class PrefixComments < Base + # The comment trailing the operator. + sig { returns(::T.nilable(Comment)) } + attr_reader :operator_comment + + # The comments between the operator and the operand. + sig { returns(T::Array[Comment]) } + attr_reader :gap_comments + + sig { params(operator_comment: ::T.nilable(Comment), gap_comments: T::Array[Comment]).void } + def initialize(operator_comment, gap_comments); end + end + end +end diff --git a/rbi/generated/prism/dsl.rbi b/rbi/generated/prism/dsl.rbi index 8db47017bb..dd5201225a 100644 --- a/rbi/generated/prism/dsl.rbi +++ b/rbi/generated/prism/dsl.rbi @@ -86,7 +86,7 @@ module Prism def array_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), elements: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # Create a new ArrayPatternNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, constant: ::T.nilable(::T.any(ConstantPathNode, ConstantReadNode)), requireds: T::Array[Node], rest: ::T.nilable(Node), posts: T::Array[Node], opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).returns(ArrayPatternNode) } + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, constant: ::T.nilable(::T.any(ConstantPathNode, ConstantReadNode)), requireds: T::Array[Node], rest: ::T.nilable(::T.any(ImplicitRestNode, SplatNode)), posts: T::Array[Node], opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).returns(ArrayPatternNode) } def array_pattern_node(source: T.unsafe(nil), node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), constant: T.unsafe(nil), requireds: T.unsafe(nil), rest: T.unsafe(nil), posts: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # Create a new AssocNode node. diff --git a/rbi/generated/prism/node.rbi b/rbi/generated/prism/node.rbi index 4a7f0749d9..ac58de0cd8 100644 --- a/rbi/generated/prism/node.rbi +++ b/rbi/generated/prism/node.rbi @@ -17,6 +17,11 @@ module Prism sig { returns(Integer) } attr_reader :node_id + # The comments attached to this node, or nil if comment attachment was + # not requested during parsing. + sig { returns(::T.nilable(Comments::Base)) } + attr_reader :comments + # Save this node using a saved source so that it can be retrieved later. sig { params(repository: ::T.untyped).returns(Relocation::Entry) } def save(repository); end @@ -94,18 +99,6 @@ module Prism sig { params(cache: ::T.untyped).returns(Integer) } def cached_end_code_units_column(cache); end - # Delegates to [`leading_comments`](rdoc-ref:Location#leading_comments) of the associated location object. - sig { returns(T::Array[Comment]) } - def leading_comments; end - - # Delegates to [`trailing_comments`](rdoc-ref:Location#trailing_comments) of the associated location object. - sig { returns(T::Array[Comment]) } - def trailing_comments; end - - # Delegates to [`comments`](rdoc-ref:Location#comments) of the associated location object. - sig { returns(T::Array[Comment]) } - def comments; end - # Returns all of the lines of the source code associated with this node. sig { returns(T::Array[String]) } def source_lines; end @@ -208,11 +201,6 @@ module Prism sig { abstract.returns(T::Array[Node]) } def compact_child_nodes; end - # Returns an array of child nodes and locations that could potentially have - # comments attached to them. - sig { abstract.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Returns a string representation of the node. sig { abstract.returns(String) } def inspect; end @@ -246,8 +234,8 @@ module Prism # ^^^^^^^^^^^^^^^ class AliasGlobalVariableNode < Node # Initialize a new AliasGlobalVariableNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, new_name: ::T.any(GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode), old_name: ::T.any(GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode), keyword_loc: Location).void } - def initialize(source, node_id, location, flags, new_name, old_name, keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), new_name: ::T.any(GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode), old_name: ::T.any(GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode), keyword_loc: Location).void } + def initialize(source, node_id, location, flags, comments, new_name, old_name, keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -266,13 +254,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, new_name: ::T.any(GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode), old_name: ::T.any(GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode), keyword_loc: Location).returns(AliasGlobalVariableNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), new_name: T.unsafe(nil), old_name: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), new_name: ::T.any(GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode), old_name: ::T.any(GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode), keyword_loc: Location).returns(AliasGlobalVariableNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), new_name: T.unsafe(nil), old_name: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -331,8 +315,8 @@ module Prism # ^^^^^^^^^^^^^ class AliasMethodNode < Node # Initialize a new AliasMethodNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, new_name: ::T.any(SymbolNode, InterpolatedSymbolNode), old_name: ::T.any(SymbolNode, InterpolatedSymbolNode), keyword_loc: Location).void } - def initialize(source, node_id, location, flags, new_name, old_name, keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), new_name: ::T.any(SymbolNode, InterpolatedSymbolNode), old_name: ::T.any(SymbolNode, InterpolatedSymbolNode), keyword_loc: Location).void } + def initialize(source, node_id, location, flags, comments, new_name, old_name, keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -351,13 +335,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, new_name: ::T.any(SymbolNode, InterpolatedSymbolNode), old_name: ::T.any(SymbolNode, InterpolatedSymbolNode), keyword_loc: Location).returns(AliasMethodNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), new_name: T.unsafe(nil), old_name: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), new_name: ::T.any(SymbolNode, InterpolatedSymbolNode), old_name: ::T.any(SymbolNode, InterpolatedSymbolNode), keyword_loc: Location).returns(AliasMethodNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), new_name: T.unsafe(nil), old_name: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -428,8 +408,8 @@ module Prism # ^^^^^^^^^ class AlternationPatternNode < Node # Initialize a new AlternationPatternNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, left: Node, right: Node, operator_loc: Location).void } - def initialize(source, node_id, location, flags, left, right, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), left: Node, right: Node, operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, left, right, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -448,13 +428,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, left: Node, right: Node, operator_loc: Location).returns(AlternationPatternNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), left: Node, right: Node, operator_loc: Location).returns(AlternationPatternNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -513,8 +489,8 @@ module Prism # ^^^^^^^^^^^^^^ class AndNode < Node # Initialize a new AndNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, left: Node, right: Node, operator_loc: Location).void } - def initialize(source, node_id, location, flags, left, right, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), left: Node, right: Node, operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, left, right, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -533,13 +509,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, left: Node, right: Node, operator_loc: Location).returns(AndNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), left: Node, right: Node, operator_loc: Location).returns(AndNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -604,8 +576,8 @@ module Prism # ^^^^^^^^^^^^^ class ArgumentsNode < Node # Initialize a new ArgumentsNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, arguments: T::Array[Node]).void } - def initialize(source, node_id, location, flags, arguments); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), arguments: T::Array[Node]).void } + def initialize(source, node_id, location, flags, comments, arguments); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -624,13 +596,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, arguments: T::Array[Node]).returns(ArgumentsNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), arguments: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), arguments: T::Array[Node]).returns(ArgumentsNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), arguments: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -686,8 +654,8 @@ module Prism # ^^^^^^^^^ class ArrayNode < Node # Initialize a new ArrayNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, elements: T::Array[Node], opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).void } - def initialize(source, node_id, location, flags, elements, opening_loc, closing_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), elements: T::Array[Node], opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).void } + def initialize(source, node_id, location, flags, comments, elements, opening_loc, closing_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -706,13 +674,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, elements: T::Array[Node], opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).returns(ArrayNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), elements: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), elements: T::Array[Node], opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).returns(ArrayNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), elements: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -797,8 +761,8 @@ module Prism # ^^^^^^^^^^^^ class ArrayPatternNode < Node # Initialize a new ArrayPatternNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, constant: ::T.nilable(::T.any(ConstantPathNode, ConstantReadNode)), requireds: T::Array[Node], rest: ::T.nilable(Node), posts: T::Array[Node], opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).void } - def initialize(source, node_id, location, flags, constant, requireds, rest, posts, opening_loc, closing_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), constant: ::T.nilable(::T.any(ConstantPathNode, ConstantReadNode)), requireds: T::Array[Node], rest: ::T.nilable(::T.any(ImplicitRestNode, SplatNode)), posts: T::Array[Node], opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).void } + def initialize(source, node_id, location, flags, comments, constant, requireds, rest, posts, opening_loc, closing_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -817,13 +781,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, constant: ::T.nilable(::T.any(ConstantPathNode, ConstantReadNode)), requireds: T::Array[Node], rest: ::T.nilable(Node), posts: T::Array[Node], opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).returns(ArrayPatternNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), constant: T.unsafe(nil), requireds: T.unsafe(nil), rest: T.unsafe(nil), posts: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), constant: ::T.nilable(::T.any(ConstantPathNode, ConstantReadNode)), requireds: T::Array[Node], rest: ::T.nilable(::T.any(ImplicitRestNode, SplatNode)), posts: T::Array[Node], opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).returns(ArrayPatternNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), constant: T.unsafe(nil), requireds: T.unsafe(nil), rest: T.unsafe(nil), posts: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -866,7 +826,7 @@ module Prism # # foo in *bar # ^^^^ - sig { returns(::T.nilable(Node)) } + sig { returns(::T.nilable(::T.any(ImplicitRestNode, SplatNode))) } def rest; end # Represents the elements after the rest element of the array pattern. @@ -918,8 +878,8 @@ module Prism # ^^^^^^ class AssocNode < Node # Initialize a new AssocNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, key: Node, value: Node, operator_loc: ::T.nilable(Location)).void } - def initialize(source, node_id, location, flags, key, value, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), key: Node, value: Node, operator_loc: ::T.nilable(Location)).void } + def initialize(source, node_id, location, flags, comments, key, value, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -938,13 +898,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, key: Node, value: Node, operator_loc: ::T.nilable(Location)).returns(AssocNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), key: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), key: Node, value: Node, operator_loc: ::T.nilable(Location)).returns(AssocNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), key: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -1012,8 +968,8 @@ module Prism # ^^^^^ class AssocSplatNode < Node # Initialize a new AssocSplatNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, value: ::T.nilable(Node), operator_loc: Location).void } - def initialize(source, node_id, location, flags, value, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), value: ::T.nilable(Node), operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, value, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -1032,13 +988,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, value: ::T.nilable(Node), operator_loc: Location).returns(AssocSplatNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), value: ::T.nilable(Node), operator_loc: Location).returns(AssocSplatNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -1090,8 +1042,8 @@ module Prism # ^^ class BackReferenceReadNode < Node # Initialize a new BackReferenceReadNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void } - def initialize(source, node_id, location, flags, name); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).void } + def initialize(source, node_id, location, flags, comments, name); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -1110,13 +1062,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol).returns(BackReferenceReadNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).returns(BackReferenceReadNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -1155,8 +1103,8 @@ module Prism # ^^^^^ class BeginNode < Node # Initialize a new BeginNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, begin_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), rescue_clause: ::T.nilable(RescueNode), else_clause: ::T.nilable(ElseNode), ensure_clause: ::T.nilable(EnsureNode), end_keyword_loc: ::T.nilable(Location)).void } - def initialize(source, node_id, location, flags, begin_keyword_loc, statements, rescue_clause, else_clause, ensure_clause, end_keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), begin_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), rescue_clause: ::T.nilable(RescueNode), else_clause: ::T.nilable(ElseNode), ensure_clause: ::T.nilable(EnsureNode), end_keyword_loc: ::T.nilable(Location)).void } + def initialize(source, node_id, location, flags, comments, begin_keyword_loc, statements, rescue_clause, else_clause, ensure_clause, end_keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -1175,13 +1123,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, begin_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), rescue_clause: ::T.nilable(RescueNode), else_clause: ::T.nilable(ElseNode), ensure_clause: ::T.nilable(EnsureNode), end_keyword_loc: ::T.nilable(Location)).returns(BeginNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), begin_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), rescue_clause: T.unsafe(nil), else_clause: T.unsafe(nil), ensure_clause: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), begin_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), rescue_clause: ::T.nilable(RescueNode), else_clause: ::T.nilable(ElseNode), ensure_clause: ::T.nilable(EnsureNode), end_keyword_loc: ::T.nilable(Location)).returns(BeginNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), begin_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), rescue_clause: T.unsafe(nil), else_clause: T.unsafe(nil), ensure_clause: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -1270,8 +1214,8 @@ module Prism # ^^^^^ class BlockArgumentNode < Node # Initialize a new BlockArgumentNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, expression: ::T.nilable(Node), operator_loc: Location).void } - def initialize(source, node_id, location, flags, expression, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), expression: ::T.nilable(Node), operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, expression, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -1290,13 +1234,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, expression: ::T.nilable(Node), operator_loc: Location).returns(BlockArgumentNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), expression: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), expression: ::T.nilable(Node), operator_loc: Location).returns(BlockArgumentNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), expression: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -1348,8 +1288,8 @@ module Prism # ^ class BlockLocalVariableNode < Node # Initialize a new BlockLocalVariableNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void } - def initialize(source, node_id, location, flags, name); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).void } + def initialize(source, node_id, location, flags, comments, name); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -1368,13 +1308,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol).returns(BlockLocalVariableNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).returns(BlockLocalVariableNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -1414,8 +1350,8 @@ module Prism # ^^^^^^^^^^^^^^ class BlockNode < Node # Initialize a new BlockNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, locals: T::Array[Symbol], parameters: ::T.nilable(::T.any(BlockParametersNode, NumberedParametersNode, ItParametersNode)), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), opening_loc: Location, closing_loc: Location).void } - def initialize(source, node_id, location, flags, locals, parameters, body, opening_loc, closing_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), locals: T::Array[Symbol], parameters: ::T.nilable(::T.any(BlockParametersNode, NumberedParametersNode, ItParametersNode)), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), opening_loc: Location, closing_loc: Location).void } + def initialize(source, node_id, location, flags, comments, locals, parameters, body, opening_loc, closing_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -1434,13 +1370,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, locals: T::Array[Symbol], parameters: ::T.nilable(::T.any(BlockParametersNode, NumberedParametersNode, ItParametersNode)), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), opening_loc: Location, closing_loc: Location).returns(BlockNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), locals: T::Array[Symbol], parameters: ::T.nilable(::T.any(BlockParametersNode, NumberedParametersNode, ItParametersNode)), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), opening_loc: Location, closing_loc: Location).returns(BlockNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), locals: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -1527,8 +1459,8 @@ module Prism # end class BlockParameterNode < Node # Initialize a new BlockParameterNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: ::T.nilable(Symbol), name_loc: ::T.nilable(Location), operator_loc: Location).void } - def initialize(source, node_id, location, flags, name, name_loc, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: ::T.nilable(Symbol), name_loc: ::T.nilable(Location), operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -1547,13 +1479,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: ::T.nilable(Symbol), name_loc: ::T.nilable(Location), operator_loc: Location).returns(BlockParameterNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: ::T.nilable(Symbol), name_loc: ::T.nilable(Location), operator_loc: Location).returns(BlockParameterNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -1627,8 +1555,8 @@ module Prism # end class BlockParametersNode < Node # Initialize a new BlockParametersNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, parameters: ::T.nilable(ParametersNode), locals: T::Array[BlockLocalVariableNode], opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).void } - def initialize(source, node_id, location, flags, parameters, locals, opening_loc, closing_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), parameters: ::T.nilable(ParametersNode), locals: T::Array[BlockLocalVariableNode], opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).void } + def initialize(source, node_id, location, flags, comments, parameters, locals, opening_loc, closing_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -1647,13 +1575,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, parameters: ::T.nilable(ParametersNode), locals: T::Array[BlockLocalVariableNode], opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).returns(BlockParametersNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), parameters: T.unsafe(nil), locals: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), parameters: ::T.nilable(ParametersNode), locals: T::Array[BlockLocalVariableNode], opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).returns(BlockParametersNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), parameters: T.unsafe(nil), locals: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -1744,8 +1668,8 @@ module Prism # ^^^^^^^^^ class BreakNode < Node # Initialize a new BreakNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, arguments: ::T.nilable(ArgumentsNode), keyword_loc: Location).void } - def initialize(source, node_id, location, flags, arguments, keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), arguments: ::T.nilable(ArgumentsNode), keyword_loc: Location).void } + def initialize(source, node_id, location, flags, comments, arguments, keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -1764,13 +1688,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, arguments: ::T.nilable(ArgumentsNode), keyword_loc: Location).returns(BreakNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), arguments: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), arguments: ::T.nilable(ArgumentsNode), keyword_loc: Location).returns(BreakNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), arguments: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -1822,8 +1742,8 @@ module Prism # ^^^^^^^^^^^^^^^^^ class CallAndWriteNode < Node # Initialize a new CallAndWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), message_loc: ::T.nilable(Location), read_name: Symbol, write_name: Symbol, operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), message_loc: ::T.nilable(Location), read_name: Symbol, write_name: Symbol, operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -1842,13 +1762,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), message_loc: ::T.nilable(Location), read_name: Symbol, write_name: Symbol, operator_loc: Location, value: Node).returns(CallAndWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), message_loc: T.unsafe(nil), read_name: T.unsafe(nil), write_name: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), message_loc: ::T.nilable(Location), read_name: Symbol, write_name: Symbol, operator_loc: Location, value: Node).returns(CallAndWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), message_loc: T.unsafe(nil), read_name: T.unsafe(nil), write_name: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -1984,8 +1900,8 @@ module Prism # ^^^^^^^^ class CallNode < Node # Initialize a new CallNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), name: Symbol, message_loc: ::T.nilable(Location), opening_loc: ::T.nilable(Location), arguments: ::T.nilable(ArgumentsNode), closing_loc: ::T.nilable(Location), equal_loc: ::T.nilable(Location), block: ::T.nilable(::T.any(BlockNode, BlockArgumentNode))).void } - def initialize(source, node_id, location, flags, receiver, call_operator_loc, name, message_loc, opening_loc, arguments, closing_loc, equal_loc, block); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), name: Symbol, message_loc: ::T.nilable(Location), opening_loc: ::T.nilable(Location), arguments: ::T.nilable(ArgumentsNode), closing_loc: ::T.nilable(Location), equal_loc: ::T.nilable(Location), block: ::T.nilable(::T.any(BlockNode, BlockArgumentNode))).void } + def initialize(source, node_id, location, flags, comments, receiver, call_operator_loc, name, message_loc, opening_loc, arguments, closing_loc, equal_loc, block); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -2004,13 +1920,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), name: Symbol, message_loc: ::T.nilable(Location), opening_loc: ::T.nilable(Location), arguments: ::T.nilable(ArgumentsNode), closing_loc: ::T.nilable(Location), equal_loc: ::T.nilable(Location), block: ::T.nilable(::T.any(BlockNode, BlockArgumentNode))).returns(CallNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), name: T.unsafe(nil), message_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), equal_loc: T.unsafe(nil), block: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), name: Symbol, message_loc: ::T.nilable(Location), opening_loc: ::T.nilable(Location), arguments: ::T.nilable(ArgumentsNode), closing_loc: ::T.nilable(Location), equal_loc: ::T.nilable(Location), block: ::T.nilable(::T.any(BlockNode, BlockArgumentNode))).returns(CallNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), name: T.unsafe(nil), message_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), equal_loc: T.unsafe(nil), block: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -2175,8 +2087,8 @@ module Prism # ^^^^^^^^^^^^^^ class CallOperatorWriteNode < Node # Initialize a new CallOperatorWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), message_loc: ::T.nilable(Location), read_name: Symbol, write_name: Symbol, binary_operator: Symbol, binary_operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, receiver, call_operator_loc, message_loc, read_name, write_name, binary_operator, binary_operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), message_loc: ::T.nilable(Location), read_name: Symbol, write_name: Symbol, binary_operator: Symbol, binary_operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, receiver, call_operator_loc, message_loc, read_name, write_name, binary_operator, binary_operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -2195,13 +2107,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), message_loc: ::T.nilable(Location), read_name: Symbol, write_name: Symbol, binary_operator: Symbol, binary_operator_loc: Location, value: Node).returns(CallOperatorWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), message_loc: T.unsafe(nil), read_name: T.unsafe(nil), write_name: T.unsafe(nil), binary_operator: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), message_loc: ::T.nilable(Location), read_name: Symbol, write_name: Symbol, binary_operator: Symbol, binary_operator_loc: Location, value: Node).returns(CallOperatorWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), message_loc: T.unsafe(nil), read_name: T.unsafe(nil), write_name: T.unsafe(nil), binary_operator: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -2325,8 +2233,8 @@ module Prism # ^^^^^^^^^^^^^^^^^ class CallOrWriteNode < Node # Initialize a new CallOrWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), message_loc: ::T.nilable(Location), read_name: Symbol, write_name: Symbol, operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), message_loc: ::T.nilable(Location), read_name: Symbol, write_name: Symbol, operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -2345,13 +2253,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), message_loc: ::T.nilable(Location), read_name: Symbol, write_name: Symbol, operator_loc: Location, value: Node).returns(CallOrWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), message_loc: T.unsafe(nil), read_name: T.unsafe(nil), write_name: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), message_loc: ::T.nilable(Location), read_name: Symbol, write_name: Symbol, operator_loc: Location, value: Node).returns(CallOrWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), message_loc: T.unsafe(nil), read_name: T.unsafe(nil), write_name: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -2480,8 +2384,8 @@ module Prism # ^^^^^^^ class CallTargetNode < Node # Initialize a new CallTargetNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: Node, call_operator_loc: Location, name: Symbol, message_loc: Location).void } - def initialize(source, node_id, location, flags, receiver, call_operator_loc, name, message_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: Node, call_operator_loc: Location, name: Symbol, message_loc: Location).void } + def initialize(source, node_id, location, flags, comments, receiver, call_operator_loc, name, message_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -2500,13 +2404,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, receiver: Node, call_operator_loc: Location, name: Symbol, message_loc: Location).returns(CallTargetNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), name: T.unsafe(nil), message_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: Node, call_operator_loc: Location, name: Symbol, message_loc: Location).returns(CallTargetNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), name: T.unsafe(nil), message_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -2597,8 +2497,8 @@ module Prism # ^^^^^^^^^^ class CapturePatternNode < Node # Initialize a new CapturePatternNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, value: Node, target: LocalVariableTargetNode, operator_loc: Location).void } - def initialize(source, node_id, location, flags, value, target, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), value: Node, target: LocalVariableTargetNode, operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, value, target, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -2617,13 +2517,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, value: Node, target: LocalVariableTargetNode, operator_loc: Location).returns(CapturePatternNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), value: Node, target: LocalVariableTargetNode, operator_loc: Location).returns(CapturePatternNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), value: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -2684,8 +2580,8 @@ module Prism # ^^^^^^^^^ class CaseMatchNode < Node # Initialize a new CaseMatchNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, predicate: ::T.nilable(Node), conditions: T::Array[InNode], else_clause: ::T.nilable(ElseNode), case_keyword_loc: Location, end_keyword_loc: Location).void } - def initialize(source, node_id, location, flags, predicate, conditions, else_clause, case_keyword_loc, end_keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), predicate: ::T.nilable(Node), conditions: T::Array[InNode], else_clause: ::T.nilable(ElseNode), case_keyword_loc: Location, end_keyword_loc: Location).void } + def initialize(source, node_id, location, flags, comments, predicate, conditions, else_clause, case_keyword_loc, end_keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -2704,13 +2600,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, predicate: ::T.nilable(Node), conditions: T::Array[InNode], else_clause: ::T.nilable(ElseNode), case_keyword_loc: Location, end_keyword_loc: Location).returns(CaseMatchNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), predicate: T.unsafe(nil), conditions: T.unsafe(nil), else_clause: T.unsafe(nil), case_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), predicate: ::T.nilable(Node), conditions: T::Array[InNode], else_clause: ::T.nilable(ElseNode), case_keyword_loc: Location, end_keyword_loc: Location).returns(CaseMatchNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), predicate: T.unsafe(nil), conditions: T.unsafe(nil), else_clause: T.unsafe(nil), case_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -2794,8 +2686,8 @@ module Prism # ^^^^^^^^^^ class CaseNode < Node # Initialize a new CaseNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, predicate: ::T.nilable(Node), conditions: T::Array[WhenNode], else_clause: ::T.nilable(ElseNode), case_keyword_loc: Location, end_keyword_loc: Location).void } - def initialize(source, node_id, location, flags, predicate, conditions, else_clause, case_keyword_loc, end_keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), predicate: ::T.nilable(Node), conditions: T::Array[WhenNode], else_clause: ::T.nilable(ElseNode), case_keyword_loc: Location, end_keyword_loc: Location).void } + def initialize(source, node_id, location, flags, comments, predicate, conditions, else_clause, case_keyword_loc, end_keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -2814,13 +2706,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, predicate: ::T.nilable(Node), conditions: T::Array[WhenNode], else_clause: ::T.nilable(ElseNode), case_keyword_loc: Location, end_keyword_loc: Location).returns(CaseNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), predicate: T.unsafe(nil), conditions: T.unsafe(nil), else_clause: T.unsafe(nil), case_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), predicate: ::T.nilable(Node), conditions: T::Array[WhenNode], else_clause: ::T.nilable(ElseNode), case_keyword_loc: Location, end_keyword_loc: Location).returns(CaseNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), predicate: T.unsafe(nil), conditions: T.unsafe(nil), else_clause: T.unsafe(nil), case_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -2902,8 +2790,8 @@ module Prism # ^^^^^^^^^^^^^ class ClassNode < Node # Initialize a new ClassNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, locals: T::Array[Symbol], class_keyword_loc: Location, constant_path: ::T.any(ConstantReadNode, ConstantPathNode), inheritance_operator_loc: ::T.nilable(Location), superclass: ::T.nilable(Node), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), end_keyword_loc: Location, name: Symbol).void } - def initialize(source, node_id, location, flags, locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, name); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), locals: T::Array[Symbol], class_keyword_loc: Location, constant_path: ::T.any(ConstantReadNode, ConstantPathNode), inheritance_operator_loc: ::T.nilable(Location), superclass: ::T.nilable(Node), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), end_keyword_loc: Location, name: Symbol).void } + def initialize(source, node_id, location, flags, comments, locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, name); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -2922,13 +2810,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, locals: T::Array[Symbol], class_keyword_loc: Location, constant_path: ::T.any(ConstantReadNode, ConstantPathNode), inheritance_operator_loc: ::T.nilable(Location), superclass: ::T.nilable(Node), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), end_keyword_loc: Location, name: Symbol).returns(ClassNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), class_keyword_loc: T.unsafe(nil), constant_path: T.unsafe(nil), inheritance_operator_loc: T.unsafe(nil), superclass: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), name: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), locals: T::Array[Symbol], class_keyword_loc: Location, constant_path: ::T.any(ConstantReadNode, ConstantPathNode), inheritance_operator_loc: ::T.nilable(Location), superclass: ::T.nilable(Node), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), end_keyword_loc: Location, name: Symbol).returns(ClassNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), locals: T.unsafe(nil), class_keyword_loc: T.unsafe(nil), constant_path: T.unsafe(nil), inheritance_operator_loc: T.unsafe(nil), superclass: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), name: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -3033,8 +2917,8 @@ module Prism # ^^^^^^^^^^^^^^^^^^ class ClassVariableAndWriteNode < Node # Initialize a new ClassVariableAndWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -3053,13 +2937,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(ClassVariableAndWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(ClassVariableAndWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -3130,8 +3010,8 @@ module Prism # ^^^^^^^^^^^^^^^^^ class ClassVariableOperatorWriteNode < Node # Initialize a new ClassVariableOperatorWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).void } - def initialize(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, binary_operator_loc, value, binary_operator); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -3150,13 +3030,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).returns(ClassVariableOperatorWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).returns(ClassVariableOperatorWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -3215,8 +3091,8 @@ module Prism # ^^^^^^^^^^^^^^^^^^ class ClassVariableOrWriteNode < Node # Initialize a new ClassVariableOrWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -3235,13 +3111,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(ClassVariableOrWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(ClassVariableOrWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -3300,8 +3172,8 @@ module Prism # ^^^^^ class ClassVariableReadNode < Node # Initialize a new ClassVariableReadNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void } - def initialize(source, node_id, location, flags, name); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).void } + def initialize(source, node_id, location, flags, comments, name); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -3320,13 +3192,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol).returns(ClassVariableReadNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).returns(ClassVariableReadNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -3363,8 +3231,8 @@ module Prism # ^^^^^ ^^^^^ class ClassVariableTargetNode < Node # Initialize a new ClassVariableTargetNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void } - def initialize(source, node_id, location, flags, name); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).void } + def initialize(source, node_id, location, flags, comments, name); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -3383,13 +3251,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol).returns(ClassVariableTargetNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).returns(ClassVariableTargetNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -3422,8 +3286,8 @@ module Prism # ^^^^^^^^^ class ClassVariableWriteNode < Node # Initialize a new ClassVariableWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, value: Node, operator_loc: Location).void } - def initialize(source, node_id, location, flags, name, name_loc, value, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, value: Node, operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, value, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -3442,13 +3306,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, value: Node, operator_loc: Location).returns(ClassVariableWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, value: Node, operator_loc: Location).returns(ClassVariableWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -3523,8 +3383,8 @@ module Prism # ^^^^^^^^^^^^^^^^ class ConstantAndWriteNode < Node # Initialize a new ConstantAndWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -3543,13 +3403,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(ConstantAndWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(ConstantAndWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -3608,8 +3464,8 @@ module Prism # ^^^^^^^^^^^^^^^ class ConstantOperatorWriteNode < Node # Initialize a new ConstantOperatorWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).void } - def initialize(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, binary_operator_loc, value, binary_operator); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -3628,13 +3484,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).returns(ConstantOperatorWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).returns(ConstantOperatorWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -3693,8 +3545,8 @@ module Prism # ^^^^^^^^^^^^^^^^ class ConstantOrWriteNode < Node # Initialize a new ConstantOrWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -3713,13 +3565,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(ConstantOrWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(ConstantOrWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -3778,8 +3626,8 @@ module Prism # ^^^^^^^^^^^^^^^^^^^^^^^ class ConstantPathAndWriteNode < Node # Initialize a new ConstantPathAndWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, target: ConstantPathNode, operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, target, operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), target: ConstantPathNode, operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, target, operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -3798,13 +3646,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, target: ConstantPathNode, operator_loc: Location, value: Node).returns(ConstantPathAndWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), target: ConstantPathNode, operator_loc: Location, value: Node).returns(ConstantPathAndWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -3854,8 +3698,8 @@ module Prism # ^^^^^^^^ class ConstantPathNode < Node # Initialize a new ConstantPathNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, parent: ::T.nilable(Node), name: ::T.nilable(Symbol), delimiter_loc: Location, name_loc: Location).void } - def initialize(source, node_id, location, flags, parent, name, delimiter_loc, name_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), parent: ::T.nilable(Node), name: ::T.nilable(Symbol), delimiter_loc: Location, name_loc: Location).void } + def initialize(source, node_id, location, flags, comments, parent, name, delimiter_loc, name_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -3874,13 +3718,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, parent: ::T.nilable(Node), name: ::T.nilable(Symbol), delimiter_loc: Location, name_loc: Location).returns(ConstantPathNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), parent: T.unsafe(nil), name: T.unsafe(nil), delimiter_loc: T.unsafe(nil), name_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), parent: ::T.nilable(Node), name: ::T.nilable(Symbol), delimiter_loc: Location, name_loc: Location).returns(ConstantPathNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), parent: T.unsafe(nil), name: T.unsafe(nil), delimiter_loc: T.unsafe(nil), name_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -3960,8 +3800,8 @@ module Prism # ^^^^^^^^^^^^^^^^^^^^^^ class ConstantPathOperatorWriteNode < Node # Initialize a new ConstantPathOperatorWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, target: ConstantPathNode, binary_operator_loc: Location, value: Node, binary_operator: Symbol).void } - def initialize(source, node_id, location, flags, target, binary_operator_loc, value, binary_operator); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), target: ConstantPathNode, binary_operator_loc: Location, value: Node, binary_operator: Symbol).void } + def initialize(source, node_id, location, flags, comments, target, binary_operator_loc, value, binary_operator); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -3980,13 +3820,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, target: ConstantPathNode, binary_operator_loc: Location, value: Node, binary_operator: Symbol).returns(ConstantPathOperatorWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), target: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), target: ConstantPathNode, binary_operator_loc: Location, value: Node, binary_operator: Symbol).returns(ConstantPathOperatorWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), target: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -4036,8 +3872,8 @@ module Prism # ^^^^^^^^^^^^^^^^^^^^^^^ class ConstantPathOrWriteNode < Node # Initialize a new ConstantPathOrWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, target: ConstantPathNode, operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, target, operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), target: ConstantPathNode, operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, target, operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -4056,13 +3892,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, target: ConstantPathNode, operator_loc: Location, value: Node).returns(ConstantPathOrWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), target: ConstantPathNode, operator_loc: Location, value: Node).returns(ConstantPathOrWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -4112,8 +3944,8 @@ module Prism # ^^^^^^^^ ^^^^^^^^ class ConstantPathTargetNode < Node # Initialize a new ConstantPathTargetNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, parent: ::T.nilable(Node), name: ::T.nilable(Symbol), delimiter_loc: Location, name_loc: Location).void } - def initialize(source, node_id, location, flags, parent, name, delimiter_loc, name_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), parent: ::T.nilable(Node), name: ::T.nilable(Symbol), delimiter_loc: Location, name_loc: Location).void } + def initialize(source, node_id, location, flags, comments, parent, name, delimiter_loc, name_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -4132,13 +3964,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, parent: ::T.nilable(Node), name: ::T.nilable(Symbol), delimiter_loc: Location, name_loc: Location).returns(ConstantPathTargetNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), parent: T.unsafe(nil), name: T.unsafe(nil), delimiter_loc: T.unsafe(nil), name_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), parent: ::T.nilable(Node), name: ::T.nilable(Symbol), delimiter_loc: Location, name_loc: Location).returns(ConstantPathTargetNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), parent: T.unsafe(nil), name: T.unsafe(nil), delimiter_loc: T.unsafe(nil), name_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -4203,8 +4031,8 @@ module Prism # ^^^^^^^^^^^^^^ class ConstantPathWriteNode < Node # Initialize a new ConstantPathWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, target: ConstantPathNode, operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, target, operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), target: ConstantPathNode, operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, target, operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -4223,13 +4051,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, target: ConstantPathNode, operator_loc: Location, value: Node).returns(ConstantPathWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), target: ConstantPathNode, operator_loc: Location, value: Node).returns(ConstantPathWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -4291,8 +4115,8 @@ module Prism # ^^^ class ConstantReadNode < Node # Initialize a new ConstantReadNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void } - def initialize(source, node_id, location, flags, name); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).void } + def initialize(source, node_id, location, flags, comments, name); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -4311,13 +4135,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol).returns(ConstantReadNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).returns(ConstantReadNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -4354,8 +4174,8 @@ module Prism # ^^^ ^^^ class ConstantTargetNode < Node # Initialize a new ConstantTargetNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void } - def initialize(source, node_id, location, flags, name); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).void } + def initialize(source, node_id, location, flags, comments, name); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -4374,13 +4194,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol).returns(ConstantTargetNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).returns(ConstantTargetNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -4413,8 +4229,8 @@ module Prism # ^^^^^^^ class ConstantWriteNode < Node # Initialize a new ConstantWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, value: Node, operator_loc: Location).void } - def initialize(source, node_id, location, flags, name, name_loc, value, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, value: Node, operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, value, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -4433,13 +4249,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, value: Node, operator_loc: Location).returns(ConstantWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, value: Node, operator_loc: Location).returns(ConstantWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -4515,8 +4327,8 @@ module Prism # ^^^^^^^^^^ class DefNode < Node # Initialize a new DefNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, receiver: ::T.nilable(Node), parameters: ::T.nilable(ParametersNode), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), locals: T::Array[Symbol], def_keyword_loc: Location, operator_loc: ::T.nilable(Location), lparen_loc: ::T.nilable(Location), rparen_loc: ::T.nilable(Location), equal_loc: ::T.nilable(Location), end_keyword_loc: ::T.nilable(Location)).void } - def initialize(source, node_id, location, flags, name, name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, receiver: ::T.nilable(Node), parameters: ::T.nilable(ParametersNode), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), locals: T::Array[Symbol], def_keyword_loc: Location, operator_loc: ::T.nilable(Location), lparen_loc: ::T.nilable(Location), rparen_loc: ::T.nilable(Location), equal_loc: ::T.nilable(Location), end_keyword_loc: ::T.nilable(Location)).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -4535,13 +4347,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, receiver: ::T.nilable(Node), parameters: ::T.nilable(ParametersNode), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), locals: T::Array[Symbol], def_keyword_loc: Location, operator_loc: ::T.nilable(Location), lparen_loc: ::T.nilable(Location), rparen_loc: ::T.nilable(Location), equal_loc: ::T.nilable(Location), end_keyword_loc: ::T.nilable(Location)).returns(DefNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), receiver: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil), locals: T.unsafe(nil), def_keyword_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil), equal_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, receiver: ::T.nilable(Node), parameters: ::T.nilable(ParametersNode), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), locals: T::Array[Symbol], def_keyword_loc: Location, operator_loc: ::T.nilable(Location), lparen_loc: ::T.nilable(Location), rparen_loc: ::T.nilable(Location), equal_loc: ::T.nilable(Location), end_keyword_loc: ::T.nilable(Location)).returns(DefNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), receiver: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil), locals: T.unsafe(nil), def_keyword_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil), equal_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -4677,8 +4485,8 @@ module Prism # ^^^^^^^^^^^ class DefinedNode < Node # Initialize a new DefinedNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, lparen_loc: ::T.nilable(Location), value: Node, rparen_loc: ::T.nilable(Location), keyword_loc: Location).void } - def initialize(source, node_id, location, flags, lparen_loc, value, rparen_loc, keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), lparen_loc: ::T.nilable(Location), value: Node, rparen_loc: ::T.nilable(Location), keyword_loc: Location).void } + def initialize(source, node_id, location, flags, comments, lparen_loc, value, rparen_loc, keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -4697,13 +4505,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, lparen_loc: ::T.nilable(Location), value: Node, rparen_loc: ::T.nilable(Location), keyword_loc: Location).returns(DefinedNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), lparen_loc: T.unsafe(nil), value: T.unsafe(nil), rparen_loc: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), lparen_loc: ::T.nilable(Location), value: Node, rparen_loc: ::T.nilable(Location), keyword_loc: Location).returns(DefinedNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), lparen_loc: T.unsafe(nil), value: T.unsafe(nil), rparen_loc: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -4775,8 +4579,8 @@ module Prism # ^^^^^^^^^^ class ElseNode < Node # Initialize a new ElseNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, else_keyword_loc: Location, statements: ::T.nilable(StatementsNode), end_keyword_loc: ::T.nilable(Location)).void } - def initialize(source, node_id, location, flags, else_keyword_loc, statements, end_keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), else_keyword_loc: Location, statements: ::T.nilable(StatementsNode), end_keyword_loc: ::T.nilable(Location)).void } + def initialize(source, node_id, location, flags, comments, else_keyword_loc, statements, end_keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -4795,13 +4599,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, else_keyword_loc: Location, statements: ::T.nilable(StatementsNode), end_keyword_loc: ::T.nilable(Location)).returns(ElseNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), else_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), else_keyword_loc: Location, statements: ::T.nilable(StatementsNode), end_keyword_loc: ::T.nilable(Location)).returns(ElseNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), else_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -4860,8 +4660,8 @@ module Prism # ^^^^^^ class EmbeddedStatementsNode < Node # Initialize a new EmbeddedStatementsNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: Location, statements: ::T.nilable(StatementsNode), closing_loc: Location).void } - def initialize(source, node_id, location, flags, opening_loc, statements, closing_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: Location, statements: ::T.nilable(StatementsNode), closing_loc: Location).void } + def initialize(source, node_id, location, flags, comments, opening_loc, statements, closing_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -4880,13 +4680,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, opening_loc: Location, statements: ::T.nilable(StatementsNode), closing_loc: Location).returns(EmbeddedStatementsNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), statements: T.unsafe(nil), closing_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: Location, statements: ::T.nilable(StatementsNode), closing_loc: Location).returns(EmbeddedStatementsNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), opening_loc: T.unsafe(nil), statements: T.unsafe(nil), closing_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -4945,8 +4741,8 @@ module Prism # ^^^^^ class EmbeddedVariableNode < Node # Initialize a new EmbeddedVariableNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, operator_loc: Location, variable: ::T.any(InstanceVariableReadNode, ClassVariableReadNode, GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode)).void } - def initialize(source, node_id, location, flags, operator_loc, variable); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), operator_loc: Location, variable: ::T.any(InstanceVariableReadNode, ClassVariableReadNode, GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode)).void } + def initialize(source, node_id, location, flags, comments, operator_loc, variable); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -4965,13 +4761,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, operator_loc: Location, variable: ::T.any(InstanceVariableReadNode, ClassVariableReadNode, GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode)).returns(EmbeddedVariableNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), operator_loc: T.unsafe(nil), variable: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), operator_loc: Location, variable: ::T.any(InstanceVariableReadNode, ClassVariableReadNode, GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode)).returns(EmbeddedVariableNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), operator_loc: T.unsafe(nil), variable: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -5021,8 +4813,8 @@ module Prism # end class EnsureNode < Node # Initialize a new EnsureNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, ensure_keyword_loc: Location, statements: ::T.nilable(StatementsNode), end_keyword_loc: Location).void } - def initialize(source, node_id, location, flags, ensure_keyword_loc, statements, end_keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), ensure_keyword_loc: Location, statements: ::T.nilable(StatementsNode), end_keyword_loc: Location).void } + def initialize(source, node_id, location, flags, comments, ensure_keyword_loc, statements, end_keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -5041,13 +4833,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, ensure_keyword_loc: Location, statements: ::T.nilable(StatementsNode), end_keyword_loc: Location).returns(EnsureNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), ensure_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), ensure_keyword_loc: Location, statements: ::T.nilable(StatementsNode), end_keyword_loc: Location).returns(EnsureNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), ensure_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -5103,8 +4891,8 @@ module Prism # Represents a node that is either missing or unexpected and results in a syntax error. class ErrorRecoveryNode < Node # Initialize a new ErrorRecoveryNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, unexpected: ::T.nilable(Node)).void } - def initialize(source, node_id, location, flags, unexpected); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), unexpected: ::T.nilable(Node)).void } + def initialize(source, node_id, location, flags, comments, unexpected); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -5123,13 +4911,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, unexpected: ::T.nilable(Node)).returns(ErrorRecoveryNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), unexpected: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), unexpected: ::T.nilable(Node)).returns(ErrorRecoveryNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), unexpected: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -5162,8 +4946,8 @@ module Prism # ^^^^^ class FalseNode < Node # Initialize a new FalseNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void } - def initialize(source, node_id, location, flags); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).void } + def initialize(source, node_id, location, flags, comments); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -5182,13 +4966,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer).returns(FalseNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).returns(FalseNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -5226,8 +5006,8 @@ module Prism # ^^^^^^^^^^^^^^^ class FindPatternNode < Node # Initialize a new FindPatternNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, constant: ::T.nilable(::T.any(ConstantPathNode, ConstantReadNode)), left: SplatNode, requireds: T::Array[Node], right: SplatNode, opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).void } - def initialize(source, node_id, location, flags, constant, left, requireds, right, opening_loc, closing_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), constant: ::T.nilable(::T.any(ConstantPathNode, ConstantReadNode)), left: SplatNode, requireds: T::Array[Node], right: SplatNode, opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).void } + def initialize(source, node_id, location, flags, comments, constant, left, requireds, right, opening_loc, closing_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -5246,13 +5026,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, constant: ::T.nilable(::T.any(ConstantPathNode, ConstantReadNode)), left: SplatNode, requireds: T::Array[Node], right: SplatNode, opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).returns(FindPatternNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), constant: T.unsafe(nil), left: T.unsafe(nil), requireds: T.unsafe(nil), right: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), constant: ::T.nilable(::T.any(ConstantPathNode, ConstantReadNode)), left: SplatNode, requireds: T::Array[Node], right: SplatNode, opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).returns(FindPatternNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), constant: T.unsafe(nil), left: T.unsafe(nil), requireds: T.unsafe(nil), right: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -5356,8 +5132,8 @@ module Prism # ^^^^^^^^^^ class FlipFlopNode < Node # Initialize a new FlipFlopNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, left: ::T.nilable(Node), right: ::T.nilable(Node), operator_loc: Location).void } - def initialize(source, node_id, location, flags, left, right, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), left: ::T.nilable(Node), right: ::T.nilable(Node), operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, left, right, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -5376,13 +5152,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, left: ::T.nilable(Node), right: ::T.nilable(Node), operator_loc: Location).returns(FlipFlopNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), left: ::T.nilable(Node), right: ::T.nilable(Node), operator_loc: Location).returns(FlipFlopNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -5436,8 +5208,8 @@ module Prism # ^^^ class FloatNode < Node # Initialize a new FloatNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, value: Float).void } - def initialize(source, node_id, location, flags, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), value: Float).void } + def initialize(source, node_id, location, flags, comments, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -5456,13 +5228,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, value: Float).returns(FloatNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), value: Float).returns(FloatNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -5495,8 +5263,8 @@ module Prism # ^^^^^^^^^^^^^^ class ForNode < Node # Initialize a new ForNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, index: ::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode), collection: Node, statements: ::T.nilable(StatementsNode), for_keyword_loc: Location, in_keyword_loc: Location, do_keyword_loc: ::T.nilable(Location), end_keyword_loc: Location).void } - def initialize(source, node_id, location, flags, index, collection, statements, for_keyword_loc, in_keyword_loc, do_keyword_loc, end_keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), index: ::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode), collection: Node, statements: ::T.nilable(StatementsNode), for_keyword_loc: Location, in_keyword_loc: Location, do_keyword_loc: ::T.nilable(Location), end_keyword_loc: Location).void } + def initialize(source, node_id, location, flags, comments, index, collection, statements, for_keyword_loc, in_keyword_loc, do_keyword_loc, end_keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -5515,13 +5283,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, index: ::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode), collection: Node, statements: ::T.nilable(StatementsNode), for_keyword_loc: Location, in_keyword_loc: Location, do_keyword_loc: ::T.nilable(Location), end_keyword_loc: Location).returns(ForNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), index: T.unsafe(nil), collection: T.unsafe(nil), statements: T.unsafe(nil), for_keyword_loc: T.unsafe(nil), in_keyword_loc: T.unsafe(nil), do_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), index: ::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode), collection: Node, statements: ::T.nilable(StatementsNode), for_keyword_loc: Location, in_keyword_loc: Location, do_keyword_loc: ::T.nilable(Location), end_keyword_loc: Location).returns(ForNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), index: T.unsafe(nil), collection: T.unsafe(nil), statements: T.unsafe(nil), for_keyword_loc: T.unsafe(nil), in_keyword_loc: T.unsafe(nil), do_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -5639,8 +5403,8 @@ module Prism # end class ForwardingArgumentsNode < Node # Initialize a new ForwardingArgumentsNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void } - def initialize(source, node_id, location, flags); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).void } + def initialize(source, node_id, location, flags, comments); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -5659,13 +5423,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer).returns(ForwardingArgumentsNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).returns(ForwardingArgumentsNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -5695,8 +5455,8 @@ module Prism # end class ForwardingParameterNode < Node # Initialize a new ForwardingParameterNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void } - def initialize(source, node_id, location, flags); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).void } + def initialize(source, node_id, location, flags, comments); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -5715,13 +5475,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer).returns(ForwardingParameterNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).returns(ForwardingParameterNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -5755,8 +5511,8 @@ module Prism # If it has any other arguments, it would be a `SuperNode` instead. class ForwardingSuperNode < Node # Initialize a new ForwardingSuperNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, block: ::T.nilable(BlockNode)).void } - def initialize(source, node_id, location, flags, keyword_loc, block); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, block: ::T.nilable(BlockNode)).void } + def initialize(source, node_id, location, flags, comments, keyword_loc, block); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -5775,13 +5531,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, block: ::T.nilable(BlockNode)).returns(ForwardingSuperNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), block: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, block: ::T.nilable(BlockNode)).returns(ForwardingSuperNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), keyword_loc: T.unsafe(nil), block: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -5831,8 +5583,8 @@ module Prism # ^^^^^^^^^^^^^^^^^ class GlobalVariableAndWriteNode < Node # Initialize a new GlobalVariableAndWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -5851,13 +5603,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(GlobalVariableAndWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(GlobalVariableAndWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -5916,8 +5664,8 @@ module Prism # ^^^^^^^^^^^^^^^^ class GlobalVariableOperatorWriteNode < Node # Initialize a new GlobalVariableOperatorWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).void } - def initialize(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, binary_operator_loc, value, binary_operator); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -5936,13 +5684,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).returns(GlobalVariableOperatorWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).returns(GlobalVariableOperatorWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -6001,8 +5745,8 @@ module Prism # ^^^^^^^^^^^^^^^^^ class GlobalVariableOrWriteNode < Node # Initialize a new GlobalVariableOrWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -6021,13 +5765,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(GlobalVariableOrWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(GlobalVariableOrWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -6086,8 +5826,8 @@ module Prism # ^^^^ class GlobalVariableReadNode < Node # Initialize a new GlobalVariableReadNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void } - def initialize(source, node_id, location, flags, name); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).void } + def initialize(source, node_id, location, flags, comments, name); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -6106,13 +5846,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol).returns(GlobalVariableReadNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).returns(GlobalVariableReadNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -6149,8 +5885,8 @@ module Prism # ^^^^ ^^^^ class GlobalVariableTargetNode < Node # Initialize a new GlobalVariableTargetNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void } - def initialize(source, node_id, location, flags, name); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).void } + def initialize(source, node_id, location, flags, comments, name); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -6169,13 +5905,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol).returns(GlobalVariableTargetNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).returns(GlobalVariableTargetNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -6208,8 +5940,8 @@ module Prism # ^^^^^^^^ class GlobalVariableWriteNode < Node # Initialize a new GlobalVariableWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, value: Node, operator_loc: Location).void } - def initialize(source, node_id, location, flags, name, name_loc, value, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, value: Node, operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, value, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -6228,13 +5960,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, value: Node, operator_loc: Location).returns(GlobalVariableWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, value: Node, operator_loc: Location).returns(GlobalVariableWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -6309,8 +6037,8 @@ module Prism # ^^^^^^^^^^ class HashNode < Node # Initialize a new HashNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: Location, elements: T::Array[::T.any(AssocNode, AssocSplatNode)], closing_loc: Location).void } - def initialize(source, node_id, location, flags, opening_loc, elements, closing_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: Location, elements: T::Array[::T.any(AssocNode, AssocSplatNode)], closing_loc: Location).void } + def initialize(source, node_id, location, flags, comments, opening_loc, elements, closing_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -6329,13 +6057,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, opening_loc: Location, elements: T::Array[::T.any(AssocNode, AssocSplatNode)], closing_loc: Location).returns(HashNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), elements: T.unsafe(nil), closing_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: Location, elements: T::Array[::T.any(AssocNode, AssocSplatNode)], closing_loc: Location).returns(HashNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), opening_loc: T.unsafe(nil), elements: T.unsafe(nil), closing_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -6415,8 +6139,8 @@ module Prism # ^^^^^^^^^^^^^^ class HashPatternNode < Node # Initialize a new HashPatternNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, constant: ::T.nilable(::T.any(ConstantPathNode, ConstantReadNode)), elements: T::Array[AssocNode], rest: ::T.nilable(::T.any(AssocSplatNode, NoKeywordsParameterNode)), opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).void } - def initialize(source, node_id, location, flags, constant, elements, rest, opening_loc, closing_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), constant: ::T.nilable(::T.any(ConstantPathNode, ConstantReadNode)), elements: T::Array[AssocNode], rest: ::T.nilable(::T.any(AssocSplatNode, NoKeywordsParameterNode)), opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).void } + def initialize(source, node_id, location, flags, comments, constant, elements, rest, opening_loc, closing_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -6435,13 +6159,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, constant: ::T.nilable(::T.any(ConstantPathNode, ConstantReadNode)), elements: T::Array[AssocNode], rest: ::T.nilable(::T.any(AssocSplatNode, NoKeywordsParameterNode)), opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).returns(HashPatternNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), constant: T.unsafe(nil), elements: T.unsafe(nil), rest: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), constant: ::T.nilable(::T.any(ConstantPathNode, ConstantReadNode)), elements: T::Array[AssocNode], rest: ::T.nilable(::T.any(AssocSplatNode, NoKeywordsParameterNode)), opening_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location)).returns(HashPatternNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), constant: T.unsafe(nil), elements: T.unsafe(nil), rest: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -6544,8 +6264,8 @@ module Prism # ^^^^^^^^^^^^^^^ class IfNode < Node # Initialize a new IfNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, if_keyword_loc: ::T.nilable(Location), predicate: Node, then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), subsequent: ::T.nilable(::T.any(ElseNode, IfNode)), end_keyword_loc: ::T.nilable(Location)).void } - def initialize(source, node_id, location, flags, if_keyword_loc, predicate, then_keyword_loc, statements, subsequent, end_keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), if_keyword_loc: ::T.nilable(Location), predicate: Node, then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), subsequent: ::T.nilable(::T.any(ElseNode, IfNode)), end_keyword_loc: ::T.nilable(Location)).void } + def initialize(source, node_id, location, flags, comments, if_keyword_loc, predicate, then_keyword_loc, statements, subsequent, end_keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -6564,13 +6284,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, if_keyword_loc: ::T.nilable(Location), predicate: Node, then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), subsequent: ::T.nilable(::T.any(ElseNode, IfNode)), end_keyword_loc: ::T.nilable(Location)).returns(IfNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), if_keyword_loc: T.unsafe(nil), predicate: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), subsequent: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), if_keyword_loc: ::T.nilable(Location), predicate: Node, then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), subsequent: ::T.nilable(::T.any(ElseNode, IfNode)), end_keyword_loc: ::T.nilable(Location)).returns(IfNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), if_keyword_loc: T.unsafe(nil), predicate: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), subsequent: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -6696,8 +6412,8 @@ module Prism # ^^^^ class ImaginaryNode < Node # Initialize a new ImaginaryNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, numeric: ::T.any(FloatNode, IntegerNode, RationalNode)).void } - def initialize(source, node_id, location, flags, numeric); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), numeric: ::T.any(FloatNode, IntegerNode, RationalNode)).void } + def initialize(source, node_id, location, flags, comments, numeric); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -6716,13 +6432,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, numeric: ::T.any(FloatNode, IntegerNode, RationalNode)).returns(ImaginaryNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), numeric: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), numeric: ::T.any(FloatNode, IntegerNode, RationalNode)).returns(ImaginaryNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), numeric: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -6761,8 +6473,8 @@ module Prism # ^^^^ class ImplicitNode < Node # Initialize a new ImplicitNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, value: ::T.any(LocalVariableReadNode, CallNode, ConstantReadNode, LocalVariableTargetNode)).void } - def initialize(source, node_id, location, flags, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), value: ::T.any(LocalVariableReadNode, CallNode, ConstantReadNode, LocalVariableTargetNode)).void } + def initialize(source, node_id, location, flags, comments, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -6781,13 +6493,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, value: ::T.any(LocalVariableReadNode, CallNode, ConstantReadNode, LocalVariableTargetNode)).returns(ImplicitNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), value: ::T.any(LocalVariableReadNode, CallNode, ConstantReadNode, LocalVariableTargetNode)).returns(ImplicitNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -6829,8 +6537,8 @@ module Prism # ^ class ImplicitRestNode < Node # Initialize a new ImplicitRestNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void } - def initialize(source, node_id, location, flags); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).void } + def initialize(source, node_id, location, flags, comments); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -6849,13 +6557,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer).returns(ImplicitRestNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).returns(ImplicitRestNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -6884,8 +6588,8 @@ module Prism # ^^^^^^^^^^^ class InNode < Node # Initialize a new InNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, pattern: Node, statements: ::T.nilable(StatementsNode), in_loc: Location, then_loc: ::T.nilable(Location)).void } - def initialize(source, node_id, location, flags, pattern, statements, in_loc, then_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), pattern: Node, statements: ::T.nilable(StatementsNode), in_loc: Location, then_loc: ::T.nilable(Location)).void } + def initialize(source, node_id, location, flags, comments, pattern, statements, in_loc, then_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -6904,13 +6608,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, pattern: Node, statements: ::T.nilable(StatementsNode), in_loc: Location, then_loc: ::T.nilable(Location)).returns(InNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), pattern: T.unsafe(nil), statements: T.unsafe(nil), in_loc: T.unsafe(nil), then_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), pattern: Node, statements: ::T.nilable(StatementsNode), in_loc: Location, then_loc: ::T.nilable(Location)).returns(InNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), pattern: T.unsafe(nil), statements: T.unsafe(nil), in_loc: T.unsafe(nil), then_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -6973,8 +6673,8 @@ module Prism # ^^^^^^^^^^^^^^^^^^^^^^ class IndexAndWriteNode < Node # Initialize a new IndexAndWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode), operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode), operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -6993,13 +6693,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode), operator_loc: Location, value: Node).returns(IndexAndWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode), operator_loc: Location, value: Node).returns(IndexAndWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -7112,8 +6808,8 @@ module Prism # ^^^^^^^^^^^^^^^^^^^^^ class IndexOperatorWriteNode < Node # Initialize a new IndexOperatorWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode), binary_operator: Symbol, binary_operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, binary_operator, binary_operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode), binary_operator: Symbol, binary_operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, binary_operator, binary_operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -7132,13 +6828,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode), binary_operator: Symbol, binary_operator_loc: Location, value: Node).returns(IndexOperatorWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil), binary_operator: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode), binary_operator: Symbol, binary_operator_loc: Location, value: Node).returns(IndexOperatorWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil), binary_operator: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -7251,8 +6943,8 @@ module Prism # ^^^^^^^^^^^^^^^^^^^^^^ class IndexOrWriteNode < Node # Initialize a new IndexOrWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode), operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode), operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -7271,13 +6963,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode), operator_loc: Location, value: Node).returns(IndexOrWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: ::T.nilable(Node), call_operator_loc: ::T.nilable(Location), opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode), operator_loc: Location, value: Node).returns(IndexOrWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), receiver: T.unsafe(nil), call_operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -7398,8 +7086,8 @@ module Prism # ^^^^^^^^ class IndexTargetNode < Node # Initialize a new IndexTargetNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, receiver: Node, opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode)).void } - def initialize(source, node_id, location, flags, receiver, opening_loc, arguments, closing_loc, block); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: Node, opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode)).void } + def initialize(source, node_id, location, flags, comments, receiver, opening_loc, arguments, closing_loc, block); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -7418,13 +7106,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, receiver: Node, opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode)).returns(IndexTargetNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), receiver: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), receiver: Node, opening_loc: Location, arguments: ::T.nilable(ArgumentsNode), closing_loc: Location, block: ::T.nilable(BlockArgumentNode)).returns(IndexTargetNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), receiver: T.unsafe(nil), opening_loc: T.unsafe(nil), arguments: T.unsafe(nil), closing_loc: T.unsafe(nil), block: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -7507,8 +7191,8 @@ module Prism # ^^^^^^^^^^^^^^^^^ class InstanceVariableAndWriteNode < Node # Initialize a new InstanceVariableAndWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -7527,13 +7211,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(InstanceVariableAndWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(InstanceVariableAndWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -7592,8 +7272,8 @@ module Prism # ^^^^^^^^^^^^^^^^ class InstanceVariableOperatorWriteNode < Node # Initialize a new InstanceVariableOperatorWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).void } - def initialize(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, binary_operator_loc, value, binary_operator); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -7612,13 +7292,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).returns(InstanceVariableOperatorWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Node, binary_operator: Symbol).returns(InstanceVariableOperatorWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -7677,8 +7353,8 @@ module Prism # ^^^^^^^^^^^^^^^^^ class InstanceVariableOrWriteNode < Node # Initialize a new InstanceVariableOrWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -7697,13 +7373,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(InstanceVariableOrWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(InstanceVariableOrWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -7762,8 +7434,8 @@ module Prism # ^^^^ class InstanceVariableReadNode < Node # Initialize a new InstanceVariableReadNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void } - def initialize(source, node_id, location, flags, name); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).void } + def initialize(source, node_id, location, flags, comments, name); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -7782,13 +7454,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol).returns(InstanceVariableReadNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).returns(InstanceVariableReadNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -7825,8 +7493,8 @@ module Prism # ^^^^ ^^^^ class InstanceVariableTargetNode < Node # Initialize a new InstanceVariableTargetNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void } - def initialize(source, node_id, location, flags, name); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).void } + def initialize(source, node_id, location, flags, comments, name); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -7845,13 +7513,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol).returns(InstanceVariableTargetNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).returns(InstanceVariableTargetNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -7884,8 +7548,8 @@ module Prism # ^^^^^^^^ class InstanceVariableWriteNode < Node # Initialize a new InstanceVariableWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, value: Node, operator_loc: Location).void } - def initialize(source, node_id, location, flags, name, name_loc, value, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, value: Node, operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, value, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -7904,13 +7568,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, value: Node, operator_loc: Location).returns(InstanceVariableWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, value: Node, operator_loc: Location).returns(InstanceVariableWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -7985,8 +7645,8 @@ module Prism # ^ class IntegerNode < Node # Initialize a new IntegerNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, value: Integer).void } - def initialize(source, node_id, location, flags, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), value: Integer).void } + def initialize(source, node_id, location, flags, comments, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -8005,13 +7665,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, value: Integer).returns(IntegerNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), value: Integer).returns(IntegerNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -8060,8 +7716,8 @@ module Prism # ^^^^^^^^^^^^^^^^ class InterpolatedMatchLastLineNode < Node # Initialize a new InterpolatedMatchLastLineNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: Location, parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: Location).void } - def initialize(source, node_id, location, flags, opening_loc, parts, closing_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: Location, parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: Location).void } + def initialize(source, node_id, location, flags, comments, opening_loc, parts, closing_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -8080,13 +7736,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, opening_loc: Location, parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: Location).returns(InterpolatedMatchLastLineNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: Location, parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: Location).returns(InterpolatedMatchLastLineNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -8189,8 +7841,8 @@ module Prism # ^^^^^^^^^^^^^^^^ class InterpolatedRegularExpressionNode < Node # Initialize a new InterpolatedRegularExpressionNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: Location, parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: Location).void } - def initialize(source, node_id, location, flags, opening_loc, parts, closing_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: Location, parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: Location).void } + def initialize(source, node_id, location, flags, comments, opening_loc, parts, closing_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -8209,13 +7861,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, opening_loc: Location, parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: Location).returns(InterpolatedRegularExpressionNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: Location, parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: Location).returns(InterpolatedRegularExpressionNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -8318,8 +7966,8 @@ module Prism # ^^^^^^^^^^^^^^^^ class InterpolatedStringNode < Node # Initialize a new InterpolatedStringNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: ::T.nilable(Location), parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode, InterpolatedStringNode)], closing_loc: ::T.nilable(Location)).void } - def initialize(source, node_id, location, flags, opening_loc, parts, closing_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: ::T.nilable(Location), parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode, InterpolatedStringNode)], closing_loc: ::T.nilable(Location)).void } + def initialize(source, node_id, location, flags, comments, opening_loc, parts, closing_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -8338,13 +7986,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, opening_loc: ::T.nilable(Location), parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode, InterpolatedStringNode)], closing_loc: ::T.nilable(Location)).returns(InterpolatedStringNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: ::T.nilable(Location), parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode, InterpolatedStringNode)], closing_loc: ::T.nilable(Location)).returns(InterpolatedStringNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -8411,8 +8055,8 @@ module Prism # ^^^^^^^^^^^^^^^^^ class InterpolatedSymbolNode < Node # Initialize a new InterpolatedSymbolNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: ::T.nilable(Location), parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: ::T.nilable(Location)).void } - def initialize(source, node_id, location, flags, opening_loc, parts, closing_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: ::T.nilable(Location), parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: ::T.nilable(Location)).void } + def initialize(source, node_id, location, flags, comments, opening_loc, parts, closing_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -8431,13 +8075,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, opening_loc: ::T.nilable(Location), parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: ::T.nilable(Location)).returns(InterpolatedSymbolNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: ::T.nilable(Location), parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: ::T.nilable(Location)).returns(InterpolatedSymbolNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -8496,8 +8136,8 @@ module Prism # ^^^^^^^^^^^^^^^^ class InterpolatedXStringNode < Node # Initialize a new InterpolatedXStringNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: Location, parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: Location).void } - def initialize(source, node_id, location, flags, opening_loc, parts, closing_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: Location, parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: Location).void } + def initialize(source, node_id, location, flags, comments, opening_loc, parts, closing_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -8516,13 +8156,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, opening_loc: Location, parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: Location).returns(InterpolatedXStringNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: Location, parts: T::Array[::T.any(StringNode, EmbeddedStatementsNode, EmbeddedVariableNode)], closing_loc: Location).returns(InterpolatedXStringNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -8581,8 +8217,8 @@ module Prism # ^^ class ItLocalVariableReadNode < Node # Initialize a new ItLocalVariableReadNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void } - def initialize(source, node_id, location, flags); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).void } + def initialize(source, node_id, location, flags, comments); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -8601,13 +8237,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer).returns(ItLocalVariableReadNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).returns(ItLocalVariableReadNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -8636,8 +8268,8 @@ module Prism # ^^^^^^^^^^^^^^ class ItParametersNode < Node # Initialize a new ItParametersNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void } - def initialize(source, node_id, location, flags); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).void } + def initialize(source, node_id, location, flags, comments); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -8656,13 +8288,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer).returns(ItParametersNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).returns(ItParametersNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -8691,8 +8319,8 @@ module Prism # ^^^^ class KeywordHashNode < Node # Initialize a new KeywordHashNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, elements: T::Array[::T.any(AssocNode, AssocSplatNode)]).void } - def initialize(source, node_id, location, flags, elements); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), elements: T::Array[::T.any(AssocNode, AssocSplatNode)]).void } + def initialize(source, node_id, location, flags, comments, elements); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -8711,13 +8339,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, elements: T::Array[::T.any(AssocNode, AssocSplatNode)]).returns(KeywordHashNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), elements: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), elements: T::Array[::T.any(AssocNode, AssocSplatNode)]).returns(KeywordHashNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), elements: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -8755,8 +8379,8 @@ module Prism # end class KeywordRestParameterNode < Node # Initialize a new KeywordRestParameterNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: ::T.nilable(Symbol), name_loc: ::T.nilable(Location), operator_loc: Location).void } - def initialize(source, node_id, location, flags, name, name_loc, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: ::T.nilable(Symbol), name_loc: ::T.nilable(Location), operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -8775,13 +8399,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: ::T.nilable(Symbol), name_loc: ::T.nilable(Location), operator_loc: Location).returns(KeywordRestParameterNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: ::T.nilable(Symbol), name_loc: ::T.nilable(Location), operator_loc: Location).returns(KeywordRestParameterNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -8840,8 +8460,8 @@ module Prism # ^^^^^^^^^^^^^^^^^^^^^^^ class LambdaNode < Node # Initialize a new LambdaNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, locals: T::Array[Symbol], operator_loc: Location, opening_loc: Location, closing_loc: Location, parameters: ::T.nilable(::T.any(BlockParametersNode, NumberedParametersNode, ItParametersNode)), body: ::T.nilable(::T.any(StatementsNode, BeginNode))).void } - def initialize(source, node_id, location, flags, locals, operator_loc, opening_loc, closing_loc, parameters, body); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), locals: T::Array[Symbol], operator_loc: Location, opening_loc: Location, closing_loc: Location, parameters: ::T.nilable(::T.any(BlockParametersNode, NumberedParametersNode, ItParametersNode)), body: ::T.nilable(::T.any(StatementsNode, BeginNode))).void } + def initialize(source, node_id, location, flags, comments, locals, operator_loc, opening_loc, closing_loc, parameters, body); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -8860,13 +8480,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, locals: T::Array[Symbol], operator_loc: Location, opening_loc: Location, closing_loc: Location, parameters: ::T.nilable(::T.any(BlockParametersNode, NumberedParametersNode, ItParametersNode)), body: ::T.nilable(::T.any(StatementsNode, BeginNode))).returns(LambdaNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), locals: T::Array[Symbol], operator_loc: Location, opening_loc: Location, closing_loc: Location, parameters: ::T.nilable(::T.any(BlockParametersNode, NumberedParametersNode, ItParametersNode)), body: ::T.nilable(::T.any(StatementsNode, BeginNode))).returns(LambdaNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), locals: T.unsafe(nil), operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -8946,8 +8562,8 @@ module Prism # ^^^^^^^^^^^^^^^^ class LocalVariableAndWriteNode < Node # Initialize a new LocalVariableAndWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name_loc: Location, operator_loc: Location, value: Node, name: Symbol, depth: Integer).void } - def initialize(source, node_id, location, flags, name_loc, operator_loc, value, name, depth); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name_loc: Location, operator_loc: Location, value: Node, name: Symbol, depth: Integer).void } + def initialize(source, node_id, location, flags, comments, name_loc, operator_loc, value, name, depth); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -8966,13 +8582,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name_loc: Location, operator_loc: Location, value: Node, name: Symbol, depth: Integer).returns(LocalVariableAndWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name_loc: Location, operator_loc: Location, value: Node, name: Symbol, depth: Integer).returns(LocalVariableAndWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -9035,8 +8647,8 @@ module Prism # ^^^^^^^^^^^^^^^ class LocalVariableOperatorWriteNode < Node # Initialize a new LocalVariableOperatorWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name_loc: Location, binary_operator_loc: Location, value: Node, name: Symbol, binary_operator: Symbol, depth: Integer).void } - def initialize(source, node_id, location, flags, name_loc, binary_operator_loc, value, name, binary_operator, depth); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name_loc: Location, binary_operator_loc: Location, value: Node, name: Symbol, binary_operator: Symbol, depth: Integer).void } + def initialize(source, node_id, location, flags, comments, name_loc, binary_operator_loc, value, name, binary_operator, depth); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -9055,13 +8667,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name_loc: Location, binary_operator_loc: Location, value: Node, name: Symbol, binary_operator: Symbol, depth: Integer).returns(LocalVariableOperatorWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), binary_operator: T.unsafe(nil), depth: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name_loc: Location, binary_operator_loc: Location, value: Node, name: Symbol, binary_operator: Symbol, depth: Integer).returns(LocalVariableOperatorWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), binary_operator: T.unsafe(nil), depth: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -9124,8 +8732,8 @@ module Prism # ^^^^^^^^^^^^^^^^ class LocalVariableOrWriteNode < Node # Initialize a new LocalVariableOrWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name_loc: Location, operator_loc: Location, value: Node, name: Symbol, depth: Integer).void } - def initialize(source, node_id, location, flags, name_loc, operator_loc, value, name, depth); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name_loc: Location, operator_loc: Location, value: Node, name: Symbol, depth: Integer).void } + def initialize(source, node_id, location, flags, comments, name_loc, operator_loc, value, name, depth); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -9144,13 +8752,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name_loc: Location, operator_loc: Location, value: Node, name: Symbol, depth: Integer).returns(LocalVariableOrWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name_loc: Location, operator_loc: Location, value: Node, name: Symbol, depth: Integer).returns(LocalVariableOrWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -9213,8 +8817,8 @@ module Prism # ^^^ class LocalVariableReadNode < Node # Initialize a new LocalVariableReadNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, depth: Integer).void } - def initialize(source, node_id, location, flags, name, depth); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, depth: Integer).void } + def initialize(source, node_id, location, flags, comments, name, depth); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -9233,13 +8837,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, depth: Integer).returns(LocalVariableReadNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, depth: Integer).returns(LocalVariableReadNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -9293,8 +8893,8 @@ module Prism # ^^^ class LocalVariableTargetNode < Node # Initialize a new LocalVariableTargetNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, depth: Integer).void } - def initialize(source, node_id, location, flags, name, depth); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, depth: Integer).void } + def initialize(source, node_id, location, flags, comments, name, depth); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -9313,13 +8913,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, depth: Integer).returns(LocalVariableTargetNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, depth: Integer).returns(LocalVariableTargetNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -9356,8 +8952,8 @@ module Prism # ^^^^^^^ class LocalVariableWriteNode < Node # Initialize a new LocalVariableWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, depth: Integer, name_loc: Location, value: Node, operator_loc: Location).void } - def initialize(source, node_id, location, flags, name, depth, name_loc, value, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, depth: Integer, name_loc: Location, value: Node, operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, name, depth, name_loc, value, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -9376,13 +8972,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, depth: Integer, name_loc: Location, value: Node, operator_loc: Location).returns(LocalVariableWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, depth: Integer, name_loc: Location, value: Node, operator_loc: Location).returns(LocalVariableWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -9471,8 +9063,8 @@ module Prism # ^^^^^^ class MatchLastLineNode < Node # Initialize a new MatchLastLineNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String).void } - def initialize(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String).void } + def initialize(source, node_id, location, flags, comments, opening_loc, content_loc, closing_loc, unescaped); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -9491,13 +9083,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String).returns(MatchLastLineNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String).returns(MatchLastLineNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -9613,8 +9201,8 @@ module Prism # ^^^^^^^^^^ class MatchPredicateNode < Node # Initialize a new MatchPredicateNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, value: Node, pattern: Node, operator_loc: Location).void } - def initialize(source, node_id, location, flags, value, pattern, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), value: Node, pattern: Node, operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, value, pattern, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -9633,13 +9221,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, value: Node, pattern: Node, operator_loc: Location).returns(MatchPredicateNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil), pattern: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), value: Node, pattern: Node, operator_loc: Location).returns(MatchPredicateNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), value: T.unsafe(nil), pattern: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -9689,8 +9273,8 @@ module Prism # ^^^^^^^^^^ class MatchRequiredNode < Node # Initialize a new MatchRequiredNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, value: Node, pattern: Node, operator_loc: Location).void } - def initialize(source, node_id, location, flags, value, pattern, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), value: Node, pattern: Node, operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, value, pattern, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -9709,13 +9293,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, value: Node, pattern: Node, operator_loc: Location).returns(MatchRequiredNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil), pattern: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), value: Node, pattern: Node, operator_loc: Location).returns(MatchRequiredNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), value: T.unsafe(nil), pattern: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -9813,8 +9393,8 @@ module Prism # ^^^^^^^^^^^^^^^^^^^^ class MatchWriteNode < Node # Initialize a new MatchWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, call: CallNode, targets: T::Array[LocalVariableTargetNode]).void } - def initialize(source, node_id, location, flags, call, targets); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), call: CallNode, targets: T::Array[LocalVariableTargetNode]).void } + def initialize(source, node_id, location, flags, comments, call, targets); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -9833,13 +9413,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, call: CallNode, targets: T::Array[LocalVariableTargetNode]).returns(MatchWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), call: T.unsafe(nil), targets: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), call: CallNode, targets: T::Array[LocalVariableTargetNode]).returns(MatchWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), call: T.unsafe(nil), targets: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -9876,8 +9452,8 @@ module Prism # ^^^^^^^^^^^^^^ class ModuleNode < Node # Initialize a new ModuleNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, locals: T::Array[Symbol], module_keyword_loc: Location, constant_path: ::T.any(ConstantReadNode, ConstantPathNode), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), end_keyword_loc: Location, name: Symbol).void } - def initialize(source, node_id, location, flags, locals, module_keyword_loc, constant_path, body, end_keyword_loc, name); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), locals: T::Array[Symbol], module_keyword_loc: Location, constant_path: ::T.any(ConstantReadNode, ConstantPathNode), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), end_keyword_loc: Location, name: Symbol).void } + def initialize(source, node_id, location, flags, comments, locals, module_keyword_loc, constant_path, body, end_keyword_loc, name); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -9896,13 +9472,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, locals: T::Array[Symbol], module_keyword_loc: Location, constant_path: ::T.any(ConstantReadNode, ConstantPathNode), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), end_keyword_loc: Location, name: Symbol).returns(ModuleNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), module_keyword_loc: T.unsafe(nil), constant_path: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), name: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), locals: T::Array[Symbol], module_keyword_loc: Location, constant_path: ::T.any(ConstantReadNode, ConstantPathNode), body: ::T.nilable(::T.any(StatementsNode, BeginNode)), end_keyword_loc: Location, name: Symbol).returns(ModuleNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), locals: T.unsafe(nil), module_keyword_loc: T.unsafe(nil), constant_path: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), name: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -9978,8 +9550,8 @@ module Prism # ^^^^ class MultiTargetNode < Node # Initialize a new MultiTargetNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, lefts: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode, RequiredParameterNode)], rest: ::T.nilable(::T.any(ImplicitRestNode, SplatNode)), rights: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode, RequiredParameterNode)], lparen_loc: ::T.nilable(Location), rparen_loc: ::T.nilable(Location)).void } - def initialize(source, node_id, location, flags, lefts, rest, rights, lparen_loc, rparen_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), lefts: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode, RequiredParameterNode)], rest: ::T.nilable(::T.any(ImplicitRestNode, SplatNode)), rights: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode, RequiredParameterNode)], lparen_loc: ::T.nilable(Location), rparen_loc: ::T.nilable(Location)).void } + def initialize(source, node_id, location, flags, comments, lefts, rest, rights, lparen_loc, rparen_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -9998,13 +9570,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, lefts: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode, RequiredParameterNode)], rest: ::T.nilable(::T.any(ImplicitRestNode, SplatNode)), rights: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode, RequiredParameterNode)], lparen_loc: ::T.nilable(Location), rparen_loc: ::T.nilable(Location)).returns(MultiTargetNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), lefts: T.unsafe(nil), rest: T.unsafe(nil), rights: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), lefts: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode, RequiredParameterNode)], rest: ::T.nilable(::T.any(ImplicitRestNode, SplatNode)), rights: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode, RequiredParameterNode)], lparen_loc: ::T.nilable(Location), rparen_loc: ::T.nilable(Location)).returns(MultiTargetNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), lefts: T.unsafe(nil), rest: T.unsafe(nil), rights: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -10101,8 +9669,8 @@ module Prism # ^^^^^^^^^^^^^^^^^ class MultiWriteNode < Node # Initialize a new MultiWriteNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, lefts: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode)], rest: ::T.nilable(::T.any(ImplicitRestNode, SplatNode)), rights: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode)], lparen_loc: ::T.nilable(Location), rparen_loc: ::T.nilable(Location), operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, lefts, rest, rights, lparen_loc, rparen_loc, operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), lefts: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode)], rest: ::T.nilable(::T.any(ImplicitRestNode, SplatNode)), rights: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode)], lparen_loc: ::T.nilable(Location), rparen_loc: ::T.nilable(Location), operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, lefts, rest, rights, lparen_loc, rparen_loc, operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -10121,13 +9689,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, lefts: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode)], rest: ::T.nilable(::T.any(ImplicitRestNode, SplatNode)), rights: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode)], lparen_loc: ::T.nilable(Location), rparen_loc: ::T.nilable(Location), operator_loc: Location, value: Node).returns(MultiWriteNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), lefts: T.unsafe(nil), rest: T.unsafe(nil), rights: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), lefts: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode)], rest: ::T.nilable(::T.any(ImplicitRestNode, SplatNode)), rights: T::Array[::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode, MultiTargetNode)], lparen_loc: ::T.nilable(Location), rparen_loc: ::T.nilable(Location), operator_loc: Location, value: Node).returns(MultiWriteNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), lefts: T.unsafe(nil), rest: T.unsafe(nil), rights: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -10247,8 +9811,8 @@ module Prism # ^^^^^^ class NextNode < Node # Initialize a new NextNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, arguments: ::T.nilable(ArgumentsNode), keyword_loc: Location).void } - def initialize(source, node_id, location, flags, arguments, keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), arguments: ::T.nilable(ArgumentsNode), keyword_loc: Location).void } + def initialize(source, node_id, location, flags, comments, arguments, keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -10267,13 +9831,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, arguments: ::T.nilable(ArgumentsNode), keyword_loc: Location).returns(NextNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), arguments: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), arguments: ::T.nilable(ArgumentsNode), keyword_loc: Location).returns(NextNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), arguments: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -10319,8 +9879,8 @@ module Prism # ^^^ class NilNode < Node # Initialize a new NilNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void } - def initialize(source, node_id, location, flags); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).void } + def initialize(source, node_id, location, flags, comments); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -10339,13 +9899,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer).returns(NilNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).returns(NilNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -10375,8 +9931,8 @@ module Prism # end class NoBlockParameterNode < Node # Initialize a new NoBlockParameterNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, operator_loc: Location, keyword_loc: Location).void } - def initialize(source, node_id, location, flags, operator_loc, keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), operator_loc: Location, keyword_loc: Location).void } + def initialize(source, node_id, location, flags, comments, operator_loc, keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -10395,13 +9951,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, operator_loc: Location, keyword_loc: Location).returns(NoBlockParameterNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), operator_loc: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), operator_loc: Location, keyword_loc: Location).returns(NoBlockParameterNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), operator_loc: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -10457,8 +10009,8 @@ module Prism # end class NoKeywordsParameterNode < Node # Initialize a new NoKeywordsParameterNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, operator_loc: Location, keyword_loc: Location).void } - def initialize(source, node_id, location, flags, operator_loc, keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), operator_loc: Location, keyword_loc: Location).void } + def initialize(source, node_id, location, flags, comments, operator_loc, keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -10477,13 +10029,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, operator_loc: Location, keyword_loc: Location).returns(NoKeywordsParameterNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), operator_loc: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), operator_loc: Location, keyword_loc: Location).returns(NoKeywordsParameterNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), operator_loc: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -10538,8 +10086,8 @@ module Prism # ^^^^^^^^^^^^^^ class NumberedParametersNode < Node # Initialize a new NumberedParametersNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, maximum: Integer).void } - def initialize(source, node_id, location, flags, maximum); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), maximum: Integer).void } + def initialize(source, node_id, location, flags, comments, maximum); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -10558,13 +10106,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, maximum: Integer).returns(NumberedParametersNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), maximum: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), maximum: Integer).returns(NumberedParametersNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), maximum: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -10597,8 +10141,8 @@ module Prism # ^^ class NumberedReferenceReadNode < Node # Initialize a new NumberedReferenceReadNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, number: Integer).void } - def initialize(source, node_id, location, flags, number); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), number: Integer).void } + def initialize(source, node_id, location, flags, comments, number); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -10617,13 +10161,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, number: Integer).returns(NumberedReferenceReadNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), number: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), number: Integer).returns(NumberedReferenceReadNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), number: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -10663,8 +10203,8 @@ module Prism # end class OptionalKeywordParameterNode < Node # Initialize a new OptionalKeywordParameterNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, name, name_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -10683,13 +10223,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, value: Node).returns(OptionalKeywordParameterNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, value: Node).returns(OptionalKeywordParameterNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -10740,8 +10276,8 @@ module Prism # end class OptionalParameterNode < Node # Initialize a new OptionalParameterNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } - def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, operator_loc, value); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -10760,13 +10296,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(OptionalParameterNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location, operator_loc: Location, value: Node).returns(OptionalParameterNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -10829,8 +10361,8 @@ module Prism # ^^^^^^^^^^^^^ class OrNode < Node # Initialize a new OrNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, left: Node, right: Node, operator_loc: Location).void } - def initialize(source, node_id, location, flags, left, right, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), left: Node, right: Node, operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, left, right, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -10849,13 +10381,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, left: Node, right: Node, operator_loc: Location).returns(OrNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), left: Node, right: Node, operator_loc: Location).returns(OrNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -10921,8 +10449,8 @@ module Prism # end class ParametersNode < Node # Initialize a new ParametersNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, requireds: T::Array[::T.any(RequiredParameterNode, MultiTargetNode)], optionals: T::Array[OptionalParameterNode], rest: ::T.nilable(::T.any(RestParameterNode, ImplicitRestNode)), posts: T::Array[::T.any(RequiredParameterNode, MultiTargetNode)], keywords: T::Array[::T.any(RequiredKeywordParameterNode, OptionalKeywordParameterNode)], keyword_rest: ::T.nilable(::T.any(KeywordRestParameterNode, ForwardingParameterNode, NoKeywordsParameterNode)), block: ::T.nilable(::T.any(BlockParameterNode, NoBlockParameterNode))).void } - def initialize(source, node_id, location, flags, requireds, optionals, rest, posts, keywords, keyword_rest, block); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), requireds: T::Array[::T.any(RequiredParameterNode, MultiTargetNode)], optionals: T::Array[OptionalParameterNode], rest: ::T.nilable(::T.any(RestParameterNode, ImplicitRestNode)), posts: T::Array[::T.any(RequiredParameterNode, MultiTargetNode)], keywords: T::Array[::T.any(RequiredKeywordParameterNode, OptionalKeywordParameterNode)], keyword_rest: ::T.nilable(::T.any(KeywordRestParameterNode, ForwardingParameterNode, NoKeywordsParameterNode)), block: ::T.nilable(::T.any(BlockParameterNode, NoBlockParameterNode))).void } + def initialize(source, node_id, location, flags, comments, requireds, optionals, rest, posts, keywords, keyword_rest, block); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -10941,13 +10469,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, requireds: T::Array[::T.any(RequiredParameterNode, MultiTargetNode)], optionals: T::Array[OptionalParameterNode], rest: ::T.nilable(::T.any(RestParameterNode, ImplicitRestNode)), posts: T::Array[::T.any(RequiredParameterNode, MultiTargetNode)], keywords: T::Array[::T.any(RequiredKeywordParameterNode, OptionalKeywordParameterNode)], keyword_rest: ::T.nilable(::T.any(KeywordRestParameterNode, ForwardingParameterNode, NoKeywordsParameterNode)), block: ::T.nilable(::T.any(BlockParameterNode, NoBlockParameterNode))).returns(ParametersNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), requireds: T.unsafe(nil), optionals: T.unsafe(nil), rest: T.unsafe(nil), posts: T.unsafe(nil), keywords: T.unsafe(nil), keyword_rest: T.unsafe(nil), block: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), requireds: T::Array[::T.any(RequiredParameterNode, MultiTargetNode)], optionals: T::Array[OptionalParameterNode], rest: ::T.nilable(::T.any(RestParameterNode, ImplicitRestNode)), posts: T::Array[::T.any(RequiredParameterNode, MultiTargetNode)], keywords: T::Array[::T.any(RequiredKeywordParameterNode, OptionalKeywordParameterNode)], keyword_rest: ::T.nilable(::T.any(KeywordRestParameterNode, ForwardingParameterNode, NoKeywordsParameterNode)), block: ::T.nilable(::T.any(BlockParameterNode, NoBlockParameterNode))).returns(ParametersNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), requireds: T.unsafe(nil), optionals: T.unsafe(nil), rest: T.unsafe(nil), posts: T.unsafe(nil), keywords: T.unsafe(nil), keyword_rest: T.unsafe(nil), block: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -11004,8 +10528,8 @@ module Prism # ^^^^^^^^^ class ParenthesesNode < Node # Initialize a new ParenthesesNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, body: ::T.nilable(Node), opening_loc: Location, closing_loc: Location).void } - def initialize(source, node_id, location, flags, body, opening_loc, closing_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), body: ::T.nilable(Node), opening_loc: Location, closing_loc: Location).void } + def initialize(source, node_id, location, flags, comments, body, opening_loc, closing_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -11024,13 +10548,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, body: ::T.nilable(Node), opening_loc: Location, closing_loc: Location).returns(ParenthesesNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), body: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), body: ::T.nilable(Node), opening_loc: Location, closing_loc: Location).returns(ParenthesesNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), body: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -11093,8 +10613,8 @@ module Prism # ^^^^^^ class PinnedExpressionNode < Node # Initialize a new PinnedExpressionNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, expression: Node, operator_loc: Location, lparen_loc: Location, rparen_loc: Location).void } - def initialize(source, node_id, location, flags, expression, operator_loc, lparen_loc, rparen_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), expression: Node, operator_loc: Location, lparen_loc: Location, rparen_loc: Location).void } + def initialize(source, node_id, location, flags, comments, expression, operator_loc, lparen_loc, rparen_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -11113,13 +10633,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, expression: Node, operator_loc: Location, lparen_loc: Location, rparen_loc: Location).returns(PinnedExpressionNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), expression: T.unsafe(nil), operator_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), expression: Node, operator_loc: Location, lparen_loc: Location, rparen_loc: Location).returns(PinnedExpressionNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), expression: T.unsafe(nil), operator_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -11203,8 +10719,8 @@ module Prism # ^^^^ class PinnedVariableNode < Node # Initialize a new PinnedVariableNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, variable: ::T.any(LocalVariableReadNode, InstanceVariableReadNode, ClassVariableReadNode, GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode, ItLocalVariableReadNode), operator_loc: Location).void } - def initialize(source, node_id, location, flags, variable, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), variable: ::T.any(LocalVariableReadNode, InstanceVariableReadNode, ClassVariableReadNode, GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode, ItLocalVariableReadNode), operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, variable, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -11223,13 +10739,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, variable: ::T.any(LocalVariableReadNode, InstanceVariableReadNode, ClassVariableReadNode, GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode, ItLocalVariableReadNode), operator_loc: Location).returns(PinnedVariableNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), variable: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), variable: ::T.any(LocalVariableReadNode, InstanceVariableReadNode, ClassVariableReadNode, GlobalVariableReadNode, BackReferenceReadNode, NumberedReferenceReadNode, ItLocalVariableReadNode), operator_loc: Location).returns(PinnedVariableNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), variable: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -11281,8 +10793,8 @@ module Prism # ^^^^^^^^^^^ class PostExecutionNode < Node # Initialize a new PostExecutionNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, statements: ::T.nilable(StatementsNode), keyword_loc: Location, opening_loc: Location, closing_loc: Location).void } - def initialize(source, node_id, location, flags, statements, keyword_loc, opening_loc, closing_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), statements: ::T.nilable(StatementsNode), keyword_loc: Location, opening_loc: Location, closing_loc: Location).void } + def initialize(source, node_id, location, flags, comments, statements, keyword_loc, opening_loc, closing_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -11301,13 +10813,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, statements: ::T.nilable(StatementsNode), keyword_loc: Location, opening_loc: Location, closing_loc: Location).returns(PostExecutionNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), statements: T.unsafe(nil), keyword_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), statements: ::T.nilable(StatementsNode), keyword_loc: Location, opening_loc: Location, closing_loc: Location).returns(PostExecutionNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), statements: T.unsafe(nil), keyword_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -11379,8 +10887,8 @@ module Prism # ^^^^^^^^^^^^^ class PreExecutionNode < Node # Initialize a new PreExecutionNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, statements: ::T.nilable(StatementsNode), keyword_loc: Location, opening_loc: Location, closing_loc: Location).void } - def initialize(source, node_id, location, flags, statements, keyword_loc, opening_loc, closing_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), statements: ::T.nilable(StatementsNode), keyword_loc: Location, opening_loc: Location, closing_loc: Location).void } + def initialize(source, node_id, location, flags, comments, statements, keyword_loc, opening_loc, closing_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -11399,13 +10907,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, statements: ::T.nilable(StatementsNode), keyword_loc: Location, opening_loc: Location, closing_loc: Location).returns(PreExecutionNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), statements: T.unsafe(nil), keyword_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), statements: ::T.nilable(StatementsNode), keyword_loc: Location, opening_loc: Location, closing_loc: Location).returns(PreExecutionNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), statements: T.unsafe(nil), keyword_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -11474,8 +10978,8 @@ module Prism # The top level node of any parse tree. class ProgramNode < Node # Initialize a new ProgramNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, locals: T::Array[Symbol], statements: StatementsNode).void } - def initialize(source, node_id, location, flags, locals, statements); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), locals: T::Array[Symbol], statements: StatementsNode).void } + def initialize(source, node_id, location, flags, comments, locals, statements); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -11494,13 +10998,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, locals: T::Array[Symbol], statements: StatementsNode).returns(ProgramNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), statements: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), locals: T::Array[Symbol], statements: StatementsNode).returns(ProgramNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), locals: T.unsafe(nil), statements: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -11540,8 +11040,8 @@ module Prism # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ class RangeNode < Node # Initialize a new RangeNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, left: ::T.nilable(Node), right: ::T.nilable(Node), operator_loc: Location).void } - def initialize(source, node_id, location, flags, left, right, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), left: ::T.nilable(Node), right: ::T.nilable(Node), operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, left, right, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -11560,13 +11060,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, left: ::T.nilable(Node), right: ::T.nilable(Node), operator_loc: Location).returns(RangeNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), left: ::T.nilable(Node), right: ::T.nilable(Node), operator_loc: Location).returns(RangeNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -11633,8 +11129,8 @@ module Prism # ^^^^ class RationalNode < Node # Initialize a new RationalNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, numerator: Integer, denominator: Integer).void } - def initialize(source, node_id, location, flags, numerator, denominator); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), numerator: Integer, denominator: Integer).void } + def initialize(source, node_id, location, flags, comments, numerator, denominator); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -11653,13 +11149,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, numerator: Integer, denominator: Integer).returns(RationalNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), numerator: T.unsafe(nil), denominator: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), numerator: Integer, denominator: Integer).returns(RationalNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), numerator: T.unsafe(nil), denominator: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -11716,8 +11208,8 @@ module Prism # ^^^^ class RedoNode < Node # Initialize a new RedoNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void } - def initialize(source, node_id, location, flags); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).void } + def initialize(source, node_id, location, flags, comments); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -11736,13 +11228,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer).returns(RedoNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).returns(RedoNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -11771,8 +11259,8 @@ module Prism # ^^^^^^ class RegularExpressionNode < Node # Initialize a new RegularExpressionNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String).void } - def initialize(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String).void } + def initialize(source, node_id, location, flags, comments, opening_loc, content_loc, closing_loc, unescaped); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -11791,13 +11279,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String).returns(RegularExpressionNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String).returns(RegularExpressionNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -11914,8 +11398,8 @@ module Prism # end class RequiredKeywordParameterNode < Node # Initialize a new RequiredKeywordParameterNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location).void } - def initialize(source, node_id, location, flags, name, name_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location).void } + def initialize(source, node_id, location, flags, comments, name, name_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -11934,13 +11418,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol, name_loc: Location).returns(RequiredKeywordParameterNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol, name_loc: Location).returns(RequiredKeywordParameterNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -11987,8 +11467,8 @@ module Prism # end class RequiredParameterNode < Node # Initialize a new RequiredParameterNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: Symbol).void } - def initialize(source, node_id, location, flags, name); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).void } + def initialize(source, node_id, location, flags, comments, name); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -12007,13 +11487,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: Symbol).returns(RequiredParameterNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: Symbol).returns(RequiredParameterNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -12050,8 +11526,8 @@ module Prism # ^^^^^^^^^^^^^^ class RescueModifierNode < Node # Initialize a new RescueModifierNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, expression: Node, keyword_loc: Location, rescue_expression: Node).void } - def initialize(source, node_id, location, flags, expression, keyword_loc, rescue_expression); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), expression: Node, keyword_loc: Location, rescue_expression: Node).void } + def initialize(source, node_id, location, flags, comments, expression, keyword_loc, rescue_expression); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -12070,13 +11546,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, expression: Node, keyword_loc: Location, rescue_expression: Node).returns(RescueModifierNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), expression: T.unsafe(nil), keyword_loc: T.unsafe(nil), rescue_expression: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), expression: Node, keyword_loc: Location, rescue_expression: Node).returns(RescueModifierNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), expression: T.unsafe(nil), keyword_loc: T.unsafe(nil), rescue_expression: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -12131,8 +11603,8 @@ module Prism # `Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `reference` field. class RescueNode < Node # Initialize a new RescueNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, exceptions: T::Array[Node], operator_loc: ::T.nilable(Location), reference: ::T.nilable(::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode)), then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), subsequent: ::T.nilable(RescueNode)).void } - def initialize(source, node_id, location, flags, keyword_loc, exceptions, operator_loc, reference, then_keyword_loc, statements, subsequent); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, exceptions: T::Array[Node], operator_loc: ::T.nilable(Location), reference: ::T.nilable(::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode)), then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), subsequent: ::T.nilable(RescueNode)).void } + def initialize(source, node_id, location, flags, comments, keyword_loc, exceptions, operator_loc, reference, then_keyword_loc, statements, subsequent); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -12151,13 +11623,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, exceptions: T::Array[Node], operator_loc: ::T.nilable(Location), reference: ::T.nilable(::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode)), then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), subsequent: ::T.nilable(RescueNode)).returns(RescueNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), exceptions: T.unsafe(nil), operator_loc: T.unsafe(nil), reference: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), subsequent: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, exceptions: T::Array[Node], operator_loc: ::T.nilable(Location), reference: ::T.nilable(::T.any(LocalVariableTargetNode, InstanceVariableTargetNode, ClassVariableTargetNode, GlobalVariableTargetNode, ConstantTargetNode, ConstantPathTargetNode, CallTargetNode, IndexTargetNode)), then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), subsequent: ::T.nilable(RescueNode)).returns(RescueNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), keyword_loc: T.unsafe(nil), exceptions: T.unsafe(nil), operator_loc: T.unsafe(nil), reference: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), subsequent: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -12242,8 +11710,8 @@ module Prism # end class RestParameterNode < Node # Initialize a new RestParameterNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, name: ::T.nilable(Symbol), name_loc: ::T.nilable(Location), operator_loc: Location).void } - def initialize(source, node_id, location, flags, name, name_loc, operator_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: ::T.nilable(Symbol), name_loc: ::T.nilable(Location), operator_loc: Location).void } + def initialize(source, node_id, location, flags, comments, name, name_loc, operator_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -12262,13 +11730,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, name: ::T.nilable(Symbol), name_loc: ::T.nilable(Location), operator_loc: Location).returns(RestParameterNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), name: ::T.nilable(Symbol), name_loc: ::T.nilable(Location), operator_loc: Location).returns(RestParameterNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -12327,8 +11791,8 @@ module Prism # ^^^^^ class RetryNode < Node # Initialize a new RetryNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void } - def initialize(source, node_id, location, flags); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).void } + def initialize(source, node_id, location, flags, comments); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -12347,13 +11811,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer).returns(RetryNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).returns(RetryNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -12382,8 +11842,8 @@ module Prism # ^^^^^^^^ class ReturnNode < Node # Initialize a new ReturnNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, arguments: ::T.nilable(ArgumentsNode)).void } - def initialize(source, node_id, location, flags, keyword_loc, arguments); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, arguments: ::T.nilable(ArgumentsNode)).void } + def initialize(source, node_id, location, flags, comments, keyword_loc, arguments); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -12402,13 +11862,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, arguments: ::T.nilable(ArgumentsNode)).returns(ReturnNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), arguments: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, arguments: ::T.nilable(ArgumentsNode)).returns(ReturnNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), keyword_loc: T.unsafe(nil), arguments: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -12454,8 +11910,8 @@ module Prism # ^^^^ class SelfNode < Node # Initialize a new SelfNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void } - def initialize(source, node_id, location, flags); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).void } + def initialize(source, node_id, location, flags, comments); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -12474,13 +11930,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer).returns(SelfNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).returns(SelfNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -12510,8 +11962,8 @@ module Prism # ^^^^^^^^^^^^ class ShareableConstantNode < Node # Initialize a new ShareableConstantNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, write: ::T.any(ConstantWriteNode, ConstantAndWriteNode, ConstantOrWriteNode, ConstantOperatorWriteNode, ConstantPathWriteNode, ConstantPathAndWriteNode, ConstantPathOrWriteNode, ConstantPathOperatorWriteNode)).void } - def initialize(source, node_id, location, flags, write); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), write: ::T.any(ConstantWriteNode, ConstantAndWriteNode, ConstantOrWriteNode, ConstantOperatorWriteNode, ConstantPathWriteNode, ConstantPathAndWriteNode, ConstantPathOrWriteNode, ConstantPathOperatorWriteNode)).void } + def initialize(source, node_id, location, flags, comments, write); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -12530,13 +11982,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, write: ::T.any(ConstantWriteNode, ConstantAndWriteNode, ConstantOrWriteNode, ConstantOperatorWriteNode, ConstantPathWriteNode, ConstantPathAndWriteNode, ConstantPathOrWriteNode, ConstantPathOperatorWriteNode)).returns(ShareableConstantNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), write: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), write: ::T.any(ConstantWriteNode, ConstantAndWriteNode, ConstantOrWriteNode, ConstantOperatorWriteNode, ConstantPathWriteNode, ConstantPathAndWriteNode, ConstantPathOrWriteNode, ConstantPathOperatorWriteNode)).returns(ShareableConstantNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), write: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -12581,8 +12029,8 @@ module Prism # ^^^^^^^^^^^^^^^^^ class SingletonClassNode < Node # Initialize a new SingletonClassNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, locals: T::Array[Symbol], class_keyword_loc: Location, operator_loc: Location, expression: Node, body: ::T.nilable(::T.any(StatementsNode, BeginNode)), end_keyword_loc: Location).void } - def initialize(source, node_id, location, flags, locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), locals: T::Array[Symbol], class_keyword_loc: Location, operator_loc: Location, expression: Node, body: ::T.nilable(::T.any(StatementsNode, BeginNode)), end_keyword_loc: Location).void } + def initialize(source, node_id, location, flags, comments, locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -12601,13 +12049,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, locals: T::Array[Symbol], class_keyword_loc: Location, operator_loc: Location, expression: Node, body: ::T.nilable(::T.any(StatementsNode, BeginNode)), end_keyword_loc: Location).returns(SingletonClassNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), class_keyword_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), expression: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), locals: T::Array[Symbol], class_keyword_loc: Location, operator_loc: Location, expression: Node, body: ::T.nilable(::T.any(StatementsNode, BeginNode)), end_keyword_loc: Location).returns(SingletonClassNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), locals: T.unsafe(nil), class_keyword_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), expression: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -12687,8 +12131,8 @@ module Prism # ^^^^^^^^^^^^ class SourceEncodingNode < Node # Initialize a new SourceEncodingNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void } - def initialize(source, node_id, location, flags); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).void } + def initialize(source, node_id, location, flags, comments); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -12707,13 +12151,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer).returns(SourceEncodingNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).returns(SourceEncodingNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -12742,8 +12182,8 @@ module Prism # ^^^^^^^^ class SourceFileNode < Node # Initialize a new SourceFileNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, filepath: String).void } - def initialize(source, node_id, location, flags, filepath); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), filepath: String).void } + def initialize(source, node_id, location, flags, comments, filepath); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -12762,13 +12202,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, filepath: String).returns(SourceFileNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), filepath: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), filepath: String).returns(SourceFileNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), filepath: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -12817,8 +12253,8 @@ module Prism # ^^^^^^^^ class SourceLineNode < Node # Initialize a new SourceLineNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void } - def initialize(source, node_id, location, flags); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).void } + def initialize(source, node_id, location, flags, comments); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -12837,13 +12273,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer).returns(SourceLineNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).returns(SourceLineNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -12872,8 +12304,8 @@ module Prism # ^^ class SplatNode < Node # Initialize a new SplatNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, operator_loc: Location, expression: ::T.nilable(Node)).void } - def initialize(source, node_id, location, flags, operator_loc, expression); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), operator_loc: Location, expression: ::T.nilable(Node)).void } + def initialize(source, node_id, location, flags, comments, operator_loc, expression); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -12892,13 +12324,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, operator_loc: Location, expression: ::T.nilable(Node)).returns(SplatNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), operator_loc: T.unsafe(nil), expression: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), operator_loc: Location, expression: ::T.nilable(Node)).returns(SplatNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), operator_loc: T.unsafe(nil), expression: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -12944,8 +12372,8 @@ module Prism # ^^^^^^^^^^^^^ class StatementsNode < Node # Initialize a new StatementsNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, body: T::Array[Node]).void } - def initialize(source, node_id, location, flags, body); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), body: T::Array[Node]).void } + def initialize(source, node_id, location, flags, comments, body); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -12964,13 +12392,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, body: T::Array[Node]).returns(StatementsNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), body: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), body: T::Array[Node]).returns(StatementsNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), body: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -13009,8 +12433,8 @@ module Prism # ^^^^ ^^^^ class StringNode < Node # Initialize a new StringNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: ::T.nilable(Location), content_loc: Location, closing_loc: ::T.nilable(Location), unescaped: String).void } - def initialize(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: ::T.nilable(Location), content_loc: Location, closing_loc: ::T.nilable(Location), unescaped: String).void } + def initialize(source, node_id, location, flags, comments, opening_loc, content_loc, closing_loc, unescaped); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -13029,13 +12453,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, opening_loc: ::T.nilable(Location), content_loc: Location, closing_loc: ::T.nilable(Location), unescaped: String).returns(StringNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: ::T.nilable(Location), content_loc: Location, closing_loc: ::T.nilable(Location), unescaped: String).returns(StringNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -13128,8 +12548,8 @@ module Prism # If no arguments are provided (except for a block), it would be a `ForwardingSuperNode` instead. class SuperNode < Node # Initialize a new SuperNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, lparen_loc: ::T.nilable(Location), arguments: ::T.nilable(ArgumentsNode), rparen_loc: ::T.nilable(Location), block: ::T.nilable(::T.any(BlockNode, BlockArgumentNode))).void } - def initialize(source, node_id, location, flags, keyword_loc, lparen_loc, arguments, rparen_loc, block); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, lparen_loc: ::T.nilable(Location), arguments: ::T.nilable(ArgumentsNode), rparen_loc: ::T.nilable(Location), block: ::T.nilable(::T.any(BlockNode, BlockArgumentNode))).void } + def initialize(source, node_id, location, flags, comments, keyword_loc, lparen_loc, arguments, rparen_loc, block); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -13148,13 +12568,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, lparen_loc: ::T.nilable(Location), arguments: ::T.nilable(ArgumentsNode), rparen_loc: ::T.nilable(Location), block: ::T.nilable(::T.any(BlockNode, BlockArgumentNode))).returns(SuperNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), arguments: T.unsafe(nil), rparen_loc: T.unsafe(nil), block: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, lparen_loc: ::T.nilable(Location), arguments: ::T.nilable(ArgumentsNode), rparen_loc: ::T.nilable(Location), block: ::T.nilable(::T.any(BlockNode, BlockArgumentNode))).returns(SuperNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), keyword_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), arguments: T.unsafe(nil), rparen_loc: T.unsafe(nil), block: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -13233,8 +12649,8 @@ module Prism # ^^^ class SymbolNode < Node # Initialize a new SymbolNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: ::T.nilable(Location), value_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location), unescaped: String).void } - def initialize(source, node_id, location, flags, opening_loc, value_loc, closing_loc, unescaped); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: ::T.nilable(Location), value_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location), unescaped: String).void } + def initialize(source, node_id, location, flags, comments, opening_loc, value_loc, closing_loc, unescaped); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -13253,13 +12669,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, opening_loc: ::T.nilable(Location), value_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location), unescaped: String).returns(SymbolNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), value_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: ::T.nilable(Location), value_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location), unescaped: String).returns(SymbolNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), opening_loc: T.unsafe(nil), value_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -13343,8 +12755,8 @@ module Prism # ^^^^ class TrueNode < Node # Initialize a new TrueNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer).void } - def initialize(source, node_id, location, flags); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).void } + def initialize(source, node_id, location, flags, comments); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -13363,13 +12775,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer).returns(TrueNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base)).returns(TrueNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -13398,8 +12806,8 @@ module Prism # ^^^^^^^^^^^^^^^^^^^^^^ class UndefNode < Node # Initialize a new UndefNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, names: T::Array[::T.any(SymbolNode, InterpolatedSymbolNode)], keyword_loc: Location).void } - def initialize(source, node_id, location, flags, names, keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), names: T::Array[::T.any(SymbolNode, InterpolatedSymbolNode)], keyword_loc: Location).void } + def initialize(source, node_id, location, flags, comments, names, keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -13418,13 +12826,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, names: T::Array[::T.any(SymbolNode, InterpolatedSymbolNode)], keyword_loc: Location).returns(UndefNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), names: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), names: T::Array[::T.any(SymbolNode, InterpolatedSymbolNode)], keyword_loc: Location).returns(UndefNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), names: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -13473,8 +12877,8 @@ module Prism # ^^^^^^^^^^^^^^^^^^^^^^^ class UnlessNode < Node # Initialize a new UnlessNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, predicate: Node, then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), else_clause: ::T.nilable(ElseNode), end_keyword_loc: ::T.nilable(Location)).void } - def initialize(source, node_id, location, flags, keyword_loc, predicate, then_keyword_loc, statements, else_clause, end_keyword_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, predicate: Node, then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), else_clause: ::T.nilable(ElseNode), end_keyword_loc: ::T.nilable(Location)).void } + def initialize(source, node_id, location, flags, comments, keyword_loc, predicate, then_keyword_loc, statements, else_clause, end_keyword_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -13493,13 +12897,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, predicate: Node, then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), else_clause: ::T.nilable(ElseNode), end_keyword_loc: ::T.nilable(Location)).returns(UnlessNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), predicate: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), else_clause: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, predicate: Node, then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode), else_clause: ::T.nilable(ElseNode), end_keyword_loc: ::T.nilable(Location)).returns(UnlessNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), keyword_loc: T.unsafe(nil), predicate: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), else_clause: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -13607,8 +13007,8 @@ module Prism # ^^^^^^^^^^^^^^^^^^^^ class UntilNode < Node # Initialize a new UntilNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, do_keyword_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location), predicate: Node, statements: ::T.nilable(StatementsNode)).void } - def initialize(source, node_id, location, flags, keyword_loc, do_keyword_loc, closing_loc, predicate, statements); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, do_keyword_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location), predicate: Node, statements: ::T.nilable(StatementsNode)).void } + def initialize(source, node_id, location, flags, comments, keyword_loc, do_keyword_loc, closing_loc, predicate, statements); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -13627,13 +13027,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, do_keyword_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location), predicate: Node, statements: ::T.nilable(StatementsNode)).returns(UntilNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), do_keyword_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), predicate: T.unsafe(nil), statements: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, do_keyword_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location), predicate: Node, statements: ::T.nilable(StatementsNode)).returns(UntilNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), keyword_loc: T.unsafe(nil), do_keyword_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), predicate: T.unsafe(nil), statements: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -13715,8 +13111,8 @@ module Prism # end class WhenNode < Node # Initialize a new WhenNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, conditions: T::Array[Node], then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode)).void } - def initialize(source, node_id, location, flags, keyword_loc, conditions, then_keyword_loc, statements); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, conditions: T::Array[Node], then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode)).void } + def initialize(source, node_id, location, flags, comments, keyword_loc, conditions, then_keyword_loc, statements); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -13735,13 +13131,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, conditions: T::Array[Node], then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode)).returns(WhenNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), conditions: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, conditions: T::Array[Node], then_keyword_loc: ::T.nilable(Location), statements: ::T.nilable(StatementsNode)).returns(WhenNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), keyword_loc: T.unsafe(nil), conditions: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -13807,8 +13199,8 @@ module Prism # ^^^^^^^^^^^^^^^^^^^^ class WhileNode < Node # Initialize a new WhileNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, do_keyword_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location), predicate: Node, statements: ::T.nilable(StatementsNode)).void } - def initialize(source, node_id, location, flags, keyword_loc, do_keyword_loc, closing_loc, predicate, statements); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, do_keyword_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location), predicate: Node, statements: ::T.nilable(StatementsNode)).void } + def initialize(source, node_id, location, flags, comments, keyword_loc, do_keyword_loc, closing_loc, predicate, statements); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -13827,13 +13219,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, do_keyword_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location), predicate: Node, statements: ::T.nilable(StatementsNode)).returns(WhileNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), do_keyword_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), predicate: T.unsafe(nil), statements: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, do_keyword_loc: ::T.nilable(Location), closing_loc: ::T.nilable(Location), predicate: Node, statements: ::T.nilable(StatementsNode)).returns(WhileNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), keyword_loc: T.unsafe(nil), do_keyword_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), predicate: T.unsafe(nil), statements: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -13913,8 +13301,8 @@ module Prism # ^^^^^ class XStringNode < Node # Initialize a new XStringNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String).void } - def initialize(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String).void } + def initialize(source, node_id, location, flags, comments, opening_loc, content_loc, closing_loc, unescaped); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -13933,13 +13321,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String).returns(XStringNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String).returns(XStringNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), opening_loc: T.unsafe(nil), content_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), unescaped: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end @@ -14019,8 +13403,8 @@ module Prism # ^^^^^^^ class YieldNode < Node # Initialize a new YieldNode node. - sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, lparen_loc: ::T.nilable(Location), arguments: ::T.nilable(ArgumentsNode), rparen_loc: ::T.nilable(Location)).void } - def initialize(source, node_id, location, flags, keyword_loc, lparen_loc, arguments, rparen_loc); end + sig { params(source: Source, node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, lparen_loc: ::T.nilable(Location), arguments: ::T.nilable(ArgumentsNode), rparen_loc: ::T.nilable(Location)).void } + def initialize(source, node_id, location, flags, comments, keyword_loc, lparen_loc, arguments, rparen_loc); end # See Node.accept. sig { override.params(visitor: Visitor).returns(::T.untyped) } @@ -14039,13 +13423,9 @@ module Prism sig { override.returns(T::Array[Node]) } def compact_child_nodes; end - # See Node.comment_targets. - sig { override.returns(T::Array[::T.any(Node, Location)]) } - def comment_targets; end - # Creates a copy of self with the given fields, using self as the template. - sig { params(node_id: Integer, location: Location, flags: Integer, keyword_loc: Location, lparen_loc: ::T.nilable(Location), arguments: ::T.nilable(ArgumentsNode), rparen_loc: ::T.nilable(Location)).returns(YieldNode) } - def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), arguments: T.unsafe(nil), rparen_loc: T.unsafe(nil)); end + sig { params(node_id: Integer, location: Location, flags: Integer, comments: ::T.nilable(Comments::Base), keyword_loc: Location, lparen_loc: ::T.nilable(Location), arguments: ::T.nilable(ArgumentsNode), rparen_loc: ::T.nilable(Location)).returns(YieldNode) } + def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), comments: T.unsafe(nil), keyword_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), arguments: T.unsafe(nil), rparen_loc: T.unsafe(nil)); end sig { override.returns(T::Array[::T.nilable(Node)]) } def deconstruct; end diff --git a/rbi/generated/prism/parse_result.rbi b/rbi/generated/prism/parse_result.rbi index 4d065b5be1..3393468e0e 100644 --- a/rbi/generated/prism/parse_result.rbi +++ b/rbi/generated/prism/parse_result.rbi @@ -228,29 +228,6 @@ module Prism sig { params(source: Source, start_offset: Integer, length: Integer).void } def initialize(source, start_offset, length); end - # These are the comments that are associated with this location that exist - # before the start of this location. - sig { returns(T::Array[Comment]) } - def leading_comments; end - - # Attach a comment to the leading comments of this location. - sig { params(comment: Comment).void } - def leading_comment(comment); end - - # These are the comments that are associated with this location that exist - # after the end of this location. - sig { returns(T::Array[Comment]) } - def trailing_comments; end - - # Attach a comment to the trailing comments of this location. - sig { params(comment: Comment).void } - def trailing_comment(comment); end - - # Returns all comments that are associated with this location (both leading - # and trailing comments). - sig { returns(T::Array[Comment]) } - def comments; end - # Create a new location object with the given options. sig { params(source: Source, start_offset: Integer, length: Integer).returns(Location) } def copy(source: T.unsafe(nil), start_offset: T.unsafe(nil), length: T.unsafe(nil)); end @@ -397,6 +374,21 @@ module Prism sig { params(location: Location).void } def initialize(location); end + # Returns a symbol representing the type of this node, for compatibility + # when comments are interleaved into node arrays. + sig { returns(Symbol) } + def type; end + + # Returns the byte offset from the beginning of the source where this + # comment starts. + sig { returns(Integer) } + def start_offset; end + + # Returns the byte offset from the beginning of the source where this + # comment ends. + sig { returns(Integer) } + def end_offset; end + # Implement the hash pattern matching interface for Comment. sig { params(keys: ::T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, ::T.untyped]) } def deconstruct_keys(keys); end @@ -626,10 +618,6 @@ module Prism sig { params(keys: ::T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, ::T.untyped]) } def deconstruct_keys(keys); end - # Attach the list of comments to their respective locations in the tree. - sig { void } - def attach_comments!; end - # Walk the tree and mark nodes that are on a new line, loosely emulating # the behavior of CRuby's `:line` tracepoint event. sig { void } diff --git a/rbi/generated/prism/parse_result/comments.rbi b/rbi/generated/prism/parse_result/comments.rbi deleted file mode 100644 index f386d03f34..0000000000 --- a/rbi/generated/prism/parse_result/comments.rbi +++ /dev/null @@ -1,90 +0,0 @@ -# typed: true - -module Prism - class ParseResult < Result - # When we've parsed the source, we have both the syntax tree and the list of - # comments that we found in the source. This class is responsible for - # walking the tree and finding the nearest location to attach each comment. - # - # It does this by first finding the nearest locations to each comment. - # Locations can either come from nodes directly or from location fields on - # nodes. For example, a `ClassNode` has an overall location encompassing the - # entire class, but it also has a location for the `class` keyword. - # - # Once the nearest locations are found, it determines which one to attach - # to. If it's a trailing comment (a comment on the same line as other source - # code), it will favor attaching to the nearest location that occurs before - # the comment. Otherwise it will favor attaching to the nearest location - # that is after the comment. - class Comments - # A target for attaching comments that is based on a specific node's - # location. - class NodeTarget - sig { returns(Node) } - attr_reader :node - - sig { params(node: Node).void } - def initialize(node); end - - sig { returns(Integer) } - def start_offset; end - - sig { returns(Integer) } - def end_offset; end - - sig { params(comment: Comment).returns(T::Boolean) } - def encloses?(comment); end - - sig { params(comment: Comment).void } - def leading_comment(comment); end - - sig { params(comment: Comment).void } - def trailing_comment(comment); end - end - - # A target for attaching comments that is based on a location field on a - # node. For example, the `end` token of a ClassNode. - class LocationTarget - sig { returns(Location) } - attr_reader :location - - sig { params(location: Location).void } - def initialize(location); end - - sig { returns(Integer) } - def start_offset; end - - sig { returns(Integer) } - def end_offset; end - - sig { params(comment: Comment).returns(T::Boolean) } - def encloses?(comment); end - - sig { params(comment: Comment).void } - def leading_comment(comment); end - - sig { params(comment: Comment).void } - def trailing_comment(comment); end - end - - # The parse result that we are attaching comments to. - sig { returns(ParseResult) } - attr_reader :parse_result - - # Create a new Comments object that will attach comments to the given - # parse result. - sig { params(parse_result: ParseResult).void } - def initialize(parse_result); end - - # Attach the comments to their respective locations in the tree by - # mutating the parse result. - sig { void } - def attach!; end - - # Responsible for finding the nearest targets to the given comment within - # the context of the given encapsulating node. - sig { params(node: Node, comment: Comment).returns([::T.untyped, ::T.untyped, ::T.untyped]) } - private def nearest_targets(node, comment); end - end - end -end diff --git a/rbi/generated/prism/relocation.rbi b/rbi/generated/prism/relocation.rbi index 7868d065b0..54c003a35c 100644 --- a/rbi/generated/prism/relocation.rbi +++ b/rbi/generated/prism/relocation.rbi @@ -87,18 +87,6 @@ module Prism sig { returns(Integer) } def end_code_units_column; end - # Fetch the leading comments of the value. - sig { returns(T::Array[CommentsField::Comment]) } - def leading_comments; end - - # Fetch the trailing comments of the value. - sig { returns(T::Array[CommentsField::Comment]) } - def trailing_comments; end - - # Fetch the leading and trailing comments of the value. - sig { returns(T::Array[CommentsField::Comment]) } - def comments; end - # Reify the values on this entry with the given values. This is an # internal-only API that is called from the repository when it is time to # reify the values. @@ -248,39 +236,6 @@ module Prism private def cache; end end - # An abstract field used as the parent class of the two comments fields. - class CommentsField - # An object that represents a slice of a comment. - class Comment - # The slice of the comment. - sig { returns(String) } - attr_reader :slice - - # Initialize a new comment with the given slice. - # - sig { params(slice: String).void } - def initialize(slice); end - end - - # Create comment objects from the given values. - sig { params(values: ::T.untyped).returns(T::Array[Comment]) } - private def comments(values); end - end - - # A field representing the leading comments. - class LeadingCommentsField < CommentsField - # Fetches the leading comments of a value. - sig { params(value: ::T.untyped).returns(T::Hash[Symbol, ::T.untyped]) } - def fields(value); end - end - - # A field representing the trailing comments. - class TrailingCommentsField < CommentsField - # Fetches the trailing comments of a value. - sig { params(value: ::T.untyped).returns(T::Hash[Symbol, ::T.untyped]) } - def fields(value); end - end - # A repository is a configured collection of fields and a set of entries # that knows how to reparse a source and reify the values. class Repository @@ -345,21 +300,6 @@ module Prism sig { params(encoding: Encoding).returns(::T.self_type) } def code_unit_columns(encoding); end - # Configure the leading comments field for this repository and return - # self. - sig { returns(::T.self_type) } - def leading_comments; end - - # Configure the trailing comments field for this repository and return - # self. - sig { returns(::T.self_type) } - def trailing_comments; end - - # Configure both the leading and trailing comment fields for this - # repository and return self. - sig { returns(::T.self_type) } - def comments; end - # This method is called from nodes and locations when they want to enter # themselves into the repository. It it internal-only and meant to be # called from the #save* APIs. diff --git a/rbi/generated/prism/serialize.rbi b/rbi/generated/prism/serialize.rbi index 57b4c61acb..e453e2bf97 100644 --- a/rbi/generated/prism/serialize.rbi +++ b/rbi/generated/prism/serialize.rbi @@ -74,7 +74,10 @@ module Prism sig { returns(T::Boolean) } def eof?; end - sig { params(constant_pool: ConstantPool).void } + sig { params(comments: T::Array[Comment], freeze: T::Boolean).returns(::T.nilable(T::Hash[Integer, Comments::Base])) } + def load_attached_comments(comments, freeze); end + + sig { params(constant_pool: ::T.untyped).returns(::T.untyped) } def load_constant_pool(constant_pool); end sig { void } @@ -129,8 +132,8 @@ module Prism sig { returns(Integer) } def load_uint32; end - sig { params(constant_pool: ConstantPool, encoding: Encoding, freeze: T::Boolean).returns(::T.nilable(Node)) } - def load_optional_node(constant_pool, encoding, freeze); end + sig { params(constant_pool: ConstantPool, encoding: Encoding, freeze: T::Boolean, comments: ::T.nilable(T::Hash[Integer, Comments::Base])).returns(::T.nilable(::T.any(Node, Comment))) } + def load_optional_node(constant_pool, encoding, freeze, comments = T.unsafe(nil)); end sig { params(encoding: Encoding).returns(String) } def load_string(encoding); end @@ -144,6 +147,9 @@ module Prism sig { params(freeze: T::Boolean).returns(Location) } def load_location(freeze); end + sig { params(packed: ::T.untyped).returns(::T.untyped) } + def load_location_object_from_packed(packed); end + # Load an optional location object from the serialized data if it is # present. Note that we are lying about the signature a bit here, because # we sometimes load it as a packed integer instead of an object. @@ -159,8 +165,8 @@ module Prism sig { params(constant_pool: ConstantPool, encoding: Encoding).returns(::T.nilable(Symbol)) } def load_optional_constant(constant_pool, encoding); end - sig { params(constant_pool: ConstantPool, encoding: Encoding, freeze: T::Boolean).returns(Node) } - def load_node(constant_pool, encoding, freeze); end + sig { params(constant_pool: ConstantPool, encoding: Encoding, freeze: T::Boolean, comments: ::T.nilable(T::Hash[Integer, Comments::Base])).returns(::T.any(Node, Comment)) } + def load_node(constant_pool, encoding, freeze, comments); end sig { void } def define_load_node_lambdas; end diff --git a/sample/prism/find_comments.rb b/sample/prism/find_comments.rb deleted file mode 100644 index 314bbb9b8e..0000000000 --- a/sample/prism/find_comments.rb +++ /dev/null @@ -1,100 +0,0 @@ -# This script finds all of the comments within a given source file for a method. - -require "prism" - -class FindMethodComments < Prism::Visitor - def initialize(target, comments, nesting = []) - @target = target - @comments = comments - @nesting = nesting - end - - # These visit methods are specific to each class. Defining a visitor allows - # you to group functionality that applies to all node types into a single - # class. You can find which method corresponds to which node type by looking - # at the class name, calling #type on the node, or by looking at the #accept - # method definition on the node. - def visit_module_node(node) - visitor = FindMethodComments.new(@target, @comments, [*@nesting, node.name]) - node.each_child_node { |child| child.accept(visitor) } - end - - def visit_class_node(node) - # We could keep track of an internal state where we push the class name here - # and then pop it after the visit is complete. However, it is often simpler - # and cleaner to generate a new visitor instance when the state changes, - # because then the state is immutable and it's easier to reason about. This - # also provides for more debugging opportunity in the initializer. - visitor = FindMethodComments.new(@target, @comments, [*@nesting, node.name]) - node.each_child_node { |child| child.accept(visitor) } - end - - def visit_def_node(node) - if [*@nesting, node.name] == @target - # Comments are always attached to locations (either inner locations on a - # node like the location of a keyword or the location on the node itself). - # Nodes are considered either "leading" or "trailing", which means that - # they occur before or after the location, respectively. In this case of - # documentation, we only want to consider leading comments. You can also - # fetch all of the comments on a location with #comments. - @comments.concat(node.location.leading_comments) - else - super - end - end -end - -# Most of the time, the concept of "finding" something in the AST can be -# accomplished either with a queue or with a visitor. In this case we will use a -# visitor, but a queue would work just as well. -def find_comments(result, path) - target = path.split(/::|#/).map(&:to_sym) - comments = [] - - result.value.accept(FindMethodComments.new(target, comments)) - comments -end - -result = Prism.parse_stream(DATA) -result.attach_comments! - -find_comments(result, "Foo#foo").each do |comment| - puts comment.inspect - puts comment.slice -end - -# => -# #> -# # This is the documentation -# #> -# # for the foo method. - -find_comments(result, "Foo::Bar#bar").each do |comment| - puts comment.inspect - puts comment.slice -end - -# => -# #> -# # This is documentation -# #> -# # for the bar method. - -__END__ -# This is the documentation -# for the Foo module. -module Foo - # This is documentation - # for the Bar class. - class Bar - # This is documentation - # for the bar method. - def bar - end - end - - # This is the documentation - # for the foo method. - def foo - end -end diff --git a/sig/generated/prism/comments.rbs b/sig/generated/prism/comments.rbs new file mode 100644 index 0000000000..cf3381ef77 --- /dev/null +++ b/sig/generated/prism/comments.rbs @@ -0,0 +1,465 @@ +# Generated from lib/prism/comments.rb with RBS::Inline + +module Prism + # The module containing definitions of all of the various comment attachment + # objects. + module Comments + # The base class for all comment attachment types. + class Base + end + + # Comments for alias method nodes, which can have comments between the + # two arguments. + # + # alias a + # # comment + # # comment + # b + class AliasMethodComments < Base + # The comments in the gap between the two arguments. + attr_reader gap_comments: Array[Comment] + + # : (Array[Comment] gap_comments) -> void + def initialize: (Array[Comment] gap_comments) -> void + end + + # Comments for binary expressions like &&. Captures a comment trailing the + # operator and any comments in the gap between the operator and the + # right-hand side. + # + # a && # comment + # # comment + # b + class BinaryComments < Base + # The comment trailing the operator. + attr_reader operator_comment: Comment? + + # The comments in the gap between the operator and the right-hand side. + attr_reader gap_comments: Array[Comment] + + # : (Comment? operator_comment, Array[Comment] gap_comments) -> void + def initialize: (Comment? operator_comment, Array[Comment] gap_comments) -> void + end + + # Comments for nodes with a body delimited by a keyword and end, such as + # begin, while, until, if, unless, and similar nodes. The opening comment + # trails the keyword (or the last token on the opening line). + # + # begin # opening comment + # bar + # end # trailing comment + class BodyComments < Base + # The comment trailing the opening keyword. + attr_reader opening_comment: Comment? + + # The comment trailing the end keyword. + attr_reader trailing_comment: Comment? + + # : (Comment? opening_comment, Comment? trailing_comment) -> void + def initialize: (Comment? opening_comment, Comment? trailing_comment) -> void + end + + # Comments for call nodes with a call operator (e.g., dot or &.). + # Captures a trailing comment, gap comments between the receiver and + # operator, the operator comment, and gap comments between the operator + # and the message. + # + # foo + # # receiver gap comment + # . # operator comment + # # message gap comment + # bar # trailing comment + class CallComments < Base + # The comment trailing the call. + attr_reader trailing_comment: Comment? + + # The comments between the receiver and the call operator. + attr_reader receiver_gap_comments: Array[Comment] + + # The comment trailing the call operator. + attr_reader operator_comment: Comment? + + # The comments between the call operator and the message. + attr_reader message_gap_comments: Array[Comment] + + # : (Comment? trailing_comment, Array[Comment] receiver_gap_comments, Comment? operator_comment, Array[Comment] message_gap_comments) -> void + def initialize: (Comment? trailing_comment, Array[Comment] receiver_gap_comments, Comment? operator_comment, Array[Comment] message_gap_comments) -> void + end + + # Comments for call-write nodes (e.g., foo.bar = 1, foo.bar += 1) which + # have both a call operator and an assignment operator with potential + # comments on each. + # + # foo. # call operator comment + # # call gap comment + # bar += # operator comment + # # operator gap comment + # 1 + class CallWriteComments < Base + # The comment trailing the call operator. + attr_reader call_operator_comment: Comment? + + # The comments between the call operator and the message. + attr_reader call_gap_comments: Array[Comment] + + # The comment trailing the assignment operator. + attr_reader operator_comment: Comment? + + # The comments between the assignment operator and the value. + attr_reader operator_gap_comments: Array[Comment] + + # : (Comment? call_operator_comment, Array[Comment] call_gap_comments, Comment? operator_comment, Array[Comment] operator_gap_comments) -> void + def initialize: (Comment? call_operator_comment, Array[Comment] call_gap_comments, Comment? operator_comment, Array[Comment] operator_gap_comments) -> void + end + + # Comments for case/case-in nodes. Captures the comment on the case + # keyword, comments between the keyword and predicate, comments between + # the predicate and the first when/in clause, and the trailing comment + # on end. + # + # case # keyword comment + # # keyword gap comment + # foo + # # predicate gap comment + # when bar + # baz + # end # trailing comment + class CaseComments < Base + # The comment trailing the case keyword. + attr_reader keyword_comment: Comment? + + # The comments between the case keyword and the predicate. + attr_reader keyword_gap_comments: Array[Comment] + + # The comments between the predicate and the first when/in clause. + attr_reader predicate_gap_comments: Array[Comment] + + # The comment trailing the end keyword. + attr_reader trailing_comment: Comment? + + # : (Comment? keyword_comment, Array[Comment] keyword_gap_comments, Array[Comment] predicate_gap_comments, Comment? trailing_comment) -> void + def initialize: (Comment? keyword_comment, Array[Comment] keyword_gap_comments, Array[Comment] predicate_gap_comments, Comment? trailing_comment) -> void + end + + # Comments for class nodes, which can have comments on the class keyword, + # in the gap between the keyword and the constant, on the inheritance + # operator, in the gap between the operator and the superclass, and on + # the end keyword. + # + # class # opening comment + # # keyword gap comment + # Foo < # inheritance operator comment + # # inheritance gap comment + # Bar + # baz + # end # trailing comment + class ClassComments < Base + # The comment trailing the class keyword. + attr_reader opening_comment: Comment? + + # The comments between the class keyword and the constant. + attr_reader keyword_gap_comments: Array[Comment] + + # The comment trailing the inheritance operator. + attr_reader inheritance_operator_comment: Comment? + + # The comments between the inheritance operator and the superclass. + attr_reader inheritance_gap_comments: Array[Comment] + + # The comment trailing the end keyword. + attr_reader trailing_comment: Comment? + + # : (Comment? opening_comment, Array[Comment] keyword_gap_comments, Comment? inheritance_operator_comment, Array[Comment] inheritance_gap_comments, Comment? trailing_comment) -> void + def initialize: (Comment? opening_comment, Array[Comment] keyword_gap_comments, Comment? inheritance_operator_comment, Array[Comment] inheritance_gap_comments, Comment? trailing_comment) -> void + end + + # Comments for clause nodes such as when, in, rescue, else, and ensure + # that have a single opening keyword. + # + # when foo # opening comment + class ClauseComments < Base + # The comment trailing the opening keyword. + attr_reader opening_comment: Comment? + + # : (Comment? opening_comment) -> void + def initialize: (Comment? opening_comment) -> void + end + + # Comments for collection nodes with opening and closing delimiters, + # such as arrays, hashes, block parameters, and similar nodes. + # + # [ # opening comment + # 1, 2, 3 + # ] # closing comment + class CollectionComments < Base + # The comment trailing the opening delimiter. + attr_reader opening_comment: Comment? + + # The comment trailing the closing delimiter. + attr_reader closing_comment: Comment? + + # : (Comment? opening_comment, Comment? closing_comment) -> void + def initialize: (Comment? opening_comment, Comment? closing_comment) -> void + end + + # Comments for def nodes, which can have comments on the def keyword, + # in the gap between the keyword and the method name, the opening and + # closing parentheses of the parameter list, and a trailing comment on + # end. + # + # def # opening comment + # # keyword gap comment + # foo( # lparen comment + # a, b + # ) # rparen comment + # bar + # end # trailing comment + class DefComments < Base + # The comment trailing the def keyword. + attr_reader opening_comment: Comment? + + # The comments between the def keyword and the method name. + attr_reader keyword_gap_comments: Array[Comment] + + # The comment trailing the opening parenthesis. + attr_reader lparen_comment: Comment? + + # The comment trailing the closing parenthesis. + attr_reader rparen_comment: Comment? + + # The comment trailing the end keyword. + attr_reader trailing_comment: Comment? + + # : (Comment? opening_comment, Array[Comment] keyword_gap_comments, Comment? lparen_comment, Comment? rparen_comment, Comment? trailing_comment) -> void + def initialize: (Comment? opening_comment, Array[Comment] keyword_gap_comments, Comment? lparen_comment, Comment? rparen_comment, Comment? trailing_comment) -> void + end + + # Comments for embedded statements nodes (e.g., string interpolation). + # + # "foo #{ # opening comment + # bar + # }" + class EmbeddedStatementsComments < Base + # The comment trailing the opening delimiter. + attr_reader opening_comment: Comment? + + # : (Comment? opening_comment) -> void + def initialize: (Comment? opening_comment) -> void + end + + # Comments for endless def nodes (def foo = body), which can have + # comments on the def keyword, in the gap between the keyword and the + # method name, the parentheses, and the = operator. + # + # def # opening comment + # # keyword gap comment + # foo( # lparen comment + # a + # ) = # operator comment + # bar + class EndlessDefComments < Base + # The comment trailing the def keyword. + attr_reader opening_comment: Comment? + + # The comments between the def keyword and the method name. + attr_reader keyword_gap_comments: Array[Comment] + + # The comment trailing the opening parenthesis. + attr_reader lparen_comment: Comment? + + # The comment trailing the closing parenthesis. + attr_reader rparen_comment: Comment? + + # The comment trailing the = operator. + attr_reader operator_comment: Comment? + + # : (Comment? opening_comment, Array[Comment] keyword_gap_comments, Comment? lparen_comment, Comment? rparen_comment, Comment? operator_comment) -> void + def initialize: (Comment? opening_comment, Array[Comment] keyword_gap_comments, Comment? lparen_comment, Comment? rparen_comment, Comment? operator_comment) -> void + end + + # Comments for find pattern nodes (e.g., [*a, b, *c] in pattern matching), + # which have opening and closing delimiters and gap comments around the + # left and right splat operators. + # + # in [ # opening comment + # # pre left gap comment + # *a, b, + # # post right gap comment + # ] # closing comment + class FindPatternComments < Base + # The comment trailing the opening delimiter. + attr_reader opening_comment: Comment? + + # The comment trailing the closing delimiter. + attr_reader closing_comment: Comment? + + # The comments before the left splat operator. + attr_reader pre_left_gap_comments: Array[Comment] + + # The comments after the right splat operator. + attr_reader post_right_gap_comments: Array[Comment] + + # : (Comment? opening_comment, Comment? closing_comment, Array[Comment] pre_left_gap_comments, Array[Comment] post_right_gap_comments) -> void + def initialize: (Comment? opening_comment, Comment? closing_comment, Array[Comment] pre_left_gap_comments, Array[Comment] post_right_gap_comments) -> void + end + + # Comments for for loop nodes, which have for, in, and optionally do + # keywords, each of which may have a trailing comment. + # + # for a in # in comment + # b + # do # do comment + # c + # end # trailing comment + class ForComments < Base + # The comment trailing the for keyword. + attr_reader for_comment: Comment? + + # The comment trailing the in keyword. + attr_reader in_comment: Comment? + + # The comment trailing the do keyword. + attr_reader do_comment: Comment? + + # The comment trailing the end keyword. + attr_reader trailing_comment: Comment? + + # : (Comment? for_comment, Comment? in_comment, Comment? do_comment, Comment? trailing_comment) -> void + def initialize: (Comment? for_comment, Comment? in_comment, Comment? do_comment, Comment? trailing_comment) -> void + end + + # Comments for hash pattern nodes (e.g., { a:, **b } in pattern matching), + # which have opening and closing delimiters and gap comments after the + # rest operator. + # + # in { a:, **b, + # # post rest gap comment + # } # closing comment + class HashPatternComments < Base + # The comment trailing the opening delimiter. + attr_reader opening_comment: Comment? + + # The comment trailing the closing delimiter. + attr_reader closing_comment: Comment? + + # The comments after the rest operator. + attr_reader post_rest_gap_comments: Array[Comment] + + # : (Comment? opening_comment, Comment? closing_comment, Array[Comment] post_rest_gap_comments) -> void + def initialize: (Comment? opening_comment, Comment? closing_comment, Array[Comment] post_rest_gap_comments) -> void + end + + # Comments for keyword call nodes with parentheses, such as yield and + # super. + # + # yield( # lparen comment + # foo + # ) # rparen comment + class KeywordCallComments < Base + # The comment trailing the opening parenthesis. + attr_reader lparen_comment: Comment? + + # The comment trailing the closing parenthesis. + attr_reader rparen_comment: Comment? + + # : (Comment? lparen_comment, Comment? rparen_comment) -> void + def initialize: (Comment? lparen_comment, Comment? rparen_comment) -> void + end + + # Comments for leaf nodes that can only have a trailing comment on the + # same line (e.g., variable reads, literals, break/next/return keywords). + # + # foo # trailing comment + class LeafComments < Base + # The comment trailing the node. + attr_reader trailing_comment: Comment? + + # : (Comment? trailing_comment) -> void + def initialize: (Comment? trailing_comment) -> void + end + + # Comments for logical keyword operators (and, or) which have comments + # in the gaps before and after the keyword operator. + # + # a + # # left gap comment + # and # operator comment + # # right gap comment + # b + class LogicalKeywordComments < Base + # The comment trailing the operator keyword. + attr_reader operator_comment: Comment? + + # The comments between the left operand and the operator. + attr_reader left_gap_comments: Array[Comment] + + # The comments between the operator and the right operand. + attr_reader right_gap_comments: Array[Comment] + + # : (Comment? operator_comment, Array[Comment] left_gap_comments, Array[Comment] right_gap_comments) -> void + def initialize: (Comment? operator_comment, Array[Comment] left_gap_comments, Array[Comment] right_gap_comments) -> void + end + + # Comments for module nodes, which can have comments on the module keyword, + # in the gap between the keyword and the constant, and on the end keyword. + # + # module # opening comment + # # keyword gap comment + # Foo + # bar + # end # trailing comment + class ModuleComments < Base + # The comment trailing the module keyword. + attr_reader opening_comment: Comment? + + # The comments between the module keyword and the constant. + attr_reader keyword_gap_comments: Array[Comment] + + # The comment trailing the end keyword. + attr_reader trailing_comment: Comment? + + # : (Comment? opening_comment, Array[Comment] keyword_gap_comments, Comment? trailing_comment) -> void + def initialize: (Comment? opening_comment, Array[Comment] keyword_gap_comments, Comment? trailing_comment) -> void + end + + # Comments for nodes wrapped in parentheses, such as parenthesized + # expressions or ternary if/unless with parenthesized predicates. + # + # ( # opening comment + # # opening gap comment + # foo + # # closing gap comment + # ) + class ParenthesizedComments < Base + # The comment trailing the opening parenthesis. + attr_reader opening_comment: Comment? + + # The comments between the opening parenthesis and the body. + attr_reader opening_gap_comments: Array[Comment] + + # The comments between the body and the closing parenthesis. + attr_reader closing_gap_comments: Array[Comment] + + # : (Comment? opening_comment, Array[Comment] opening_gap_comments, Array[Comment] closing_gap_comments) -> void + def initialize: (Comment? opening_comment, Array[Comment] opening_gap_comments, Array[Comment] closing_gap_comments) -> void + end + + # Comments for prefix operator nodes (e.g., !, ~, not, splat, block + # argument) where a comment can trail the operator and gap comments can + # appear before the operand. + # + # ! # operator comment + # # gap comment + # foo + class PrefixComments < Base + # The comment trailing the operator. + attr_reader operator_comment: Comment? + + # The comments between the operator and the operand. + attr_reader gap_comments: Array[Comment] + + # : (Comment? operator_comment, Array[Comment] gap_comments) -> void + def initialize: (Comment? operator_comment, Array[Comment] gap_comments) -> void + end + end +end diff --git a/sig/generated/prism/dsl.rbs b/sig/generated/prism/dsl.rbs index 541a87eba4..b0ba4ccda9 100644 --- a/sig/generated/prism/dsl.rbs +++ b/sig/generated/prism/dsl.rbs @@ -95,8 +95,8 @@ module Prism # Create a new ArrayPatternNode node. # -- - # : (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: (ConstantPathNode | ConstantReadNode)?, ?requireds: Array[Prism::node], ?rest: Prism::node?, ?posts: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayPatternNode - def array_pattern_node: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: (ConstantPathNode | ConstantReadNode)?, ?requireds: Array[Prism::node], ?rest: Prism::node?, ?posts: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayPatternNode + # : (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: (ConstantPathNode | ConstantReadNode)?, ?requireds: Array[Prism::node], ?rest: (ImplicitRestNode | SplatNode)?, ?posts: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayPatternNode + def array_pattern_node: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: (ConstantPathNode | ConstantReadNode)?, ?requireds: Array[Prism::node], ?rest: (ImplicitRestNode | SplatNode)?, ?posts: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayPatternNode # Create a new AssocNode node. # -- diff --git a/sig/generated/prism/node.rbs b/sig/generated/prism/node.rbs index 20c46fbd99..7d2066cb97 100644 --- a/sig/generated/prism/node.rbs +++ b/sig/generated/prism/node.rbs @@ -26,6 +26,10 @@ module Prism # will be consistent across multiple parses of the same source code. attr_reader node_id: Integer + # The comments attached to this node, or nil if comment attachment was + # not requested during parsing. + attr_reader comments: Comments::Base? + @location: Location | Integer # Save this node using a saved source so that it can be retrieved later. @@ -122,21 +126,6 @@ module Prism # : (_CodeUnitsCache cache) -> Integer def cached_end_code_units_column: (_CodeUnitsCache cache) -> Integer - # Delegates to [`leading_comments`](rdoc-ref:Location#leading_comments) of the associated location object. - # -- - # : () -> Array[Comment] - def leading_comments: () -> Array[Comment] - - # Delegates to [`trailing_comments`](rdoc-ref:Location#trailing_comments) of the associated location object. - # -- - # : () -> Array[Comment] - def trailing_comments: () -> Array[Comment] - - # Delegates to [`comments`](rdoc-ref:Location#comments) of the associated location object. - # -- - # : () -> Array[Comment] - def comments: () -> Array[Comment] - # Returns all of the lines of the source code associated with this node. # -- # : () -> Array[String] @@ -251,12 +240,6 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # Returns an array of child nodes and locations that could potentially have - # comments attached to them. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # Returns a string representation of the node. # -- # : () -> String @@ -300,8 +283,8 @@ module Prism # Initialize a new AliasGlobalVariableNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, (GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode) new_name, (GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode) old_name, Location keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode new_name, GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode old_name, Location keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, (GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode) new_name, (GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode) old_name, Location keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode new_name, GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode old_name, Location keyword_loc) -> void # See Node.accept. # -- @@ -325,18 +308,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> AliasGlobalVariableNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?new_name: (GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode), ?old_name: (GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode), ?keyword_loc: Location) -> AliasGlobalVariableNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?new_name: GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode, ?old_name: GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode, ?keyword_loc: Location) -> AliasGlobalVariableNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?new_name: (GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode), ?old_name: (GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode), ?keyword_loc: Location) -> AliasGlobalVariableNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?new_name: GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode, ?old_name: GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode, ?keyword_loc: Location) -> AliasGlobalVariableNode alias deconstruct child_nodes @@ -422,8 +400,8 @@ module Prism # Initialize a new AliasMethodNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, (SymbolNode | InterpolatedSymbolNode) new_name, (SymbolNode | InterpolatedSymbolNode) old_name, Location keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, SymbolNode | InterpolatedSymbolNode new_name, SymbolNode | InterpolatedSymbolNode old_name, Location keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, (SymbolNode | InterpolatedSymbolNode) new_name, (SymbolNode | InterpolatedSymbolNode) old_name, Location keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, SymbolNode | InterpolatedSymbolNode new_name, SymbolNode | InterpolatedSymbolNode old_name, Location keyword_loc) -> void # See Node.accept. # -- @@ -447,18 +425,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> AliasMethodNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?new_name: (SymbolNode | InterpolatedSymbolNode), ?old_name: (SymbolNode | InterpolatedSymbolNode), ?keyword_loc: Location) -> AliasMethodNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?new_name: SymbolNode | InterpolatedSymbolNode, ?old_name: SymbolNode | InterpolatedSymbolNode, ?keyword_loc: Location) -> AliasMethodNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?new_name: (SymbolNode | InterpolatedSymbolNode), ?old_name: (SymbolNode | InterpolatedSymbolNode), ?keyword_loc: Location) -> AliasMethodNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?new_name: SymbolNode | InterpolatedSymbolNode, ?old_name: SymbolNode | InterpolatedSymbolNode, ?keyword_loc: Location) -> AliasMethodNode alias deconstruct child_nodes @@ -556,8 +529,8 @@ module Prism # Initialize a new AlternationPatternNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node left, Prism::node right, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node left, Prism::node right, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node left, Prism::node right, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node left, Prism::node right, Location operator_loc) -> void # See Node.accept. # -- @@ -581,18 +554,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> AlternationPatternNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> AlternationPatternNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> AlternationPatternNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> AlternationPatternNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> AlternationPatternNode alias deconstruct child_nodes @@ -678,8 +646,8 @@ module Prism # Initialize a new AndNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node left, Prism::node right, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node left, Prism::node right, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node left, Prism::node right, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node left, Prism::node right, Location operator_loc) -> void # See Node.accept. # -- @@ -703,18 +671,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> AndNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> AndNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> AndNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> AndNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> AndNode alias deconstruct child_nodes @@ -802,8 +765,8 @@ module Prism # Initialize a new ArgumentsNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Array[Prism::node] arguments) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Array[Prism::node] arguments) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Prism::node] arguments) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Prism::node] arguments) -> void # See Node.accept. # -- @@ -827,18 +790,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ArgumentsNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?arguments: Array[Prism::node]) -> ArgumentsNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?arguments: Array[Prism::node]) -> ArgumentsNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?arguments: Array[Prism::node]) -> ArgumentsNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?arguments: Array[Prism::node]) -> ArgumentsNode alias deconstruct child_nodes @@ -916,8 +874,8 @@ module Prism # Initialize a new ArrayNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Array[Prism::node] elements, Location? opening_loc, Location? closing_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Array[Prism::node] elements, Location? opening_loc, Location? closing_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Prism::node] elements, Location? opening_loc, Location? closing_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Prism::node] elements, Location? opening_loc, Location? closing_loc) -> void # See Node.accept. # -- @@ -941,18 +899,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ArrayNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?elements: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?elements: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?elements: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?elements: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayNode alias deconstruct child_nodes @@ -1071,7 +1024,7 @@ module Prism @posts: Array[Prism::node] - @rest: Prism::node? + @rest: (ImplicitRestNode | SplatNode)? @requireds: Array[Prism::node] @@ -1079,8 +1032,8 @@ module Prism # Initialize a new ArrayPatternNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, (ConstantPathNode | ConstantReadNode)? constant, Array[Prism::node] requireds, Prism::node? rest, Array[Prism::node] posts, Location? opening_loc, Location? closing_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, (ConstantPathNode | ConstantReadNode)? constant, Array[Prism::node] requireds, Prism::node? rest, Array[Prism::node] posts, Location? opening_loc, Location? closing_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, (ConstantPathNode | ConstantReadNode)? constant, Array[Prism::node] requireds, (ImplicitRestNode | SplatNode)? rest, Array[Prism::node] posts, Location? opening_loc, Location? closing_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, (ConstantPathNode | ConstantReadNode)? constant, Array[Prism::node] requireds, (ImplicitRestNode | SplatNode)? rest, Array[Prism::node] posts, Location? opening_loc, Location? closing_loc) -> void # See Node.accept. # -- @@ -1104,18 +1057,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ArrayPatternNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: (ConstantPathNode | ConstantReadNode)?, ?requireds: Array[Prism::node], ?rest: Prism::node?, ?posts: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayPatternNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: (ConstantPathNode | ConstantReadNode)?, ?requireds: Array[Prism::node], ?rest: Prism::node?, ?posts: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayPatternNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?constant: (ConstantPathNode | ConstantReadNode)?, ?requireds: Array[Prism::node], ?rest: (ImplicitRestNode | SplatNode)?, ?posts: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayPatternNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?constant: (ConstantPathNode | ConstantReadNode)?, ?requireds: Array[Prism::node], ?rest: (ImplicitRestNode | SplatNode)?, ?posts: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayPatternNode alias deconstruct child_nodes @@ -1164,15 +1112,15 @@ module Prism def requireds: () -> Array[Prism::node] # :call-seq: - # rest -> Node | nil + # rest -> ImplicitRestNode | SplatNode | nil # # Represents the rest element of the array pattern. # # foo in *bar # ^^^^ # -- - # : () -> Prism::node? - def rest: () -> Prism::node? + # : () -> (ImplicitRestNode | SplatNode)? + def rest: () -> (ImplicitRestNode | SplatNode)? # :call-seq: # posts -> Array[Node] @@ -1256,8 +1204,8 @@ module Prism # Initialize a new AssocNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node key, Prism::node value, Location? operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node key, Prism::node value, Location? operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node key, Prism::node value, Location? operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node key, Prism::node value, Location? operator_loc) -> void # See Node.accept. # -- @@ -1281,18 +1229,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> AssocNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?key: Prism::node, ?value: Prism::node, ?operator_loc: Location?) -> AssocNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?key: Prism::node, ?value: Prism::node, ?operator_loc: Location?) -> AssocNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?key: Prism::node, ?value: Prism::node, ?operator_loc: Location?) -> AssocNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?key: Prism::node, ?value: Prism::node, ?operator_loc: Location?) -> AssocNode alias deconstruct child_nodes @@ -1385,8 +1328,8 @@ module Prism # Initialize a new AssocSplatNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node? value, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node? value, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? value, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? value, Location operator_loc) -> void # See Node.accept. # -- @@ -1410,18 +1353,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> AssocSplatNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node?, ?operator_loc: Location) -> AssocSplatNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node?, ?operator_loc: Location) -> AssocSplatNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?value: Prism::node?, ?operator_loc: Location) -> AssocSplatNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?value: Prism::node?, ?operator_loc: Location) -> AssocSplatNode alias deconstruct child_nodes @@ -1492,8 +1430,8 @@ module Prism # Initialize a new BackReferenceReadNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void # See Node.accept. # -- @@ -1517,18 +1455,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> BackReferenceReadNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> BackReferenceReadNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> BackReferenceReadNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> BackReferenceReadNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> BackReferenceReadNode alias deconstruct child_nodes @@ -1585,8 +1518,8 @@ module Prism # Initialize a new BeginNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location? begin_keyword_loc, StatementsNode? statements, RescueNode? rescue_clause, ElseNode? else_clause, EnsureNode? ensure_clause, Location? end_keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location? begin_keyword_loc, StatementsNode? statements, RescueNode? rescue_clause, ElseNode? else_clause, EnsureNode? ensure_clause, Location? end_keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location? begin_keyword_loc, StatementsNode? statements, RescueNode? rescue_clause, ElseNode? else_clause, EnsureNode? ensure_clause, Location? end_keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location? begin_keyword_loc, StatementsNode? statements, RescueNode? rescue_clause, ElseNode? else_clause, EnsureNode? ensure_clause, Location? end_keyword_loc) -> void # See Node.accept. # -- @@ -1610,18 +1543,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> BeginNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?begin_keyword_loc: Location?, ?statements: StatementsNode?, ?rescue_clause: RescueNode?, ?else_clause: ElseNode?, ?ensure_clause: EnsureNode?, ?end_keyword_loc: Location?) -> BeginNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?begin_keyword_loc: Location?, ?statements: StatementsNode?, ?rescue_clause: RescueNode?, ?else_clause: ElseNode?, ?ensure_clause: EnsureNode?, ?end_keyword_loc: Location?) -> BeginNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?begin_keyword_loc: Location?, ?statements: StatementsNode?, ?rescue_clause: RescueNode?, ?else_clause: ElseNode?, ?ensure_clause: EnsureNode?, ?end_keyword_loc: Location?) -> BeginNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?begin_keyword_loc: Location?, ?statements: StatementsNode?, ?rescue_clause: RescueNode?, ?else_clause: ElseNode?, ?ensure_clause: EnsureNode?, ?end_keyword_loc: Location?) -> BeginNode alias deconstruct child_nodes @@ -1754,8 +1682,8 @@ module Prism # Initialize a new BlockArgumentNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node? expression, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node? expression, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? expression, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? expression, Location operator_loc) -> void # See Node.accept. # -- @@ -1779,18 +1707,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> BlockArgumentNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node?, ?operator_loc: Location) -> BlockArgumentNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node?, ?operator_loc: Location) -> BlockArgumentNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?expression: Prism::node?, ?operator_loc: Location) -> BlockArgumentNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?expression: Prism::node?, ?operator_loc: Location) -> BlockArgumentNode alias deconstruct child_nodes @@ -1861,8 +1784,8 @@ module Prism # Initialize a new BlockLocalVariableNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void # See Node.accept. # -- @@ -1886,18 +1809,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> BlockLocalVariableNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> BlockLocalVariableNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> BlockLocalVariableNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> BlockLocalVariableNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> BlockLocalVariableNode alias deconstruct child_nodes @@ -1955,8 +1873,8 @@ module Prism # Initialize a new BlockNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Array[Symbol] locals, (BlockParametersNode | NumberedParametersNode | ItParametersNode)? parameters, (StatementsNode | BeginNode)? body, Location opening_loc, Location closing_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Array[Symbol] locals, (BlockParametersNode | NumberedParametersNode | ItParametersNode)? parameters, (StatementsNode | BeginNode)? body, Location opening_loc, Location closing_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Symbol] locals, (BlockParametersNode | NumberedParametersNode | ItParametersNode)? parameters, (StatementsNode | BeginNode)? body, Location opening_loc, Location closing_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Symbol] locals, (BlockParametersNode | NumberedParametersNode | ItParametersNode)? parameters, (StatementsNode | BeginNode)? body, Location opening_loc, Location closing_loc) -> void # See Node.accept. # -- @@ -1980,18 +1898,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> BlockNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?parameters: (BlockParametersNode | NumberedParametersNode | ItParametersNode)?, ?body: (StatementsNode | BeginNode)?, ?opening_loc: Location, ?closing_loc: Location) -> BlockNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?parameters: (BlockParametersNode | NumberedParametersNode | ItParametersNode)?, ?body: (StatementsNode | BeginNode)?, ?opening_loc: Location, ?closing_loc: Location) -> BlockNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?locals: Array[Symbol], ?parameters: (BlockParametersNode | NumberedParametersNode | ItParametersNode)?, ?body: (StatementsNode | BeginNode)?, ?opening_loc: Location, ?closing_loc: Location) -> BlockNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?locals: Array[Symbol], ?parameters: (BlockParametersNode | NumberedParametersNode | ItParametersNode)?, ?body: (StatementsNode | BeginNode)?, ?opening_loc: Location, ?closing_loc: Location) -> BlockNode alias deconstruct child_nodes @@ -2120,8 +2033,8 @@ module Prism # Initialize a new BlockParameterNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol? name, Location? name_loc, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol? name, Location? name_loc, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol? name, Location? name_loc, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol? name, Location? name_loc, Location operator_loc) -> void # See Node.accept. # -- @@ -2145,18 +2058,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> BlockParameterNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> BlockParameterNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> BlockParameterNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> BlockParameterNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> BlockParameterNode alias deconstruct child_nodes @@ -2264,8 +2172,8 @@ module Prism # Initialize a new BlockParametersNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ParametersNode? parameters, Array[BlockLocalVariableNode] locals, Location? opening_loc, Location? closing_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, ParametersNode? parameters, Array[BlockLocalVariableNode] locals, Location? opening_loc, Location? closing_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ParametersNode? parameters, Array[BlockLocalVariableNode] locals, Location? opening_loc, Location? closing_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ParametersNode? parameters, Array[BlockLocalVariableNode] locals, Location? opening_loc, Location? closing_loc) -> void # See Node.accept. # -- @@ -2289,18 +2197,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> BlockParametersNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?parameters: ParametersNode?, ?locals: Array[BlockLocalVariableNode], ?opening_loc: Location?, ?closing_loc: Location?) -> BlockParametersNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?parameters: ParametersNode?, ?locals: Array[BlockLocalVariableNode], ?opening_loc: Location?, ?closing_loc: Location?) -> BlockParametersNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?parameters: ParametersNode?, ?locals: Array[BlockLocalVariableNode], ?opening_loc: Location?, ?closing_loc: Location?) -> BlockParametersNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?parameters: ParametersNode?, ?locals: Array[BlockLocalVariableNode], ?opening_loc: Location?, ?closing_loc: Location?) -> BlockParametersNode alias deconstruct child_nodes @@ -2427,8 +2330,8 @@ module Prism # Initialize a new BreakNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ArgumentsNode? arguments, Location keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, ArgumentsNode? arguments, Location keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ArgumentsNode? arguments, Location keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ArgumentsNode? arguments, Location keyword_loc) -> void # See Node.accept. # -- @@ -2452,18 +2355,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> BreakNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?arguments: ArgumentsNode?, ?keyword_loc: Location) -> BreakNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?arguments: ArgumentsNode?, ?keyword_loc: Location) -> BreakNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?arguments: ArgumentsNode?, ?keyword_loc: Location) -> BreakNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?arguments: ArgumentsNode?, ?keyword_loc: Location) -> BreakNode alias deconstruct child_nodes @@ -2546,8 +2444,8 @@ module Prism # Initialize a new CallAndWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node? receiver, Location? call_operator_loc, Location? message_loc, Symbol read_name, Symbol write_name, Location operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node? receiver, Location? call_operator_loc, Location? message_loc, Symbol read_name, Symbol write_name, Location operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? receiver, Location? call_operator_loc, Location? message_loc, Symbol read_name, Symbol write_name, Location operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? receiver, Location? call_operator_loc, Location? message_loc, Symbol read_name, Symbol write_name, Location operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -2571,18 +2469,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> CallAndWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?operator_loc: Location, ?value: Prism::node) -> CallAndWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?operator_loc: Location, ?value: Prism::node) -> CallAndWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?operator_loc: Location, ?value: Prism::node) -> CallAndWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?operator_loc: Location, ?value: Prism::node) -> CallAndWriteNode alias deconstruct child_nodes @@ -2795,8 +2688,8 @@ module Prism # Initialize a new CallNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node? receiver, Location? call_operator_loc, Symbol name, Location? message_loc, Location? opening_loc, ArgumentsNode? arguments, Location? closing_loc, Location? equal_loc, (BlockNode | BlockArgumentNode)? block) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node? receiver, Location? call_operator_loc, Symbol name, Location? message_loc, Location? opening_loc, ArgumentsNode? arguments, Location? closing_loc, Location? equal_loc, (BlockNode | BlockArgumentNode)? block) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? receiver, Location? call_operator_loc, Symbol name, Location? message_loc, Location? opening_loc, ArgumentsNode? arguments, Location? closing_loc, Location? equal_loc, (BlockNode | BlockArgumentNode)? block) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? receiver, Location? call_operator_loc, Symbol name, Location? message_loc, Location? opening_loc, ArgumentsNode? arguments, Location? closing_loc, Location? equal_loc, (BlockNode | BlockArgumentNode)? block) -> void # See Node.accept. # -- @@ -2820,18 +2713,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> CallNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?name: Symbol, ?message_loc: Location?, ?opening_loc: Location?, ?arguments: ArgumentsNode?, ?closing_loc: Location?, ?equal_loc: Location?, ?block: (BlockNode | BlockArgumentNode)?) -> CallNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?name: Symbol, ?message_loc: Location?, ?opening_loc: Location?, ?arguments: ArgumentsNode?, ?closing_loc: Location?, ?equal_loc: Location?, ?block: (BlockNode | BlockArgumentNode)?) -> CallNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?name: Symbol, ?message_loc: Location?, ?opening_loc: Location?, ?arguments: ArgumentsNode?, ?closing_loc: Location?, ?equal_loc: Location?, ?block: (BlockNode | BlockArgumentNode)?) -> CallNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?name: Symbol, ?message_loc: Location?, ?opening_loc: Location?, ?arguments: ArgumentsNode?, ?closing_loc: Location?, ?equal_loc: Location?, ?block: (BlockNode | BlockArgumentNode)?) -> CallNode alias deconstruct child_nodes @@ -3093,8 +2981,8 @@ module Prism # Initialize a new CallOperatorWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node? receiver, Location? call_operator_loc, Location? message_loc, Symbol read_name, Symbol write_name, Symbol binary_operator, Location binary_operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node? receiver, Location? call_operator_loc, Location? message_loc, Symbol read_name, Symbol write_name, Symbol binary_operator, Location binary_operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? receiver, Location? call_operator_loc, Location? message_loc, Symbol read_name, Symbol write_name, Symbol binary_operator, Location binary_operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? receiver, Location? call_operator_loc, Location? message_loc, Symbol read_name, Symbol write_name, Symbol binary_operator, Location binary_operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -3118,18 +3006,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> CallOperatorWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?binary_operator: Symbol, ?binary_operator_loc: Location, ?value: Prism::node) -> CallOperatorWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?binary_operator: Symbol, ?binary_operator_loc: Location, ?value: Prism::node) -> CallOperatorWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?binary_operator: Symbol, ?binary_operator_loc: Location, ?value: Prism::node) -> CallOperatorWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?binary_operator: Symbol, ?binary_operator_loc: Location, ?value: Prism::node) -> CallOperatorWriteNode alias deconstruct child_nodes @@ -3326,8 +3209,8 @@ module Prism # Initialize a new CallOrWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node? receiver, Location? call_operator_loc, Location? message_loc, Symbol read_name, Symbol write_name, Location operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node? receiver, Location? call_operator_loc, Location? message_loc, Symbol read_name, Symbol write_name, Location operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? receiver, Location? call_operator_loc, Location? message_loc, Symbol read_name, Symbol write_name, Location operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? receiver, Location? call_operator_loc, Location? message_loc, Symbol read_name, Symbol write_name, Location operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -3351,18 +3234,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> CallOrWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?operator_loc: Location, ?value: Prism::node) -> CallOrWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?operator_loc: Location, ?value: Prism::node) -> CallOrWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?operator_loc: Location, ?value: Prism::node) -> CallOrWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?operator_loc: Location, ?value: Prism::node) -> CallOrWriteNode alias deconstruct child_nodes @@ -3558,8 +3436,8 @@ module Prism # Initialize a new CallTargetNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node receiver, Location call_operator_loc, Symbol name, Location message_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node receiver, Location call_operator_loc, Symbol name, Location message_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node receiver, Location call_operator_loc, Symbol name, Location message_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node receiver, Location call_operator_loc, Symbol name, Location message_loc) -> void # See Node.accept. # -- @@ -3583,18 +3461,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> CallTargetNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node, ?call_operator_loc: Location, ?name: Symbol, ?message_loc: Location) -> CallTargetNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node, ?call_operator_loc: Location, ?name: Symbol, ?message_loc: Location) -> CallTargetNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node, ?call_operator_loc: Location, ?name: Symbol, ?message_loc: Location) -> CallTargetNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node, ?call_operator_loc: Location, ?name: Symbol, ?message_loc: Location) -> CallTargetNode alias deconstruct child_nodes @@ -3731,8 +3604,8 @@ module Prism # Initialize a new CapturePatternNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node value, LocalVariableTargetNode target, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node value, LocalVariableTargetNode target, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node value, LocalVariableTargetNode target, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node value, LocalVariableTargetNode target, Location operator_loc) -> void # See Node.accept. # -- @@ -3756,18 +3629,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> CapturePatternNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node, ?target: LocalVariableTargetNode, ?operator_loc: Location) -> CapturePatternNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node, ?target: LocalVariableTargetNode, ?operator_loc: Location) -> CapturePatternNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?value: Prism::node, ?target: LocalVariableTargetNode, ?operator_loc: Location) -> CapturePatternNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?value: Prism::node, ?target: LocalVariableTargetNode, ?operator_loc: Location) -> CapturePatternNode alias deconstruct child_nodes @@ -3859,8 +3727,8 @@ module Prism # Initialize a new CaseMatchNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node? predicate, Array[InNode] conditions, ElseNode? else_clause, Location case_keyword_loc, Location end_keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node? predicate, Array[InNode] conditions, ElseNode? else_clause, Location case_keyword_loc, Location end_keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? predicate, Array[InNode] conditions, ElseNode? else_clause, Location case_keyword_loc, Location end_keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? predicate, Array[InNode] conditions, ElseNode? else_clause, Location case_keyword_loc, Location end_keyword_loc) -> void # See Node.accept. # -- @@ -3884,18 +3752,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> CaseMatchNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?predicate: Prism::node?, ?conditions: Array[InNode], ?else_clause: ElseNode?, ?case_keyword_loc: Location, ?end_keyword_loc: Location) -> CaseMatchNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?predicate: Prism::node?, ?conditions: Array[InNode], ?else_clause: ElseNode?, ?case_keyword_loc: Location, ?end_keyword_loc: Location) -> CaseMatchNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?predicate: Prism::node?, ?conditions: Array[InNode], ?else_clause: ElseNode?, ?case_keyword_loc: Location, ?end_keyword_loc: Location) -> CaseMatchNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?predicate: Prism::node?, ?conditions: Array[InNode], ?else_clause: ElseNode?, ?case_keyword_loc: Location, ?end_keyword_loc: Location) -> CaseMatchNode alias deconstruct child_nodes @@ -4025,8 +3888,8 @@ module Prism # Initialize a new CaseNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node? predicate, Array[WhenNode] conditions, ElseNode? else_clause, Location case_keyword_loc, Location end_keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node? predicate, Array[WhenNode] conditions, ElseNode? else_clause, Location case_keyword_loc, Location end_keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? predicate, Array[WhenNode] conditions, ElseNode? else_clause, Location case_keyword_loc, Location end_keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? predicate, Array[WhenNode] conditions, ElseNode? else_clause, Location case_keyword_loc, Location end_keyword_loc) -> void # See Node.accept. # -- @@ -4050,18 +3913,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> CaseNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?predicate: Prism::node?, ?conditions: Array[WhenNode], ?else_clause: ElseNode?, ?case_keyword_loc: Location, ?end_keyword_loc: Location) -> CaseNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?predicate: Prism::node?, ?conditions: Array[WhenNode], ?else_clause: ElseNode?, ?case_keyword_loc: Location, ?end_keyword_loc: Location) -> CaseNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?predicate: Prism::node?, ?conditions: Array[WhenNode], ?else_clause: ElseNode?, ?case_keyword_loc: Location, ?end_keyword_loc: Location) -> CaseNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?predicate: Prism::node?, ?conditions: Array[WhenNode], ?else_clause: ElseNode?, ?case_keyword_loc: Location, ?end_keyword_loc: Location) -> CaseNode alias deconstruct child_nodes @@ -4195,8 +4053,8 @@ module Prism # Initialize a new ClassNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Array[Symbol] locals, Location class_keyword_loc, (ConstantReadNode | ConstantPathNode) constant_path, Location? inheritance_operator_loc, Prism::node? superclass, (StatementsNode | BeginNode)? body, Location end_keyword_loc, Symbol name) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Array[Symbol] locals, Location class_keyword_loc, ConstantReadNode | ConstantPathNode constant_path, Location? inheritance_operator_loc, Prism::node? superclass, (StatementsNode | BeginNode)? body, Location end_keyword_loc, Symbol name) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Symbol] locals, Location class_keyword_loc, (ConstantReadNode | ConstantPathNode) constant_path, Location? inheritance_operator_loc, Prism::node? superclass, (StatementsNode | BeginNode)? body, Location end_keyword_loc, Symbol name) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Symbol] locals, Location class_keyword_loc, ConstantReadNode | ConstantPathNode constant_path, Location? inheritance_operator_loc, Prism::node? superclass, (StatementsNode | BeginNode)? body, Location end_keyword_loc, Symbol name) -> void # See Node.accept. # -- @@ -4220,18 +4078,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ClassNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?class_keyword_loc: Location, ?constant_path: (ConstantReadNode | ConstantPathNode), ?inheritance_operator_loc: Location?, ?superclass: Prism::node?, ?body: (StatementsNode | BeginNode)?, ?end_keyword_loc: Location, ?name: Symbol) -> ClassNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?class_keyword_loc: Location, ?constant_path: ConstantReadNode | ConstantPathNode, ?inheritance_operator_loc: Location?, ?superclass: Prism::node?, ?body: (StatementsNode | BeginNode)?, ?end_keyword_loc: Location, ?name: Symbol) -> ClassNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?locals: Array[Symbol], ?class_keyword_loc: Location, ?constant_path: (ConstantReadNode | ConstantPathNode), ?inheritance_operator_loc: Location?, ?superclass: Prism::node?, ?body: (StatementsNode | BeginNode)?, ?end_keyword_loc: Location, ?name: Symbol) -> ClassNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?locals: Array[Symbol], ?class_keyword_loc: Location, ?constant_path: ConstantReadNode | ConstantPathNode, ?inheritance_operator_loc: Location?, ?superclass: Prism::node?, ?body: (StatementsNode | BeginNode)?, ?end_keyword_loc: Location, ?name: Symbol) -> ClassNode alias deconstruct child_nodes @@ -4399,8 +4252,8 @@ module Prism # Initialize a new ClassVariableAndWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -4424,18 +4277,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ClassVariableAndWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ClassVariableAndWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ClassVariableAndWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ClassVariableAndWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ClassVariableAndWriteNode alias deconstruct child_nodes @@ -4544,8 +4392,8 @@ module Prism # Initialize a new ClassVariableOperatorWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void # See Node.accept. # -- @@ -4569,18 +4417,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ClassVariableOperatorWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ClassVariableOperatorWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ClassVariableOperatorWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ClassVariableOperatorWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ClassVariableOperatorWriteNode alias deconstruct child_nodes @@ -4675,8 +4518,8 @@ module Prism # Initialize a new ClassVariableOrWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -4700,18 +4543,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ClassVariableOrWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ClassVariableOrWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ClassVariableOrWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ClassVariableOrWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ClassVariableOrWriteNode alias deconstruct child_nodes @@ -4800,8 +4638,8 @@ module Prism # Initialize a new ClassVariableReadNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void # See Node.accept. # -- @@ -4825,18 +4663,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ClassVariableReadNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ClassVariableReadNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ClassVariableReadNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> ClassVariableReadNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> ClassVariableReadNode alias deconstruct child_nodes @@ -4881,8 +4714,8 @@ module Prism # Initialize a new ClassVariableTargetNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void # See Node.accept. # -- @@ -4906,18 +4739,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ClassVariableTargetNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ClassVariableTargetNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ClassVariableTargetNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> ClassVariableTargetNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> ClassVariableTargetNode alias deconstruct child_nodes @@ -4964,8 +4792,8 @@ module Prism # Initialize a new ClassVariableWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Prism::node value, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Prism::node value, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Prism::node value, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Prism::node value, Location operator_loc) -> void # See Node.accept. # -- @@ -4989,18 +4817,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ClassVariableWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> ClassVariableWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> ClassVariableWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> ClassVariableWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> ClassVariableWriteNode alias deconstruct child_nodes @@ -5111,8 +4934,8 @@ module Prism # Initialize a new ConstantAndWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -5136,18 +4959,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ConstantAndWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ConstantAndWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ConstantAndWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ConstantAndWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ConstantAndWriteNode alias deconstruct child_nodes @@ -5244,8 +5062,8 @@ module Prism # Initialize a new ConstantOperatorWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void # See Node.accept. # -- @@ -5269,18 +5087,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ConstantOperatorWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ConstantOperatorWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ConstantOperatorWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ConstantOperatorWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ConstantOperatorWriteNode alias deconstruct child_nodes @@ -5375,8 +5188,8 @@ module Prism # Initialize a new ConstantOrWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -5400,18 +5213,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ConstantOrWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ConstantOrWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ConstantOrWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ConstantOrWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ConstantOrWriteNode alias deconstruct child_nodes @@ -5504,8 +5312,8 @@ module Prism # Initialize a new ConstantPathAndWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ConstantPathNode target, Location operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, ConstantPathNode target, Location operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ConstantPathNode target, Location operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ConstantPathNode target, Location operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -5529,18 +5337,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ConstantPathAndWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathAndWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathAndWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathAndWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathAndWriteNode alias deconstruct child_nodes @@ -5619,8 +5422,8 @@ module Prism # Initialize a new ConstantPathNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node? parent, Symbol? name, Location delimiter_loc, Location name_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node? parent, Symbol? name, Location delimiter_loc, Location name_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? parent, Symbol? name, Location delimiter_loc, Location name_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? parent, Symbol? name, Location delimiter_loc, Location name_loc) -> void # See Node.accept. # -- @@ -5644,18 +5447,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ConstantPathNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?parent: Prism::node?, ?name: Symbol?, ?delimiter_loc: Location, ?name_loc: Location) -> ConstantPathNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?parent: Prism::node?, ?name: Symbol?, ?delimiter_loc: Location, ?name_loc: Location) -> ConstantPathNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?parent: Prism::node?, ?name: Symbol?, ?delimiter_loc: Location, ?name_loc: Location) -> ConstantPathNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?parent: Prism::node?, ?name: Symbol?, ?delimiter_loc: Location, ?name_loc: Location) -> ConstantPathNode alias deconstruct child_nodes @@ -5771,8 +5569,8 @@ module Prism # Initialize a new ConstantPathOperatorWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ConstantPathNode target, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, ConstantPathNode target, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ConstantPathNode target, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ConstantPathNode target, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void # See Node.accept. # -- @@ -5796,18 +5594,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ConstantPathOperatorWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ConstantPathOperatorWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ConstantPathOperatorWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?target: ConstantPathNode, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ConstantPathOperatorWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?target: ConstantPathNode, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ConstantPathOperatorWriteNode alias deconstruct child_nodes @@ -5884,8 +5677,8 @@ module Prism # Initialize a new ConstantPathOrWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ConstantPathNode target, Location operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, ConstantPathNode target, Location operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ConstantPathNode target, Location operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ConstantPathNode target, Location operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -5909,18 +5702,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ConstantPathOrWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathOrWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathOrWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathOrWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathOrWriteNode alias deconstruct child_nodes @@ -5999,8 +5787,8 @@ module Prism # Initialize a new ConstantPathTargetNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node? parent, Symbol? name, Location delimiter_loc, Location name_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node? parent, Symbol? name, Location delimiter_loc, Location name_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? parent, Symbol? name, Location delimiter_loc, Location name_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? parent, Symbol? name, Location delimiter_loc, Location name_loc) -> void # See Node.accept. # -- @@ -6024,18 +5812,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ConstantPathTargetNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?parent: Prism::node?, ?name: Symbol?, ?delimiter_loc: Location, ?name_loc: Location) -> ConstantPathTargetNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?parent: Prism::node?, ?name: Symbol?, ?delimiter_loc: Location, ?name_loc: Location) -> ConstantPathTargetNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?parent: Prism::node?, ?name: Symbol?, ?delimiter_loc: Location, ?name_loc: Location) -> ConstantPathTargetNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?parent: Prism::node?, ?name: Symbol?, ?delimiter_loc: Location, ?name_loc: Location) -> ConstantPathTargetNode alias deconstruct child_nodes @@ -6134,8 +5917,8 @@ module Prism # Initialize a new ConstantPathWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ConstantPathNode target, Location operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, ConstantPathNode target, Location operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ConstantPathNode target, Location operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ConstantPathNode target, Location operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -6159,18 +5942,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ConstantPathWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathWriteNode alias deconstruct child_nodes @@ -6255,8 +6033,8 @@ module Prism # Initialize a new ConstantReadNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void # See Node.accept. # -- @@ -6280,18 +6058,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ConstantReadNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ConstantReadNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ConstantReadNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> ConstantReadNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> ConstantReadNode alias deconstruct child_nodes @@ -6336,8 +6109,8 @@ module Prism # Initialize a new ConstantTargetNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void # See Node.accept. # -- @@ -6361,18 +6134,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ConstantTargetNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ConstantTargetNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ConstantTargetNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> ConstantTargetNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> ConstantTargetNode alias deconstruct child_nodes @@ -6419,8 +6187,8 @@ module Prism # Initialize a new ConstantWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Prism::node value, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Prism::node value, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Prism::node value, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Prism::node value, Location operator_loc) -> void # See Node.accept. # -- @@ -6444,18 +6212,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ConstantWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> ConstantWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> ConstantWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> ConstantWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> ConstantWriteNode alias deconstruct child_nodes @@ -6583,8 +6346,8 @@ module Prism # Initialize a new DefNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Prism::node? receiver, ParametersNode? parameters, (StatementsNode | BeginNode)? body, Array[Symbol] locals, Location def_keyword_loc, Location? operator_loc, Location? lparen_loc, Location? rparen_loc, Location? equal_loc, Location? end_keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Prism::node? receiver, ParametersNode? parameters, (StatementsNode | BeginNode)? body, Array[Symbol] locals, Location def_keyword_loc, Location? operator_loc, Location? lparen_loc, Location? rparen_loc, Location? equal_loc, Location? end_keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Prism::node? receiver, ParametersNode? parameters, (StatementsNode | BeginNode)? body, Array[Symbol] locals, Location def_keyword_loc, Location? operator_loc, Location? lparen_loc, Location? rparen_loc, Location? equal_loc, Location? end_keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Prism::node? receiver, ParametersNode? parameters, (StatementsNode | BeginNode)? body, Array[Symbol] locals, Location def_keyword_loc, Location? operator_loc, Location? lparen_loc, Location? rparen_loc, Location? equal_loc, Location? end_keyword_loc) -> void # See Node.accept. # -- @@ -6608,18 +6371,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> DefNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?receiver: Prism::node?, ?parameters: ParametersNode?, ?body: (StatementsNode | BeginNode)?, ?locals: Array[Symbol], ?def_keyword_loc: Location, ?operator_loc: Location?, ?lparen_loc: Location?, ?rparen_loc: Location?, ?equal_loc: Location?, ?end_keyword_loc: Location?) -> DefNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?receiver: Prism::node?, ?parameters: ParametersNode?, ?body: (StatementsNode | BeginNode)?, ?locals: Array[Symbol], ?def_keyword_loc: Location, ?operator_loc: Location?, ?lparen_loc: Location?, ?rparen_loc: Location?, ?equal_loc: Location?, ?end_keyword_loc: Location?) -> DefNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?receiver: Prism::node?, ?parameters: ParametersNode?, ?body: (StatementsNode | BeginNode)?, ?locals: Array[Symbol], ?def_keyword_loc: Location, ?operator_loc: Location?, ?lparen_loc: Location?, ?rparen_loc: Location?, ?equal_loc: Location?, ?end_keyword_loc: Location?) -> DefNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?receiver: Prism::node?, ?parameters: ParametersNode?, ?body: (StatementsNode | BeginNode)?, ?locals: Array[Symbol], ?def_keyword_loc: Location, ?operator_loc: Location?, ?lparen_loc: Location?, ?rparen_loc: Location?, ?equal_loc: Location?, ?end_keyword_loc: Location?) -> DefNode alias deconstruct child_nodes @@ -6858,8 +6616,8 @@ module Prism # Initialize a new DefinedNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location? lparen_loc, Prism::node value, Location? rparen_loc, Location keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location? lparen_loc, Prism::node value, Location? rparen_loc, Location keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location? lparen_loc, Prism::node value, Location? rparen_loc, Location keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location? lparen_loc, Prism::node value, Location? rparen_loc, Location keyword_loc) -> void # See Node.accept. # -- @@ -6883,18 +6641,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> DefinedNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?lparen_loc: Location?, ?value: Prism::node, ?rparen_loc: Location?, ?keyword_loc: Location) -> DefinedNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?lparen_loc: Location?, ?value: Prism::node, ?rparen_loc: Location?, ?keyword_loc: Location) -> DefinedNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?lparen_loc: Location?, ?value: Prism::node, ?rparen_loc: Location?, ?keyword_loc: Location) -> DefinedNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?lparen_loc: Location?, ?value: Prism::node, ?rparen_loc: Location?, ?keyword_loc: Location) -> DefinedNode alias deconstruct child_nodes @@ -7011,8 +6764,8 @@ module Prism # Initialize a new ElseNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location else_keyword_loc, StatementsNode? statements, Location? end_keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location else_keyword_loc, StatementsNode? statements, Location? end_keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location else_keyword_loc, StatementsNode? statements, Location? end_keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location else_keyword_loc, StatementsNode? statements, Location? end_keyword_loc) -> void # See Node.accept. # -- @@ -7036,18 +6789,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ElseNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?else_keyword_loc: Location, ?statements: StatementsNode?, ?end_keyword_loc: Location?) -> ElseNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?else_keyword_loc: Location, ?statements: StatementsNode?, ?end_keyword_loc: Location?) -> ElseNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?else_keyword_loc: Location, ?statements: StatementsNode?, ?end_keyword_loc: Location?) -> ElseNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?else_keyword_loc: Location, ?statements: StatementsNode?, ?end_keyword_loc: Location?) -> ElseNode alias deconstruct child_nodes @@ -7140,8 +6888,8 @@ module Prism # Initialize a new EmbeddedStatementsNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location opening_loc, StatementsNode? statements, Location closing_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location opening_loc, StatementsNode? statements, Location closing_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location opening_loc, StatementsNode? statements, Location closing_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location opening_loc, StatementsNode? statements, Location closing_loc) -> void # See Node.accept. # -- @@ -7165,18 +6913,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> EmbeddedStatementsNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?statements: StatementsNode?, ?closing_loc: Location) -> EmbeddedStatementsNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?statements: StatementsNode?, ?closing_loc: Location) -> EmbeddedStatementsNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location, ?statements: StatementsNode?, ?closing_loc: Location) -> EmbeddedStatementsNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location, ?statements: StatementsNode?, ?closing_loc: Location) -> EmbeddedStatementsNode alias deconstruct child_nodes @@ -7267,8 +7010,8 @@ module Prism # Initialize a new EmbeddedVariableNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location operator_loc, (InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode) variable) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location operator_loc, InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode variable) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location operator_loc, (InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode) variable) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location operator_loc, InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode variable) -> void # See Node.accept. # -- @@ -7292,18 +7035,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> EmbeddedVariableNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?variable: (InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode)) -> EmbeddedVariableNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?variable: InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode) -> EmbeddedVariableNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?operator_loc: Location, ?variable: (InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode)) -> EmbeddedVariableNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?operator_loc: Location, ?variable: InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode) -> EmbeddedVariableNode alias deconstruct child_nodes @@ -7376,8 +7114,8 @@ module Prism # Initialize a new EnsureNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location ensure_keyword_loc, StatementsNode? statements, Location end_keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location ensure_keyword_loc, StatementsNode? statements, Location end_keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location ensure_keyword_loc, StatementsNode? statements, Location end_keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location ensure_keyword_loc, StatementsNode? statements, Location end_keyword_loc) -> void # See Node.accept. # -- @@ -7401,18 +7139,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> EnsureNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?ensure_keyword_loc: Location, ?statements: StatementsNode?, ?end_keyword_loc: Location) -> EnsureNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?ensure_keyword_loc: Location, ?statements: StatementsNode?, ?end_keyword_loc: Location) -> EnsureNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?ensure_keyword_loc: Location, ?statements: StatementsNode?, ?end_keyword_loc: Location) -> EnsureNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?ensure_keyword_loc: Location, ?statements: StatementsNode?, ?end_keyword_loc: Location) -> EnsureNode alias deconstruct child_nodes @@ -7498,8 +7231,8 @@ module Prism # Initialize a new ErrorRecoveryNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node? unexpected) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node? unexpected) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? unexpected) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? unexpected) -> void # See Node.accept. # -- @@ -7523,18 +7256,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ErrorRecoveryNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?unexpected: Prism::node?) -> ErrorRecoveryNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?unexpected: Prism::node?) -> ErrorRecoveryNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?unexpected: Prism::node?) -> ErrorRecoveryNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?unexpected: Prism::node?) -> ErrorRecoveryNode alias deconstruct child_nodes @@ -7573,8 +7301,8 @@ module Prism class FalseNode < Node # Initialize a new FalseNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments) -> void # See Node.accept. # -- @@ -7598,18 +7326,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> FalseNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ) -> FalseNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> FalseNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ) -> FalseNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?) -> FalseNode alias deconstruct child_nodes @@ -7661,8 +7384,8 @@ module Prism # Initialize a new FindPatternNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, (ConstantPathNode | ConstantReadNode)? constant, SplatNode left, Array[Prism::node] requireds, SplatNode right, Location? opening_loc, Location? closing_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, (ConstantPathNode | ConstantReadNode)? constant, SplatNode left, Array[Prism::node] requireds, SplatNode right, Location? opening_loc, Location? closing_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, (ConstantPathNode | ConstantReadNode)? constant, SplatNode left, Array[Prism::node] requireds, SplatNode right, Location? opening_loc, Location? closing_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, (ConstantPathNode | ConstantReadNode)? constant, SplatNode left, Array[Prism::node] requireds, SplatNode right, Location? opening_loc, Location? closing_loc) -> void # See Node.accept. # -- @@ -7686,18 +7409,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> FindPatternNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: (ConstantPathNode | ConstantReadNode)?, ?left: SplatNode, ?requireds: Array[Prism::node], ?right: SplatNode, ?opening_loc: Location?, ?closing_loc: Location?) -> FindPatternNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: (ConstantPathNode | ConstantReadNode)?, ?left: SplatNode, ?requireds: Array[Prism::node], ?right: SplatNode, ?opening_loc: Location?, ?closing_loc: Location?) -> FindPatternNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?constant: (ConstantPathNode | ConstantReadNode)?, ?left: SplatNode, ?requireds: Array[Prism::node], ?right: SplatNode, ?opening_loc: Location?, ?closing_loc: Location?) -> FindPatternNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?constant: (ConstantPathNode | ConstantReadNode)?, ?left: SplatNode, ?requireds: Array[Prism::node], ?right: SplatNode, ?opening_loc: Location?, ?closing_loc: Location?) -> FindPatternNode alias deconstruct child_nodes @@ -7847,8 +7565,8 @@ module Prism # Initialize a new FlipFlopNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node? left, Prism::node? right, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node? left, Prism::node? right, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? left, Prism::node? right, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? left, Prism::node? right, Location operator_loc) -> void # See Node.accept. # -- @@ -7872,18 +7590,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> FlipFlopNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node?, ?right: Prism::node?, ?operator_loc: Location) -> FlipFlopNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node?, ?right: Prism::node?, ?operator_loc: Location) -> FlipFlopNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?left: Prism::node?, ?right: Prism::node?, ?operator_loc: Location) -> FlipFlopNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?left: Prism::node?, ?right: Prism::node?, ?operator_loc: Location) -> FlipFlopNode alias deconstruct child_nodes @@ -7962,8 +7675,8 @@ module Prism # Initialize a new FloatNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Float value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Float value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Float value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Float value) -> void # See Node.accept. # -- @@ -7987,18 +7700,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> FloatNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Float) -> FloatNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Float) -> FloatNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?value: Float) -> FloatNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?value: Float) -> FloatNode alias deconstruct child_nodes @@ -8051,8 +7759,8 @@ module Prism # Initialize a new ForNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, (LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode) index, Prism::node collection, StatementsNode? statements, Location for_keyword_loc, Location in_keyword_loc, Location? do_keyword_loc, Location end_keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode index, Prism::node collection, StatementsNode? statements, Location for_keyword_loc, Location in_keyword_loc, Location? do_keyword_loc, Location end_keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, (LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode) index, Prism::node collection, StatementsNode? statements, Location for_keyword_loc, Location in_keyword_loc, Location? do_keyword_loc, Location end_keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode index, Prism::node collection, StatementsNode? statements, Location for_keyword_loc, Location in_keyword_loc, Location? do_keyword_loc, Location end_keyword_loc) -> void # See Node.accept. # -- @@ -8076,18 +7784,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ForNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?index: (LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode), ?collection: Prism::node, ?statements: StatementsNode?, ?for_keyword_loc: Location, ?in_keyword_loc: Location, ?do_keyword_loc: Location?, ?end_keyword_loc: Location) -> ForNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?index: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode, ?collection: Prism::node, ?statements: StatementsNode?, ?for_keyword_loc: Location, ?in_keyword_loc: Location, ?do_keyword_loc: Location?, ?end_keyword_loc: Location) -> ForNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?index: (LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode), ?collection: Prism::node, ?statements: StatementsNode?, ?for_keyword_loc: Location, ?in_keyword_loc: Location, ?do_keyword_loc: Location?, ?end_keyword_loc: Location) -> ForNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?index: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode, ?collection: Prism::node, ?statements: StatementsNode?, ?for_keyword_loc: Location, ?in_keyword_loc: Location, ?do_keyword_loc: Location?, ?end_keyword_loc: Location) -> ForNode alias deconstruct child_nodes @@ -8263,8 +7966,8 @@ module Prism class ForwardingArgumentsNode < Node # Initialize a new ForwardingArgumentsNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments) -> void # See Node.accept. # -- @@ -8288,18 +7991,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ForwardingArgumentsNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ) -> ForwardingArgumentsNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> ForwardingArgumentsNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ) -> ForwardingArgumentsNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?) -> ForwardingArgumentsNode alias deconstruct child_nodes @@ -8331,8 +8029,8 @@ module Prism class ForwardingParameterNode < Node # Initialize a new ForwardingParameterNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments) -> void # See Node.accept. # -- @@ -8356,18 +8054,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ForwardingParameterNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ) -> ForwardingParameterNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> ForwardingParameterNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ) -> ForwardingParameterNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?) -> ForwardingParameterNode alias deconstruct child_nodes @@ -8407,8 +8100,8 @@ module Prism # Initialize a new ForwardingSuperNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, BlockNode? block) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, BlockNode? block) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, BlockNode? block) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, BlockNode? block) -> void # See Node.accept. # -- @@ -8432,18 +8125,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ForwardingSuperNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?block: BlockNode?) -> ForwardingSuperNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?block: BlockNode?) -> ForwardingSuperNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?block: BlockNode?) -> ForwardingSuperNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?block: BlockNode?) -> ForwardingSuperNode alias deconstruct child_nodes @@ -8518,8 +8206,8 @@ module Prism # Initialize a new GlobalVariableAndWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -8543,18 +8231,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> GlobalVariableAndWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> GlobalVariableAndWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> GlobalVariableAndWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> GlobalVariableAndWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> GlobalVariableAndWriteNode alias deconstruct child_nodes @@ -8651,8 +8334,8 @@ module Prism # Initialize a new GlobalVariableOperatorWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void # See Node.accept. # -- @@ -8676,18 +8359,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> GlobalVariableOperatorWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> GlobalVariableOperatorWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> GlobalVariableOperatorWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> GlobalVariableOperatorWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> GlobalVariableOperatorWriteNode alias deconstruct child_nodes @@ -8782,8 +8460,8 @@ module Prism # Initialize a new GlobalVariableOrWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -8807,18 +8485,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> GlobalVariableOrWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> GlobalVariableOrWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> GlobalVariableOrWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> GlobalVariableOrWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> GlobalVariableOrWriteNode alias deconstruct child_nodes @@ -8907,8 +8580,8 @@ module Prism # Initialize a new GlobalVariableReadNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void # See Node.accept. # -- @@ -8932,18 +8605,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> GlobalVariableReadNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> GlobalVariableReadNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> GlobalVariableReadNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> GlobalVariableReadNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> GlobalVariableReadNode alias deconstruct child_nodes @@ -8988,8 +8656,8 @@ module Prism # Initialize a new GlobalVariableTargetNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void # See Node.accept. # -- @@ -9013,18 +8681,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> GlobalVariableTargetNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> GlobalVariableTargetNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> GlobalVariableTargetNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> GlobalVariableTargetNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> GlobalVariableTargetNode alias deconstruct child_nodes @@ -9071,8 +8734,8 @@ module Prism # Initialize a new GlobalVariableWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Prism::node value, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Prism::node value, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Prism::node value, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Prism::node value, Location operator_loc) -> void # See Node.accept. # -- @@ -9096,18 +8759,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> GlobalVariableWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> GlobalVariableWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> GlobalVariableWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> GlobalVariableWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> GlobalVariableWriteNode alias deconstruct child_nodes @@ -9216,8 +8874,8 @@ module Prism # Initialize a new HashNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location opening_loc, Array[AssocNode | AssocSplatNode] elements, Location closing_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location opening_loc, Array[AssocNode | AssocSplatNode] elements, Location closing_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location opening_loc, Array[AssocNode | AssocSplatNode] elements, Location closing_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location opening_loc, Array[AssocNode | AssocSplatNode] elements, Location closing_loc) -> void # See Node.accept. # -- @@ -9241,18 +8899,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> HashNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?elements: Array[AssocNode | AssocSplatNode], ?closing_loc: Location) -> HashNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?elements: Array[AssocNode | AssocSplatNode], ?closing_loc: Location) -> HashNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location, ?elements: Array[AssocNode | AssocSplatNode], ?closing_loc: Location) -> HashNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location, ?elements: Array[AssocNode | AssocSplatNode], ?closing_loc: Location) -> HashNode alias deconstruct child_nodes @@ -9370,8 +9023,8 @@ module Prism # Initialize a new HashPatternNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, (ConstantPathNode | ConstantReadNode)? constant, Array[AssocNode] elements, (AssocSplatNode | NoKeywordsParameterNode)? rest, Location? opening_loc, Location? closing_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, (ConstantPathNode | ConstantReadNode)? constant, Array[AssocNode] elements, (AssocSplatNode | NoKeywordsParameterNode)? rest, Location? opening_loc, Location? closing_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, (ConstantPathNode | ConstantReadNode)? constant, Array[AssocNode] elements, (AssocSplatNode | NoKeywordsParameterNode)? rest, Location? opening_loc, Location? closing_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, (ConstantPathNode | ConstantReadNode)? constant, Array[AssocNode] elements, (AssocSplatNode | NoKeywordsParameterNode)? rest, Location? opening_loc, Location? closing_loc) -> void # See Node.accept. # -- @@ -9395,18 +9048,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> HashPatternNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: (ConstantPathNode | ConstantReadNode)?, ?elements: Array[AssocNode], ?rest: (AssocSplatNode | NoKeywordsParameterNode)?, ?opening_loc: Location?, ?closing_loc: Location?) -> HashPatternNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: (ConstantPathNode | ConstantReadNode)?, ?elements: Array[AssocNode], ?rest: (AssocSplatNode | NoKeywordsParameterNode)?, ?opening_loc: Location?, ?closing_loc: Location?) -> HashPatternNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?constant: (ConstantPathNode | ConstantReadNode)?, ?elements: Array[AssocNode], ?rest: (AssocSplatNode | NoKeywordsParameterNode)?, ?opening_loc: Location?, ?closing_loc: Location?) -> HashPatternNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?constant: (ConstantPathNode | ConstantReadNode)?, ?elements: Array[AssocNode], ?rest: (AssocSplatNode | NoKeywordsParameterNode)?, ?opening_loc: Location?, ?closing_loc: Location?) -> HashPatternNode alias deconstruct child_nodes @@ -9557,8 +9205,8 @@ module Prism # Initialize a new IfNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location? if_keyword_loc, Prism::node predicate, Location? then_keyword_loc, StatementsNode? statements, (ElseNode | IfNode)? subsequent, Location? end_keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location? if_keyword_loc, Prism::node predicate, Location? then_keyword_loc, StatementsNode? statements, (ElseNode | IfNode)? subsequent, Location? end_keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location? if_keyword_loc, Prism::node predicate, Location? then_keyword_loc, StatementsNode? statements, (ElseNode | IfNode)? subsequent, Location? end_keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location? if_keyword_loc, Prism::node predicate, Location? then_keyword_loc, StatementsNode? statements, (ElseNode | IfNode)? subsequent, Location? end_keyword_loc) -> void # See Node.accept. # -- @@ -9582,18 +9230,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> IfNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?if_keyword_loc: Location?, ?predicate: Prism::node, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?subsequent: (ElseNode | IfNode)?, ?end_keyword_loc: Location?) -> IfNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?if_keyword_loc: Location?, ?predicate: Prism::node, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?subsequent: (ElseNode | IfNode)?, ?end_keyword_loc: Location?) -> IfNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?if_keyword_loc: Location?, ?predicate: Prism::node, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?subsequent: (ElseNode | IfNode)?, ?end_keyword_loc: Location?) -> IfNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?if_keyword_loc: Location?, ?predicate: Prism::node, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?subsequent: (ElseNode | IfNode)?, ?end_keyword_loc: Location?) -> IfNode alias deconstruct child_nodes @@ -9768,8 +9411,8 @@ module Prism # Initialize a new ImaginaryNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, (FloatNode | IntegerNode | RationalNode) numeric) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, FloatNode | IntegerNode | RationalNode numeric) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, (FloatNode | IntegerNode | RationalNode) numeric) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, FloatNode | IntegerNode | RationalNode numeric) -> void # See Node.accept. # -- @@ -9793,18 +9436,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ImaginaryNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?numeric: (FloatNode | IntegerNode | RationalNode)) -> ImaginaryNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?numeric: FloatNode | IntegerNode | RationalNode) -> ImaginaryNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?numeric: (FloatNode | IntegerNode | RationalNode)) -> ImaginaryNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?numeric: FloatNode | IntegerNode | RationalNode) -> ImaginaryNode alias deconstruct child_nodes @@ -9851,8 +9489,8 @@ module Prism # Initialize a new ImplicitNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, (LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode) value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, (LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode) value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode value) -> void # See Node.accept. # -- @@ -9876,18 +9514,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ImplicitNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: (LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode)) -> ImplicitNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode) -> ImplicitNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?value: (LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode)) -> ImplicitNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?value: LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode) -> ImplicitNode alias deconstruct child_nodes @@ -9935,8 +9568,8 @@ module Prism class ImplicitRestNode < Node # Initialize a new ImplicitRestNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments) -> void # See Node.accept. # -- @@ -9960,18 +9593,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ImplicitRestNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ) -> ImplicitRestNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> ImplicitRestNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ) -> ImplicitRestNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?) -> ImplicitRestNode alias deconstruct child_nodes @@ -10010,8 +9638,8 @@ module Prism # Initialize a new InNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node pattern, StatementsNode? statements, Location in_loc, Location? then_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node pattern, StatementsNode? statements, Location in_loc, Location? then_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node pattern, StatementsNode? statements, Location in_loc, Location? then_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node pattern, StatementsNode? statements, Location in_loc, Location? then_loc) -> void # See Node.accept. # -- @@ -10035,18 +9663,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> InNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?pattern: Prism::node, ?statements: StatementsNode?, ?in_loc: Location, ?then_loc: Location?) -> InNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?pattern: Prism::node, ?statements: StatementsNode?, ?in_loc: Location, ?then_loc: Location?) -> InNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?pattern: Prism::node, ?statements: StatementsNode?, ?in_loc: Location, ?then_loc: Location?) -> InNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?pattern: Prism::node, ?statements: StatementsNode?, ?in_loc: Location, ?then_loc: Location?) -> InNode alias deconstruct child_nodes @@ -10157,8 +9780,8 @@ module Prism # Initialize a new IndexAndWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node? receiver, Location? call_operator_loc, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, BlockArgumentNode? block, Location operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node? receiver, Location? call_operator_loc, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, BlockArgumentNode? block, Location operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? receiver, Location? call_operator_loc, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, BlockArgumentNode? block, Location operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? receiver, Location? call_operator_loc, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, BlockArgumentNode? block, Location operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -10182,18 +9805,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> IndexAndWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?operator_loc: Location, ?value: Prism::node) -> IndexAndWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?operator_loc: Location, ?value: Prism::node) -> IndexAndWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?operator_loc: Location, ?value: Prism::node) -> IndexAndWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?operator_loc: Location, ?value: Prism::node) -> IndexAndWriteNode alias deconstruct child_nodes @@ -10394,8 +10012,8 @@ module Prism # Initialize a new IndexOperatorWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node? receiver, Location? call_operator_loc, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, BlockArgumentNode? block, Symbol binary_operator, Location binary_operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node? receiver, Location? call_operator_loc, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, BlockArgumentNode? block, Symbol binary_operator, Location binary_operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? receiver, Location? call_operator_loc, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, BlockArgumentNode? block, Symbol binary_operator, Location binary_operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? receiver, Location? call_operator_loc, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, BlockArgumentNode? block, Symbol binary_operator, Location binary_operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -10419,18 +10037,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> IndexOperatorWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?binary_operator: Symbol, ?binary_operator_loc: Location, ?value: Prism::node) -> IndexOperatorWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?binary_operator: Symbol, ?binary_operator_loc: Location, ?value: Prism::node) -> IndexOperatorWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?binary_operator: Symbol, ?binary_operator_loc: Location, ?value: Prism::node) -> IndexOperatorWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?binary_operator: Symbol, ?binary_operator_loc: Location, ?value: Prism::node) -> IndexOperatorWriteNode alias deconstruct child_nodes @@ -10629,8 +10242,8 @@ module Prism # Initialize a new IndexOrWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node? receiver, Location? call_operator_loc, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, BlockArgumentNode? block, Location operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node? receiver, Location? call_operator_loc, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, BlockArgumentNode? block, Location operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? receiver, Location? call_operator_loc, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, BlockArgumentNode? block, Location operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? receiver, Location? call_operator_loc, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, BlockArgumentNode? block, Location operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -10654,18 +10267,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> IndexOrWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?operator_loc: Location, ?value: Prism::node) -> IndexOrWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?operator_loc: Location, ?value: Prism::node) -> IndexOrWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?operator_loc: Location, ?value: Prism::node) -> IndexOrWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?operator_loc: Location, ?value: Prism::node) -> IndexOrWriteNode alias deconstruct child_nodes @@ -10866,8 +10474,8 @@ module Prism # Initialize a new IndexTargetNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node receiver, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, BlockArgumentNode? block) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node receiver, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, BlockArgumentNode? block) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node receiver, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, BlockArgumentNode? block) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node receiver, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, BlockArgumentNode? block) -> void # See Node.accept. # -- @@ -10891,18 +10499,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> IndexTargetNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?) -> IndexTargetNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?) -> IndexTargetNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?) -> IndexTargetNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?receiver: Prism::node, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?) -> IndexTargetNode alias deconstruct child_nodes @@ -11037,8 +10640,8 @@ module Prism # Initialize a new InstanceVariableAndWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -11062,18 +10665,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> InstanceVariableAndWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> InstanceVariableAndWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> InstanceVariableAndWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> InstanceVariableAndWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> InstanceVariableAndWriteNode alias deconstruct child_nodes @@ -11170,8 +10768,8 @@ module Prism # Initialize a new InstanceVariableOperatorWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void # See Node.accept. # -- @@ -11195,18 +10793,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> InstanceVariableOperatorWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> InstanceVariableOperatorWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> InstanceVariableOperatorWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> InstanceVariableOperatorWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> InstanceVariableOperatorWriteNode alias deconstruct child_nodes @@ -11301,8 +10894,8 @@ module Prism # Initialize a new InstanceVariableOrWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -11326,18 +10919,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> InstanceVariableOrWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> InstanceVariableOrWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> InstanceVariableOrWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> InstanceVariableOrWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> InstanceVariableOrWriteNode alias deconstruct child_nodes @@ -11426,8 +11014,8 @@ module Prism # Initialize a new InstanceVariableReadNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void # See Node.accept. # -- @@ -11451,18 +11039,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> InstanceVariableReadNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> InstanceVariableReadNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> InstanceVariableReadNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> InstanceVariableReadNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> InstanceVariableReadNode alias deconstruct child_nodes @@ -11507,8 +11090,8 @@ module Prism # Initialize a new InstanceVariableTargetNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void # See Node.accept. # -- @@ -11532,18 +11115,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> InstanceVariableTargetNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> InstanceVariableTargetNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> InstanceVariableTargetNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> InstanceVariableTargetNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> InstanceVariableTargetNode alias deconstruct child_nodes @@ -11590,8 +11168,8 @@ module Prism # Initialize a new InstanceVariableWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Prism::node value, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Prism::node value, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Prism::node value, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Prism::node value, Location operator_loc) -> void # See Node.accept. # -- @@ -11615,18 +11193,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> InstanceVariableWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> InstanceVariableWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> InstanceVariableWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> InstanceVariableWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> InstanceVariableWriteNode alias deconstruct child_nodes @@ -11731,8 +11304,8 @@ module Prism # Initialize a new IntegerNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Integer value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Integer value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Integer value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Integer value) -> void # See Node.accept. # -- @@ -11756,18 +11329,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> IntegerNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Integer) -> IntegerNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Integer) -> IntegerNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?value: Integer) -> IntegerNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?value: Integer) -> IntegerNode alias deconstruct child_nodes @@ -11836,8 +11404,8 @@ module Prism # Initialize a new InterpolatedMatchLastLineNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location closing_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location closing_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location closing_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location closing_loc) -> void # See Node.accept. # -- @@ -11861,18 +11429,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> InterpolatedMatchLastLineNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedMatchLastLineNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedMatchLastLineNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedMatchLastLineNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedMatchLastLineNode alias deconstruct child_nodes @@ -12031,8 +11594,8 @@ module Prism # Initialize a new InterpolatedRegularExpressionNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location closing_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location closing_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location closing_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location closing_loc) -> void # See Node.accept. # -- @@ -12056,18 +11619,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> InterpolatedRegularExpressionNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedRegularExpressionNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedRegularExpressionNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedRegularExpressionNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedRegularExpressionNode alias deconstruct child_nodes @@ -12226,8 +11784,8 @@ module Prism # Initialize a new InterpolatedStringNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location? opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode] parts, Location? closing_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location? opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode] parts, Location? closing_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location? opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode] parts, Location? closing_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location? opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode] parts, Location? closing_loc) -> void # See Node.accept. # -- @@ -12251,18 +11809,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> InterpolatedStringNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode], ?closing_loc: Location?) -> InterpolatedStringNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode], ?closing_loc: Location?) -> InterpolatedStringNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location?, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode], ?closing_loc: Location?) -> InterpolatedStringNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location?, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode], ?closing_loc: Location?) -> InterpolatedStringNode alias deconstruct child_nodes @@ -12367,8 +11920,8 @@ module Prism # Initialize a new InterpolatedSymbolNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location? opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location? closing_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location? opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location? closing_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location? opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location? closing_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location? opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location? closing_loc) -> void # See Node.accept. # -- @@ -12392,18 +11945,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> InterpolatedSymbolNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location?) -> InterpolatedSymbolNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location?) -> InterpolatedSymbolNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location?, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location?) -> InterpolatedSymbolNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location?, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location?) -> InterpolatedSymbolNode alias deconstruct child_nodes @@ -12496,8 +12044,8 @@ module Prism # Initialize a new InterpolatedXStringNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location closing_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location closing_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location closing_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location opening_loc, Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] parts, Location closing_loc) -> void # See Node.accept. # -- @@ -12521,18 +12069,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> InterpolatedXStringNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedXStringNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedXStringNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedXStringNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedXStringNode alias deconstruct child_nodes @@ -12619,8 +12162,8 @@ module Prism class ItLocalVariableReadNode < Node # Initialize a new ItLocalVariableReadNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments) -> void # See Node.accept. # -- @@ -12644,18 +12187,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ItLocalVariableReadNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ) -> ItLocalVariableReadNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> ItLocalVariableReadNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ) -> ItLocalVariableReadNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?) -> ItLocalVariableReadNode alias deconstruct child_nodes @@ -12686,8 +12224,8 @@ module Prism class ItParametersNode < Node # Initialize a new ItParametersNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments) -> void # See Node.accept. # -- @@ -12711,18 +12249,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ItParametersNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ) -> ItParametersNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> ItParametersNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ) -> ItParametersNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?) -> ItParametersNode alias deconstruct child_nodes @@ -12755,8 +12288,8 @@ module Prism # Initialize a new KeywordHashNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Array[AssocNode | AssocSplatNode] elements) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Array[AssocNode | AssocSplatNode] elements) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[AssocNode | AssocSplatNode] elements) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[AssocNode | AssocSplatNode] elements) -> void # See Node.accept. # -- @@ -12780,18 +12313,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> KeywordHashNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?elements: Array[AssocNode | AssocSplatNode]) -> KeywordHashNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?elements: Array[AssocNode | AssocSplatNode]) -> KeywordHashNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?elements: Array[AssocNode | AssocSplatNode]) -> KeywordHashNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?elements: Array[AssocNode | AssocSplatNode]) -> KeywordHashNode alias deconstruct child_nodes @@ -12843,8 +12371,8 @@ module Prism # Initialize a new KeywordRestParameterNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol? name, Location? name_loc, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol? name, Location? name_loc, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol? name, Location? name_loc, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol? name, Location? name_loc, Location operator_loc) -> void # See Node.accept. # -- @@ -12868,18 +12396,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> KeywordRestParameterNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> KeywordRestParameterNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> KeywordRestParameterNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> KeywordRestParameterNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> KeywordRestParameterNode alias deconstruct child_nodes @@ -12976,8 +12499,8 @@ module Prism # Initialize a new LambdaNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Array[Symbol] locals, Location operator_loc, Location opening_loc, Location closing_loc, (BlockParametersNode | NumberedParametersNode | ItParametersNode)? parameters, (StatementsNode | BeginNode)? body) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Array[Symbol] locals, Location operator_loc, Location opening_loc, Location closing_loc, (BlockParametersNode | NumberedParametersNode | ItParametersNode)? parameters, (StatementsNode | BeginNode)? body) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Symbol] locals, Location operator_loc, Location opening_loc, Location closing_loc, (BlockParametersNode | NumberedParametersNode | ItParametersNode)? parameters, (StatementsNode | BeginNode)? body) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Symbol] locals, Location operator_loc, Location opening_loc, Location closing_loc, (BlockParametersNode | NumberedParametersNode | ItParametersNode)? parameters, (StatementsNode | BeginNode)? body) -> void # See Node.accept. # -- @@ -13001,18 +12524,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> LambdaNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?operator_loc: Location, ?opening_loc: Location, ?closing_loc: Location, ?parameters: (BlockParametersNode | NumberedParametersNode | ItParametersNode)?, ?body: (StatementsNode | BeginNode)?) -> LambdaNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?operator_loc: Location, ?opening_loc: Location, ?closing_loc: Location, ?parameters: (BlockParametersNode | NumberedParametersNode | ItParametersNode)?, ?body: (StatementsNode | BeginNode)?) -> LambdaNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?locals: Array[Symbol], ?operator_loc: Location, ?opening_loc: Location, ?closing_loc: Location, ?parameters: (BlockParametersNode | NumberedParametersNode | ItParametersNode)?, ?body: (StatementsNode | BeginNode)?) -> LambdaNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?locals: Array[Symbol], ?operator_loc: Location, ?opening_loc: Location, ?closing_loc: Location, ?parameters: (BlockParametersNode | NumberedParametersNode | ItParametersNode)?, ?body: (StatementsNode | BeginNode)?) -> LambdaNode alias deconstruct child_nodes @@ -13149,8 +12667,8 @@ module Prism # Initialize a new LocalVariableAndWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location name_loc, Location operator_loc, Prism::node value, Symbol name, Integer depth) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location name_loc, Location operator_loc, Prism::node value, Symbol name, Integer depth) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location name_loc, Location operator_loc, Prism::node value, Symbol name, Integer depth) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location name_loc, Location operator_loc, Prism::node value, Symbol name, Integer depth) -> void # See Node.accept. # -- @@ -13174,18 +12692,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> LocalVariableAndWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?depth: Integer) -> LocalVariableAndWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?depth: Integer) -> LocalVariableAndWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?depth: Integer) -> LocalVariableAndWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?depth: Integer) -> LocalVariableAndWriteNode alias deconstruct child_nodes @@ -13292,8 +12805,8 @@ module Prism # Initialize a new LocalVariableOperatorWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol name, Symbol binary_operator, Integer depth) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol name, Symbol binary_operator, Integer depth) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol name, Symbol binary_operator, Integer depth) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol name, Symbol binary_operator, Integer depth) -> void # See Node.accept. # -- @@ -13317,18 +12830,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> LocalVariableOperatorWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?binary_operator: Symbol, ?depth: Integer) -> LocalVariableOperatorWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?binary_operator: Symbol, ?depth: Integer) -> LocalVariableOperatorWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?binary_operator: Symbol, ?depth: Integer) -> LocalVariableOperatorWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?binary_operator: Symbol, ?depth: Integer) -> LocalVariableOperatorWriteNode alias deconstruct child_nodes @@ -13433,8 +12941,8 @@ module Prism # Initialize a new LocalVariableOrWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location name_loc, Location operator_loc, Prism::node value, Symbol name, Integer depth) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location name_loc, Location operator_loc, Prism::node value, Symbol name, Integer depth) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location name_loc, Location operator_loc, Prism::node value, Symbol name, Integer depth) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location name_loc, Location operator_loc, Prism::node value, Symbol name, Integer depth) -> void # See Node.accept. # -- @@ -13458,18 +12966,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> LocalVariableOrWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?depth: Integer) -> LocalVariableOrWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?depth: Integer) -> LocalVariableOrWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?depth: Integer) -> LocalVariableOrWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?depth: Integer) -> LocalVariableOrWriteNode alias deconstruct child_nodes @@ -13562,14 +13065,14 @@ module Prism # foo # ^^^ class LocalVariableReadNode < Node - @depth: Integer - @name: Symbol + @depth: Integer + # Initialize a new LocalVariableReadNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Integer depth) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Integer depth) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Integer depth) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Integer depth) -> void # See Node.accept. # -- @@ -13593,18 +13096,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> LocalVariableReadNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer) -> LocalVariableReadNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer) -> LocalVariableReadNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?depth: Integer) -> LocalVariableReadNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?depth: Integer) -> LocalVariableReadNode alias deconstruct child_nodes @@ -13666,14 +13164,14 @@ module Prism # foo => baz # ^^^ class LocalVariableTargetNode < Node - @depth: Integer - @name: Symbol + @depth: Integer + # Initialize a new LocalVariableTargetNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Integer depth) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Integer depth) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Integer depth) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Integer depth) -> void # See Node.accept. # -- @@ -13697,18 +13195,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> LocalVariableTargetNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer) -> LocalVariableTargetNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer) -> LocalVariableTargetNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?depth: Integer) -> LocalVariableTargetNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?depth: Integer) -> LocalVariableTargetNode alias deconstruct child_nodes @@ -13765,8 +13258,8 @@ module Prism # Initialize a new LocalVariableWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Integer depth, Location name_loc, Prism::node value, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Integer depth, Location name_loc, Prism::node value, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Integer depth, Location name_loc, Prism::node value, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Integer depth, Location name_loc, Prism::node value, Location operator_loc) -> void # See Node.accept. # -- @@ -13790,18 +13283,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> LocalVariableWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> LocalVariableWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> LocalVariableWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?depth: Integer, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> LocalVariableWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?depth: Integer, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> LocalVariableWriteNode alias deconstruct child_nodes @@ -13930,8 +13418,8 @@ module Prism # Initialize a new MatchLastLineNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location opening_loc, Location content_loc, Location closing_loc, String unescaped) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location opening_loc, Location content_loc, Location closing_loc, String unescaped) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location opening_loc, Location content_loc, Location closing_loc, String unescaped) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location opening_loc, Location content_loc, Location closing_loc, String unescaped) -> void # See Node.accept. # -- @@ -13955,18 +13443,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> MatchLastLineNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> MatchLastLineNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> MatchLastLineNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> MatchLastLineNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> MatchLastLineNode alias deconstruct child_nodes @@ -14149,8 +13632,8 @@ module Prism # Initialize a new MatchPredicateNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node value, Prism::node pattern, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node value, Prism::node pattern, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node value, Prism::node pattern, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node value, Prism::node pattern, Location operator_loc) -> void # See Node.accept. # -- @@ -14174,18 +13657,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> MatchPredicateNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node, ?pattern: Prism::node, ?operator_loc: Location) -> MatchPredicateNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node, ?pattern: Prism::node, ?operator_loc: Location) -> MatchPredicateNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?value: Prism::node, ?pattern: Prism::node, ?operator_loc: Location) -> MatchPredicateNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?value: Prism::node, ?pattern: Prism::node, ?operator_loc: Location) -> MatchPredicateNode alias deconstruct child_nodes @@ -14262,8 +13740,8 @@ module Prism # Initialize a new MatchRequiredNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node value, Prism::node pattern, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node value, Prism::node pattern, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node value, Prism::node pattern, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node value, Prism::node pattern, Location operator_loc) -> void # See Node.accept. # -- @@ -14287,18 +13765,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> MatchRequiredNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node, ?pattern: Prism::node, ?operator_loc: Location) -> MatchRequiredNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node, ?pattern: Prism::node, ?operator_loc: Location) -> MatchRequiredNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?value: Prism::node, ?pattern: Prism::node, ?operator_loc: Location) -> MatchRequiredNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?value: Prism::node, ?pattern: Prism::node, ?operator_loc: Location) -> MatchRequiredNode alias deconstruct child_nodes @@ -14415,14 +13888,14 @@ module Prism # /(?bar)/ =~ baz # ^^^^^^^^^^^^^^^^^^^^ class MatchWriteNode < Node - @targets: Array[LocalVariableTargetNode] - @call: CallNode + @targets: Array[LocalVariableTargetNode] + # Initialize a new MatchWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, CallNode call, Array[LocalVariableTargetNode] targets) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, CallNode call, Array[LocalVariableTargetNode] targets) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, CallNode call, Array[LocalVariableTargetNode] targets) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, CallNode call, Array[LocalVariableTargetNode] targets) -> void # See Node.accept. # -- @@ -14446,18 +13919,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> MatchWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?call: CallNode, ?targets: Array[LocalVariableTargetNode]) -> MatchWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?call: CallNode, ?targets: Array[LocalVariableTargetNode]) -> MatchWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?call: CallNode, ?targets: Array[LocalVariableTargetNode]) -> MatchWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?call: CallNode, ?targets: Array[LocalVariableTargetNode]) -> MatchWriteNode alias deconstruct child_nodes @@ -14516,8 +13984,8 @@ module Prism # Initialize a new ModuleNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Array[Symbol] locals, Location module_keyword_loc, (ConstantReadNode | ConstantPathNode) constant_path, (StatementsNode | BeginNode)? body, Location end_keyword_loc, Symbol name) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Array[Symbol] locals, Location module_keyword_loc, ConstantReadNode | ConstantPathNode constant_path, (StatementsNode | BeginNode)? body, Location end_keyword_loc, Symbol name) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Symbol] locals, Location module_keyword_loc, (ConstantReadNode | ConstantPathNode) constant_path, (StatementsNode | BeginNode)? body, Location end_keyword_loc, Symbol name) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Symbol] locals, Location module_keyword_loc, ConstantReadNode | ConstantPathNode constant_path, (StatementsNode | BeginNode)? body, Location end_keyword_loc, Symbol name) -> void # See Node.accept. # -- @@ -14541,18 +14009,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ModuleNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?module_keyword_loc: Location, ?constant_path: (ConstantReadNode | ConstantPathNode), ?body: (StatementsNode | BeginNode)?, ?end_keyword_loc: Location, ?name: Symbol) -> ModuleNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?module_keyword_loc: Location, ?constant_path: ConstantReadNode | ConstantPathNode, ?body: (StatementsNode | BeginNode)?, ?end_keyword_loc: Location, ?name: Symbol) -> ModuleNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?locals: Array[Symbol], ?module_keyword_loc: Location, ?constant_path: (ConstantReadNode | ConstantPathNode), ?body: (StatementsNode | BeginNode)?, ?end_keyword_loc: Location, ?name: Symbol) -> ModuleNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?locals: Array[Symbol], ?module_keyword_loc: Location, ?constant_path: ConstantReadNode | ConstantPathNode, ?body: (StatementsNode | BeginNode)?, ?end_keyword_loc: Location, ?name: Symbol) -> ModuleNode alias deconstruct child_nodes @@ -14678,8 +14141,8 @@ module Prism # Initialize a new MultiTargetNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode] lefts, (ImplicitRestNode | SplatNode)? rest, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode] rights, Location? lparen_loc, Location? rparen_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode] lefts, (ImplicitRestNode | SplatNode)? rest, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode] rights, Location? lparen_loc, Location? rparen_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode] lefts, (ImplicitRestNode | SplatNode)? rest, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode] rights, Location? lparen_loc, Location? rparen_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode] lefts, (ImplicitRestNode | SplatNode)? rest, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode] rights, Location? lparen_loc, Location? rparen_loc) -> void # See Node.accept. # -- @@ -14703,18 +14166,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> MultiTargetNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode], ?rest: (ImplicitRestNode | SplatNode)?, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode], ?lparen_loc: Location?, ?rparen_loc: Location?) -> MultiTargetNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode], ?rest: (ImplicitRestNode | SplatNode)?, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode], ?lparen_loc: Location?, ?rparen_loc: Location?) -> MultiTargetNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode], ?rest: (ImplicitRestNode | SplatNode)?, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode], ?lparen_loc: Location?, ?rparen_loc: Location?) -> MultiTargetNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode], ?rest: (ImplicitRestNode | SplatNode)?, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode], ?lparen_loc: Location?, ?rparen_loc: Location?) -> MultiTargetNode alias deconstruct child_nodes @@ -14861,8 +14319,8 @@ module Prism # Initialize a new MultiWriteNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode] lefts, (ImplicitRestNode | SplatNode)? rest, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode] rights, Location? lparen_loc, Location? rparen_loc, Location operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode] lefts, (ImplicitRestNode | SplatNode)? rest, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode] rights, Location? lparen_loc, Location? rparen_loc, Location operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode] lefts, (ImplicitRestNode | SplatNode)? rest, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode] rights, Location? lparen_loc, Location? rparen_loc, Location operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode] lefts, (ImplicitRestNode | SplatNode)? rest, Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode] rights, Location? lparen_loc, Location? rparen_loc, Location operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -14886,18 +14344,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> MultiWriteNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], ?rest: (ImplicitRestNode | SplatNode)?, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], ?lparen_loc: Location?, ?rparen_loc: Location?, ?operator_loc: Location, ?value: Prism::node) -> MultiWriteNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], ?rest: (ImplicitRestNode | SplatNode)?, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], ?lparen_loc: Location?, ?rparen_loc: Location?, ?operator_loc: Location, ?value: Prism::node) -> MultiWriteNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], ?rest: (ImplicitRestNode | SplatNode)?, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], ?lparen_loc: Location?, ?rparen_loc: Location?, ?operator_loc: Location, ?value: Prism::node) -> MultiWriteNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], ?rest: (ImplicitRestNode | SplatNode)?, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], ?lparen_loc: Location?, ?rparen_loc: Location?, ?operator_loc: Location, ?value: Prism::node) -> MultiWriteNode alias deconstruct child_nodes @@ -15072,8 +14525,8 @@ module Prism # Initialize a new NextNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ArgumentsNode? arguments, Location keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, ArgumentsNode? arguments, Location keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ArgumentsNode? arguments, Location keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ArgumentsNode? arguments, Location keyword_loc) -> void # See Node.accept. # -- @@ -15097,18 +14550,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> NextNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?arguments: ArgumentsNode?, ?keyword_loc: Location) -> NextNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?arguments: ArgumentsNode?, ?keyword_loc: Location) -> NextNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?arguments: ArgumentsNode?, ?keyword_loc: Location) -> NextNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?arguments: ArgumentsNode?, ?keyword_loc: Location) -> NextNode alias deconstruct child_nodes @@ -15171,8 +14619,8 @@ module Prism class NilNode < Node # Initialize a new NilNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments) -> void # See Node.accept. # -- @@ -15196,18 +14644,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> NilNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ) -> NilNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> NilNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ) -> NilNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?) -> NilNode alias deconstruct child_nodes @@ -15243,8 +14686,8 @@ module Prism # Initialize a new NoBlockParameterNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location operator_loc, Location keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location operator_loc, Location keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location operator_loc, Location keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location operator_loc, Location keyword_loc) -> void # See Node.accept. # -- @@ -15268,18 +14711,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> NoBlockParameterNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?keyword_loc: Location) -> NoBlockParameterNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?keyword_loc: Location) -> NoBlockParameterNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?operator_loc: Location, ?keyword_loc: Location) -> NoBlockParameterNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?operator_loc: Location, ?keyword_loc: Location) -> NoBlockParameterNode alias deconstruct child_nodes @@ -15363,8 +14801,8 @@ module Prism # Initialize a new NoKeywordsParameterNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location operator_loc, Location keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location operator_loc, Location keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location operator_loc, Location keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location operator_loc, Location keyword_loc) -> void # See Node.accept. # -- @@ -15388,18 +14826,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> NoKeywordsParameterNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?keyword_loc: Location) -> NoKeywordsParameterNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?keyword_loc: Location) -> NoKeywordsParameterNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?operator_loc: Location, ?keyword_loc: Location) -> NoKeywordsParameterNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?operator_loc: Location, ?keyword_loc: Location) -> NoKeywordsParameterNode alias deconstruct child_nodes @@ -15480,8 +14913,8 @@ module Prism # Initialize a new NumberedParametersNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Integer maximum) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Integer maximum) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Integer maximum) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Integer maximum) -> void # See Node.accept. # -- @@ -15505,18 +14938,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> NumberedParametersNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?maximum: Integer) -> NumberedParametersNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?maximum: Integer) -> NumberedParametersNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?maximum: Integer) -> NumberedParametersNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?maximum: Integer) -> NumberedParametersNode alias deconstruct child_nodes @@ -15557,8 +14985,8 @@ module Prism # Initialize a new NumberedReferenceReadNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Integer number) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Integer number) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Integer number) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Integer number) -> void # See Node.accept. # -- @@ -15582,18 +15010,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> NumberedReferenceReadNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?number: Integer) -> NumberedReferenceReadNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?number: Integer) -> NumberedReferenceReadNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?number: Integer) -> NumberedReferenceReadNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?number: Integer) -> NumberedReferenceReadNode alias deconstruct child_nodes @@ -15645,8 +15068,8 @@ module Prism # Initialize a new OptionalKeywordParameterNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Prism::node value) -> void # See Node.accept. # -- @@ -15670,18 +15093,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> OptionalKeywordParameterNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node) -> OptionalKeywordParameterNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node) -> OptionalKeywordParameterNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?value: Prism::node) -> OptionalKeywordParameterNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?value: Prism::node) -> OptionalKeywordParameterNode alias deconstruct child_nodes @@ -15759,8 +15177,8 @@ module Prism # Initialize a new OptionalParameterNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc, Location operator_loc, Prism::node value) -> void # See Node.accept. # -- @@ -15784,18 +15202,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> OptionalParameterNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> OptionalParameterNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> OptionalParameterNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> OptionalParameterNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> OptionalParameterNode alias deconstruct child_nodes @@ -15894,8 +15307,8 @@ module Prism # Initialize a new OrNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node left, Prism::node right, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node left, Prism::node right, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node left, Prism::node right, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node left, Prism::node right, Location operator_loc) -> void # See Node.accept. # -- @@ -15919,18 +15332,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> OrNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> OrNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> OrNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> OrNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> OrNode alias deconstruct child_nodes @@ -16031,8 +15439,8 @@ module Prism # Initialize a new ParametersNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Array[RequiredParameterNode | MultiTargetNode] requireds, Array[OptionalParameterNode] optionals, (RestParameterNode | ImplicitRestNode)? rest, Array[RequiredParameterNode | MultiTargetNode] posts, Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode] keywords, (KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode)? keyword_rest, (BlockParameterNode | NoBlockParameterNode)? block) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Array[RequiredParameterNode | MultiTargetNode] requireds, Array[OptionalParameterNode] optionals, (RestParameterNode | ImplicitRestNode)? rest, Array[RequiredParameterNode | MultiTargetNode] posts, Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode] keywords, (KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode)? keyword_rest, (BlockParameterNode | NoBlockParameterNode)? block) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[RequiredParameterNode | MultiTargetNode] requireds, Array[OptionalParameterNode] optionals, (RestParameterNode | ImplicitRestNode)? rest, Array[RequiredParameterNode | MultiTargetNode] posts, Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode] keywords, (KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode)? keyword_rest, (BlockParameterNode | NoBlockParameterNode)? block) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[RequiredParameterNode | MultiTargetNode] requireds, Array[OptionalParameterNode] optionals, (RestParameterNode | ImplicitRestNode)? rest, Array[RequiredParameterNode | MultiTargetNode] posts, Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode] keywords, (KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode)? keyword_rest, (BlockParameterNode | NoBlockParameterNode)? block) -> void # See Node.accept. # -- @@ -16056,18 +15464,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ParametersNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?requireds: Array[RequiredParameterNode | MultiTargetNode], ?optionals: Array[OptionalParameterNode], ?rest: (RestParameterNode | ImplicitRestNode)?, ?posts: Array[RequiredParameterNode | MultiTargetNode], ?keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode], ?keyword_rest: (KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode)?, ?block: (BlockParameterNode | NoBlockParameterNode)?) -> ParametersNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?requireds: Array[RequiredParameterNode | MultiTargetNode], ?optionals: Array[OptionalParameterNode], ?rest: (RestParameterNode | ImplicitRestNode)?, ?posts: Array[RequiredParameterNode | MultiTargetNode], ?keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode], ?keyword_rest: (KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode)?, ?block: (BlockParameterNode | NoBlockParameterNode)?) -> ParametersNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?requireds: Array[RequiredParameterNode | MultiTargetNode], ?optionals: Array[OptionalParameterNode], ?rest: (RestParameterNode | ImplicitRestNode)?, ?posts: Array[RequiredParameterNode | MultiTargetNode], ?keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode], ?keyword_rest: (KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode)?, ?block: (BlockParameterNode | NoBlockParameterNode)?) -> ParametersNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?requireds: Array[RequiredParameterNode | MultiTargetNode], ?optionals: Array[OptionalParameterNode], ?rest: (RestParameterNode | ImplicitRestNode)?, ?posts: Array[RequiredParameterNode | MultiTargetNode], ?keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode], ?keyword_rest: (KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode)?, ?block: (BlockParameterNode | NoBlockParameterNode)?) -> ParametersNode alias deconstruct child_nodes @@ -16160,8 +15563,8 @@ module Prism # Initialize a new ParenthesesNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node? body, Location opening_loc, Location closing_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node? body, Location opening_loc, Location closing_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? body, Location opening_loc, Location closing_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? body, Location opening_loc, Location closing_loc) -> void # See Node.accept. # -- @@ -16185,18 +15588,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ParenthesesNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?body: Prism::node?, ?opening_loc: Location, ?closing_loc: Location) -> ParenthesesNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?body: Prism::node?, ?opening_loc: Location, ?closing_loc: Location) -> ParenthesesNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?body: Prism::node?, ?opening_loc: Location, ?closing_loc: Location) -> ParenthesesNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?body: Prism::node?, ?opening_loc: Location, ?closing_loc: Location) -> ParenthesesNode alias deconstruct child_nodes @@ -16297,8 +15695,8 @@ module Prism # Initialize a new PinnedExpressionNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node expression, Location operator_loc, Location lparen_loc, Location rparen_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node expression, Location operator_loc, Location lparen_loc, Location rparen_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node expression, Location operator_loc, Location lparen_loc, Location rparen_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node expression, Location operator_loc, Location lparen_loc, Location rparen_loc) -> void # See Node.accept. # -- @@ -16322,18 +15720,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> PinnedExpressionNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node, ?operator_loc: Location, ?lparen_loc: Location, ?rparen_loc: Location) -> PinnedExpressionNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node, ?operator_loc: Location, ?lparen_loc: Location, ?rparen_loc: Location) -> PinnedExpressionNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?expression: Prism::node, ?operator_loc: Location, ?lparen_loc: Location, ?rparen_loc: Location) -> PinnedExpressionNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?expression: Prism::node, ?operator_loc: Location, ?lparen_loc: Location, ?rparen_loc: Location) -> PinnedExpressionNode alias deconstruct child_nodes @@ -16460,8 +15853,8 @@ module Prism # Initialize a new PinnedVariableNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, (LocalVariableReadNode | InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | ItLocalVariableReadNode) variable, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, LocalVariableReadNode | InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | ItLocalVariableReadNode variable, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, (LocalVariableReadNode | InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | ItLocalVariableReadNode) variable, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, LocalVariableReadNode | InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | ItLocalVariableReadNode variable, Location operator_loc) -> void # See Node.accept. # -- @@ -16485,18 +15878,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> PinnedVariableNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?variable: (LocalVariableReadNode | InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | ItLocalVariableReadNode), ?operator_loc: Location) -> PinnedVariableNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?variable: LocalVariableReadNode | InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | ItLocalVariableReadNode, ?operator_loc: Location) -> PinnedVariableNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?variable: (LocalVariableReadNode | InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | ItLocalVariableReadNode), ?operator_loc: Location) -> PinnedVariableNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?variable: LocalVariableReadNode | InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | ItLocalVariableReadNode, ?operator_loc: Location) -> PinnedVariableNode alias deconstruct child_nodes @@ -16573,8 +15961,8 @@ module Prism # Initialize a new PostExecutionNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, StatementsNode? statements, Location keyword_loc, Location opening_loc, Location closing_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, StatementsNode? statements, Location keyword_loc, Location opening_loc, Location closing_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, StatementsNode? statements, Location keyword_loc, Location opening_loc, Location closing_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, StatementsNode? statements, Location keyword_loc, Location opening_loc, Location closing_loc) -> void # See Node.accept. # -- @@ -16598,18 +15986,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> PostExecutionNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location) -> PostExecutionNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location) -> PostExecutionNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location) -> PostExecutionNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location) -> PostExecutionNode alias deconstruct child_nodes @@ -16728,8 +16111,8 @@ module Prism # Initialize a new PreExecutionNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, StatementsNode? statements, Location keyword_loc, Location opening_loc, Location closing_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, StatementsNode? statements, Location keyword_loc, Location opening_loc, Location closing_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, StatementsNode? statements, Location keyword_loc, Location opening_loc, Location closing_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, StatementsNode? statements, Location keyword_loc, Location opening_loc, Location closing_loc) -> void # See Node.accept. # -- @@ -16753,18 +16136,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> PreExecutionNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location) -> PreExecutionNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location) -> PreExecutionNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location) -> PreExecutionNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location) -> PreExecutionNode alias deconstruct child_nodes @@ -16870,14 +16248,14 @@ module Prism # The top level node of any parse tree. class ProgramNode < Node - @statements: StatementsNode - @locals: Array[Symbol] + @statements: StatementsNode + # Initialize a new ProgramNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Array[Symbol] locals, StatementsNode statements) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Array[Symbol] locals, StatementsNode statements) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Symbol] locals, StatementsNode statements) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Symbol] locals, StatementsNode statements) -> void # See Node.accept. # -- @@ -16901,18 +16279,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ProgramNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?statements: StatementsNode) -> ProgramNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?statements: StatementsNode) -> ProgramNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?locals: Array[Symbol], ?statements: StatementsNode) -> ProgramNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?locals: Array[Symbol], ?statements: StatementsNode) -> ProgramNode alias deconstruct child_nodes @@ -16968,8 +16341,8 @@ module Prism # Initialize a new RangeNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node? left, Prism::node? right, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node? left, Prism::node? right, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? left, Prism::node? right, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node? left, Prism::node? right, Location operator_loc) -> void # See Node.accept. # -- @@ -16993,18 +16366,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> RangeNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node?, ?right: Prism::node?, ?operator_loc: Location) -> RangeNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node?, ?right: Prism::node?, ?operator_loc: Location) -> RangeNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?left: Prism::node?, ?right: Prism::node?, ?operator_loc: Location) -> RangeNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?left: Prism::node?, ?right: Prism::node?, ?operator_loc: Location) -> RangeNode alias deconstruct child_nodes @@ -17098,8 +16466,8 @@ module Prism # Initialize a new RationalNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Integer numerator, Integer denominator) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Integer numerator, Integer denominator) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Integer numerator, Integer denominator) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Integer numerator, Integer denominator) -> void # See Node.accept. # -- @@ -17123,18 +16491,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> RationalNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?numerator: Integer, ?denominator: Integer) -> RationalNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?numerator: Integer, ?denominator: Integer) -> RationalNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?numerator: Integer, ?denominator: Integer) -> RationalNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?numerator: Integer, ?denominator: Integer) -> RationalNode alias deconstruct child_nodes @@ -17209,8 +16572,8 @@ module Prism class RedoNode < Node # Initialize a new RedoNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments) -> void # See Node.accept. # -- @@ -17234,18 +16597,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> RedoNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ) -> RedoNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> RedoNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ) -> RedoNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?) -> RedoNode alias deconstruct child_nodes @@ -17284,8 +16642,8 @@ module Prism # Initialize a new RegularExpressionNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location opening_loc, Location content_loc, Location closing_loc, String unescaped) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location opening_loc, Location content_loc, Location closing_loc, String unescaped) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location opening_loc, Location content_loc, Location closing_loc, String unescaped) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location opening_loc, Location content_loc, Location closing_loc, String unescaped) -> void # See Node.accept. # -- @@ -17309,18 +16667,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> RegularExpressionNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> RegularExpressionNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> RegularExpressionNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> RegularExpressionNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> RegularExpressionNode alias deconstruct child_nodes @@ -17502,8 +16855,8 @@ module Prism # Initialize a new RequiredKeywordParameterNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Location name_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name, Location name_loc) -> void # See Node.accept. # -- @@ -17527,18 +16880,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> RequiredKeywordParameterNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location) -> RequiredKeywordParameterNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location) -> RequiredKeywordParameterNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location) -> RequiredKeywordParameterNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol, ?name_loc: Location) -> RequiredKeywordParameterNode alias deconstruct child_nodes @@ -17602,8 +16950,8 @@ module Prism # Initialize a new RequiredParameterNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol name) -> void # See Node.accept. # -- @@ -17627,18 +16975,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> RequiredParameterNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> RequiredParameterNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> RequiredParameterNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> RequiredParameterNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol) -> RequiredParameterNode alias deconstruct child_nodes @@ -17689,8 +17032,8 @@ module Prism # Initialize a new RescueModifierNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Prism::node expression, Location keyword_loc, Prism::node rescue_expression) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Prism::node expression, Location keyword_loc, Prism::node rescue_expression) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node expression, Location keyword_loc, Prism::node rescue_expression) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Prism::node expression, Location keyword_loc, Prism::node rescue_expression) -> void # See Node.accept. # -- @@ -17714,18 +17057,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> RescueModifierNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node, ?keyword_loc: Location, ?rescue_expression: Prism::node) -> RescueModifierNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node, ?keyword_loc: Location, ?rescue_expression: Prism::node) -> RescueModifierNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?expression: Prism::node, ?keyword_loc: Location, ?rescue_expression: Prism::node) -> RescueModifierNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?expression: Prism::node, ?keyword_loc: Location, ?rescue_expression: Prism::node) -> RescueModifierNode alias deconstruct child_nodes @@ -17815,8 +17153,8 @@ module Prism # Initialize a new RescueNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, Array[Prism::node] exceptions, Location? operator_loc, (LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode)? reference, Location? then_keyword_loc, StatementsNode? statements, RescueNode? subsequent) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, Array[Prism::node] exceptions, Location? operator_loc, (LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode)? reference, Location? then_keyword_loc, StatementsNode? statements, RescueNode? subsequent) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, Array[Prism::node] exceptions, Location? operator_loc, (LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode)? reference, Location? then_keyword_loc, StatementsNode? statements, RescueNode? subsequent) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, Array[Prism::node] exceptions, Location? operator_loc, (LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode)? reference, Location? then_keyword_loc, StatementsNode? statements, RescueNode? subsequent) -> void # See Node.accept. # -- @@ -17840,18 +17178,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> RescueNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?exceptions: Array[Prism::node], ?operator_loc: Location?, ?reference: (LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode)?, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?subsequent: RescueNode?) -> RescueNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?exceptions: Array[Prism::node], ?operator_loc: Location?, ?reference: (LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode)?, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?subsequent: RescueNode?) -> RescueNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?exceptions: Array[Prism::node], ?operator_loc: Location?, ?reference: (LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode)?, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?subsequent: RescueNode?) -> RescueNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?exceptions: Array[Prism::node], ?operator_loc: Location?, ?reference: (LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode)?, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?subsequent: RescueNode?) -> RescueNode alias deconstruct child_nodes @@ -17993,8 +17326,8 @@ module Prism # Initialize a new RestParameterNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Symbol? name, Location? name_loc, Location operator_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Symbol? name, Location? name_loc, Location operator_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol? name, Location? name_loc, Location operator_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Symbol? name, Location? name_loc, Location operator_loc) -> void # See Node.accept. # -- @@ -18018,18 +17351,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> RestParameterNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> RestParameterNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> RestParameterNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> RestParameterNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> RestParameterNode alias deconstruct child_nodes @@ -18114,8 +17442,8 @@ module Prism class RetryNode < Node # Initialize a new RetryNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments) -> void # See Node.accept. # -- @@ -18139,18 +17467,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> RetryNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ) -> RetryNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> RetryNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ) -> RetryNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?) -> RetryNode alias deconstruct child_nodes @@ -18185,8 +17508,8 @@ module Prism # Initialize a new ReturnNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, ArgumentsNode? arguments) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, ArgumentsNode? arguments) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, ArgumentsNode? arguments) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, ArgumentsNode? arguments) -> void # See Node.accept. # -- @@ -18210,18 +17533,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ReturnNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?arguments: ArgumentsNode?) -> ReturnNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?arguments: ArgumentsNode?) -> ReturnNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?arguments: ArgumentsNode?) -> ReturnNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?arguments: ArgumentsNode?) -> ReturnNode alias deconstruct child_nodes @@ -18284,8 +17602,8 @@ module Prism class SelfNode < Node # Initialize a new SelfNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments) -> void # See Node.accept. # -- @@ -18309,18 +17627,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> SelfNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ) -> SelfNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> SelfNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ) -> SelfNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?) -> SelfNode alias deconstruct child_nodes @@ -18354,8 +17667,8 @@ module Prism # Initialize a new ShareableConstantNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, (ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode) write) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode write) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, (ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode) write) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode write) -> void # See Node.accept. # -- @@ -18379,18 +17692,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> ShareableConstantNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?write: (ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode)) -> ShareableConstantNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?write: ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode) -> ShareableConstantNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?write: (ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode)) -> ShareableConstantNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?write: ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode) -> ShareableConstantNode alias deconstruct child_nodes @@ -18459,8 +17767,8 @@ module Prism # Initialize a new SingletonClassNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Array[Symbol] locals, Location class_keyword_loc, Location operator_loc, Prism::node expression, (StatementsNode | BeginNode)? body, Location end_keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Array[Symbol] locals, Location class_keyword_loc, Location operator_loc, Prism::node expression, (StatementsNode | BeginNode)? body, Location end_keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Symbol] locals, Location class_keyword_loc, Location operator_loc, Prism::node expression, (StatementsNode | BeginNode)? body, Location end_keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Symbol] locals, Location class_keyword_loc, Location operator_loc, Prism::node expression, (StatementsNode | BeginNode)? body, Location end_keyword_loc) -> void # See Node.accept. # -- @@ -18484,18 +17792,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> SingletonClassNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?class_keyword_loc: Location, ?operator_loc: Location, ?expression: Prism::node, ?body: (StatementsNode | BeginNode)?, ?end_keyword_loc: Location) -> SingletonClassNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?class_keyword_loc: Location, ?operator_loc: Location, ?expression: Prism::node, ?body: (StatementsNode | BeginNode)?, ?end_keyword_loc: Location) -> SingletonClassNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?locals: Array[Symbol], ?class_keyword_loc: Location, ?operator_loc: Location, ?expression: Prism::node, ?body: (StatementsNode | BeginNode)?, ?end_keyword_loc: Location) -> SingletonClassNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?locals: Array[Symbol], ?class_keyword_loc: Location, ?operator_loc: Location, ?expression: Prism::node, ?body: (StatementsNode | BeginNode)?, ?end_keyword_loc: Location) -> SingletonClassNode alias deconstruct child_nodes @@ -18622,8 +17925,8 @@ module Prism class SourceEncodingNode < Node # Initialize a new SourceEncodingNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments) -> void # See Node.accept. # -- @@ -18647,18 +17950,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> SourceEncodingNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ) -> SourceEncodingNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> SourceEncodingNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ) -> SourceEncodingNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?) -> SourceEncodingNode alias deconstruct child_nodes @@ -18691,8 +17989,8 @@ module Prism # Initialize a new SourceFileNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, String filepath) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, String filepath) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, String filepath) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, String filepath) -> void # See Node.accept. # -- @@ -18716,18 +18014,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> SourceFileNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?filepath: String) -> SourceFileNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?filepath: String) -> SourceFileNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?filepath: String) -> SourceFileNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?filepath: String) -> SourceFileNode alias deconstruct child_nodes @@ -18790,8 +18083,8 @@ module Prism class SourceLineNode < Node # Initialize a new SourceLineNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments) -> void # See Node.accept. # -- @@ -18815,18 +18108,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> SourceLineNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ) -> SourceLineNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> SourceLineNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ) -> SourceLineNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?) -> SourceLineNode alias deconstruct child_nodes @@ -18861,8 +18149,8 @@ module Prism # Initialize a new SplatNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location operator_loc, Prism::node? expression) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location operator_loc, Prism::node? expression) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location operator_loc, Prism::node? expression) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location operator_loc, Prism::node? expression) -> void # See Node.accept. # -- @@ -18886,18 +18174,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> SplatNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?expression: Prism::node?) -> SplatNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?expression: Prism::node?) -> SplatNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?operator_loc: Location, ?expression: Prism::node?) -> SplatNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?operator_loc: Location, ?expression: Prism::node?) -> SplatNode alias deconstruct child_nodes @@ -18962,8 +18245,8 @@ module Prism # Initialize a new StatementsNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Array[Prism::node] body) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Array[Prism::node] body) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Prism::node] body) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[Prism::node] body) -> void # See Node.accept. # -- @@ -18987,18 +18270,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> StatementsNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?body: Array[Prism::node]) -> StatementsNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?body: Array[Prism::node]) -> StatementsNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?body: Array[Prism::node]) -> StatementsNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?body: Array[Prism::node]) -> StatementsNode alias deconstruct child_nodes @@ -19051,8 +18329,8 @@ module Prism # Initialize a new StringNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location? opening_loc, Location content_loc, Location? closing_loc, String unescaped) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location? opening_loc, Location content_loc, Location? closing_loc, String unescaped) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location? opening_loc, Location content_loc, Location? closing_loc, String unescaped) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location? opening_loc, Location content_loc, Location? closing_loc, String unescaped) -> void # See Node.accept. # -- @@ -19076,18 +18354,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> StringNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?content_loc: Location, ?closing_loc: Location?, ?unescaped: String) -> StringNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?content_loc: Location, ?closing_loc: Location?, ?unescaped: String) -> StringNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location?, ?content_loc: Location, ?closing_loc: Location?, ?unescaped: String) -> StringNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location?, ?content_loc: Location, ?closing_loc: Location?, ?unescaped: String) -> StringNode alias deconstruct child_nodes @@ -19237,8 +18510,8 @@ module Prism # Initialize a new SuperNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, Location? lparen_loc, ArgumentsNode? arguments, Location? rparen_loc, (BlockNode | BlockArgumentNode)? block) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, Location? lparen_loc, ArgumentsNode? arguments, Location? rparen_loc, (BlockNode | BlockArgumentNode)? block) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, Location? lparen_loc, ArgumentsNode? arguments, Location? rparen_loc, (BlockNode | BlockArgumentNode)? block) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, Location? lparen_loc, ArgumentsNode? arguments, Location? rparen_loc, (BlockNode | BlockArgumentNode)? block) -> void # See Node.accept. # -- @@ -19262,18 +18535,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> SuperNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?, ?block: (BlockNode | BlockArgumentNode)?) -> SuperNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?, ?block: (BlockNode | BlockArgumentNode)?) -> SuperNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?, ?block: (BlockNode | BlockArgumentNode)?) -> SuperNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?, ?block: (BlockNode | BlockArgumentNode)?) -> SuperNode alias deconstruct child_nodes @@ -19403,8 +18671,8 @@ module Prism # Initialize a new SymbolNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location? opening_loc, Location? value_loc, Location? closing_loc, String unescaped) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location? opening_loc, Location? value_loc, Location? closing_loc, String unescaped) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location? opening_loc, Location? value_loc, Location? closing_loc, String unescaped) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location? opening_loc, Location? value_loc, Location? closing_loc, String unescaped) -> void # See Node.accept. # -- @@ -19428,18 +18696,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> SymbolNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?value_loc: Location?, ?closing_loc: Location?, ?unescaped: String) -> SymbolNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?value_loc: Location?, ?closing_loc: Location?, ?unescaped: String) -> SymbolNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location?, ?value_loc: Location?, ?closing_loc: Location?, ?unescaped: String) -> SymbolNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location?, ?value_loc: Location?, ?closing_loc: Location?, ?unescaped: String) -> SymbolNode alias deconstruct child_nodes @@ -19568,8 +18831,8 @@ module Prism class TrueNode < Node # Initialize a new TrueNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, ) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, ) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments) -> void # See Node.accept. # -- @@ -19593,18 +18856,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> TrueNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ) -> TrueNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> TrueNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ) -> TrueNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?) -> TrueNode alias deconstruct child_nodes @@ -19639,8 +18897,8 @@ module Prism # Initialize a new UndefNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Array[SymbolNode | InterpolatedSymbolNode] names, Location keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Array[SymbolNode | InterpolatedSymbolNode] names, Location keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[SymbolNode | InterpolatedSymbolNode] names, Location keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Array[SymbolNode | InterpolatedSymbolNode] names, Location keyword_loc) -> void # See Node.accept. # -- @@ -19664,18 +18922,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> UndefNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?names: Array[SymbolNode | InterpolatedSymbolNode], ?keyword_loc: Location) -> UndefNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?names: Array[SymbolNode | InterpolatedSymbolNode], ?keyword_loc: Location) -> UndefNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?names: Array[SymbolNode | InterpolatedSymbolNode], ?keyword_loc: Location) -> UndefNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?names: Array[SymbolNode | InterpolatedSymbolNode], ?keyword_loc: Location) -> UndefNode alias deconstruct child_nodes @@ -19753,8 +19006,8 @@ module Prism # Initialize a new UnlessNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, Prism::node predicate, Location? then_keyword_loc, StatementsNode? statements, ElseNode? else_clause, Location? end_keyword_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, Prism::node predicate, Location? then_keyword_loc, StatementsNode? statements, ElseNode? else_clause, Location? end_keyword_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, Prism::node predicate, Location? then_keyword_loc, StatementsNode? statements, ElseNode? else_clause, Location? end_keyword_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, Prism::node predicate, Location? then_keyword_loc, StatementsNode? statements, ElseNode? else_clause, Location? end_keyword_loc) -> void # See Node.accept. # -- @@ -19778,18 +19031,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> UnlessNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?predicate: Prism::node, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?else_clause: ElseNode?, ?end_keyword_loc: Location?) -> UnlessNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?predicate: Prism::node, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?else_clause: ElseNode?, ?end_keyword_loc: Location?) -> UnlessNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?predicate: Prism::node, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?else_clause: ElseNode?, ?end_keyword_loc: Location?) -> UnlessNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?predicate: Prism::node, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?else_clause: ElseNode?, ?end_keyword_loc: Location?) -> UnlessNode alias deconstruct child_nodes @@ -19954,8 +19202,8 @@ module Prism # Initialize a new UntilNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, Location? do_keyword_loc, Location? closing_loc, Prism::node predicate, StatementsNode? statements) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, Location? do_keyword_loc, Location? closing_loc, Prism::node predicate, StatementsNode? statements) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, Location? do_keyword_loc, Location? closing_loc, Prism::node predicate, StatementsNode? statements) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, Location? do_keyword_loc, Location? closing_loc, Prism::node predicate, StatementsNode? statements) -> void # See Node.accept. # -- @@ -19979,18 +19227,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> UntilNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?do_keyword_loc: Location?, ?closing_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?) -> UntilNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?do_keyword_loc: Location?, ?closing_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?) -> UntilNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?do_keyword_loc: Location?, ?closing_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?) -> UntilNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?do_keyword_loc: Location?, ?closing_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?) -> UntilNode alias deconstruct child_nodes @@ -20125,8 +19368,8 @@ module Prism # Initialize a new WhenNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, Array[Prism::node] conditions, Location? then_keyword_loc, StatementsNode? statements) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, Array[Prism::node] conditions, Location? then_keyword_loc, StatementsNode? statements) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, Array[Prism::node] conditions, Location? then_keyword_loc, StatementsNode? statements) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, Array[Prism::node] conditions, Location? then_keyword_loc, StatementsNode? statements) -> void # See Node.accept. # -- @@ -20150,18 +19393,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> WhenNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?conditions: Array[Prism::node], ?then_keyword_loc: Location?, ?statements: StatementsNode?) -> WhenNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?conditions: Array[Prism::node], ?then_keyword_loc: Location?, ?statements: StatementsNode?) -> WhenNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?conditions: Array[Prism::node], ?then_keyword_loc: Location?, ?statements: StatementsNode?) -> WhenNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?conditions: Array[Prism::node], ?then_keyword_loc: Location?, ?statements: StatementsNode?) -> WhenNode alias deconstruct child_nodes @@ -20269,8 +19507,8 @@ module Prism # Initialize a new WhileNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, Location? do_keyword_loc, Location? closing_loc, Prism::node predicate, StatementsNode? statements) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, Location? do_keyword_loc, Location? closing_loc, Prism::node predicate, StatementsNode? statements) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, Location? do_keyword_loc, Location? closing_loc, Prism::node predicate, StatementsNode? statements) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, Location? do_keyword_loc, Location? closing_loc, Prism::node predicate, StatementsNode? statements) -> void # See Node.accept. # -- @@ -20294,18 +19532,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> WhileNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?do_keyword_loc: Location?, ?closing_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?) -> WhileNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?do_keyword_loc: Location?, ?closing_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?) -> WhileNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?do_keyword_loc: Location?, ?closing_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?) -> WhileNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?do_keyword_loc: Location?, ?closing_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?) -> WhileNode alias deconstruct child_nodes @@ -20438,8 +19671,8 @@ module Prism # Initialize a new XStringNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location opening_loc, Location content_loc, Location closing_loc, String unescaped) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location opening_loc, Location content_loc, Location closing_loc, String unescaped) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location opening_loc, Location content_loc, Location closing_loc, String unescaped) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location opening_loc, Location content_loc, Location closing_loc, String unescaped) -> void # See Node.accept. # -- @@ -20463,18 +19696,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> XStringNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> XStringNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> XStringNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> XStringNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> XStringNode alias deconstruct child_nodes @@ -20605,8 +19833,8 @@ module Prism # Initialize a new YieldNode node. # -- - # : (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, Location? lparen_loc, ArgumentsNode? arguments, Location? rparen_loc) -> void - def initialize: (Source source, Integer node_id, Location location, Integer flags, Location keyword_loc, Location? lparen_loc, ArgumentsNode? arguments, Location? rparen_loc) -> void + # : (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, Location? lparen_loc, ArgumentsNode? arguments, Location? rparen_loc) -> void + def initialize: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, Location keyword_loc, Location? lparen_loc, ArgumentsNode? arguments, Location? rparen_loc) -> void # See Node.accept. # -- @@ -20630,18 +19858,13 @@ module Prism # : () -> Array[node] def compact_child_nodes: () -> Array[node] - # See Node.comment_targets. - # -- - # : () -> Array[node | Location] - def comment_targets: () -> Array[node | Location] - # :call-seq: # copy(**fields) -> YieldNode # # Creates a copy of self with the given fields, using self as the template. # -- - # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?) -> YieldNode - def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?) -> YieldNode + # : (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?) -> YieldNode + def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, ?keyword_loc: Location, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?) -> YieldNode alias deconstruct child_nodes diff --git a/sig/generated/prism/parse_result.rbs b/sig/generated/prism/parse_result.rbs index f005f17375..1cf36ec654 100644 --- a/sig/generated/prism/parse_result.rbs +++ b/sig/generated/prism/parse_result.rbs @@ -269,44 +269,12 @@ module Prism # The length of this location in bytes. attr_reader length: Integer - @trailing_comments: Array[Comment]? - - @leading_comments: Array[Comment]? - # Create a new location object with the given source, start byte offset, and # byte length. # -- # : (Source source, Integer start_offset, Integer length) -> void def initialize: (Source source, Integer start_offset, Integer length) -> void - # These are the comments that are associated with this location that exist - # before the start of this location. - # -- - # : () -> Array[Comment] - def leading_comments: () -> Array[Comment] - - # Attach a comment to the leading comments of this location. - # -- - # : (Comment comment) -> void - def leading_comment: (Comment comment) -> void - - # These are the comments that are associated with this location that exist - # after the end of this location. - # -- - # : () -> Array[Comment] - def trailing_comments: () -> Array[Comment] - - # Attach a comment to the trailing comments of this location. - # -- - # : (Comment comment) -> void - def trailing_comment: (Comment comment) -> void - - # Returns all comments that are associated with this location (both leading - # and trailing comments). - # -- - # : () -> Array[Comment] - def comments: () -> Array[Comment] - # Create a new location object with the given options. # -- # : (?source: Source, ?start_offset: Integer, ?length: Integer) -> Location @@ -482,6 +450,24 @@ module Prism # : (Location location) -> void def initialize: (Location location) -> void + # Returns a symbol representing the type of this node, for compatibility + # when comments are interleaved into node arrays. + # -- + # : () -> Symbol + def type: () -> Symbol + + # Returns the byte offset from the beginning of the source where this + # comment starts. + # -- + # : () -> Integer + def start_offset: () -> Integer + + # Returns the byte offset from the beginning of the source where this + # comment ends. + # -- + # : () -> Integer + def end_offset: () -> Integer + # Implement the hash pattern matching interface for Comment. # -- # : (Array[Symbol]? keys) -> Hash[Symbol, untyped] @@ -721,11 +707,6 @@ module Prism # : (Array[Symbol]? keys) -> Hash[Symbol, untyped] def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped] - # Attach the list of comments to their respective locations in the tree. - # -- - # : () -> void - def attach_comments!: () -> void - # Walk the tree and mark nodes that are on a new line, loosely emulating # the behavior of CRuby's `:line` tracepoint event. # -- diff --git a/sig/generated/prism/parse_result/comments.rbs b/sig/generated/prism/parse_result/comments.rbs deleted file mode 100644 index 1dc7ae974b..0000000000 --- a/sig/generated/prism/parse_result/comments.rbs +++ /dev/null @@ -1,108 +0,0 @@ -# Generated from lib/prism/parse_result/comments.rb with RBS::Inline - -module Prism - class ParseResult < Result - # When we've parsed the source, we have both the syntax tree and the list of - # comments that we found in the source. This class is responsible for - # walking the tree and finding the nearest location to attach each comment. - # - # It does this by first finding the nearest locations to each comment. - # Locations can either come from nodes directly or from location fields on - # nodes. For example, a `ClassNode` has an overall location encompassing the - # entire class, but it also has a location for the `class` keyword. - # - # Once the nearest locations are found, it determines which one to attach - # to. If it's a trailing comment (a comment on the same line as other source - # code), it will favor attaching to the nearest location that occurs before - # the comment. Otherwise it will favor attaching to the nearest location - # that is after the comment. - class Comments - # An internal interface for a target that comments can be attached - # to. This is either going to be a NodeTarget or a CommentTarget. - interface _CommentTarget - def start_offset: () -> Integer - - def end_offset: () -> Integer - - def encloses?: (Comment) -> bool - - def leading_comment: (Comment) -> void - - def trailing_comment: (Comment) -> void - end - - # A target for attaching comments that is based on a specific node's - # location. - class NodeTarget - # :nodoc: - attr_reader node: node - - # : (node node) -> void - def initialize: (node node) -> void - - # : () -> Integer - def start_offset: () -> Integer - - # : () -> Integer - def end_offset: () -> Integer - - # : (Comment comment) -> bool - def encloses?: (Comment comment) -> bool - - # : (Comment comment) -> void - def leading_comment: (Comment comment) -> void - - # : (Comment comment) -> void - def trailing_comment: (Comment comment) -> void - end - - # A target for attaching comments that is based on a location field on a - # node. For example, the `end` token of a ClassNode. - class LocationTarget - # :nodoc: - attr_reader location: Location - - # : (Location location) -> void - def initialize: (Location location) -> void - - # : () -> Integer - def start_offset: () -> Integer - - # : () -> Integer - def end_offset: () -> Integer - - # : (Comment comment) -> bool - def encloses?: (Comment comment) -> bool - - # : (Comment comment) -> void - def leading_comment: (Comment comment) -> void - - # : (Comment comment) -> void - def trailing_comment: (Comment comment) -> void - end - - # The parse result that we are attaching comments to. - attr_reader parse_result: ParseResult - - # Create a new Comments object that will attach comments to the given - # parse result. - # -- - # : (ParseResult parse_result) -> void - def initialize: (ParseResult parse_result) -> void - - # Attach the comments to their respective locations in the tree by - # mutating the parse result. - # -- - # : () -> void - def attach!: () -> void - - private - - # Responsible for finding the nearest targets to the given comment within - # the context of the given encapsulating node. - # -- - # : (node node, Comment comment) -> [_CommentTarget?, _CommentTarget?, _CommentTarget?] - def nearest_targets: (node node, Comment comment) -> [ _CommentTarget?, _CommentTarget?, _CommentTarget? ] - end - end -end diff --git a/sig/generated/prism/relocation.rbs b/sig/generated/prism/relocation.rbs index 35238609ca..27838d79f4 100644 --- a/sig/generated/prism/relocation.rbs +++ b/sig/generated/prism/relocation.rbs @@ -43,10 +43,6 @@ module Prism def cached_start_code_units_column: (_CodeUnitsCache cache) -> Integer def cached_end_code_units_column: (_CodeUnitsCache cache) -> Integer - - def leading_comments: () -> Array[Comment] - - def trailing_comments: () -> Array[Comment] end interface _Field @@ -150,21 +146,6 @@ module Prism # : () -> Integer def end_code_units_column: () -> Integer - # Fetch the leading comments of the value. - # -- - # : () -> Array[CommentsField::Comment] - def leading_comments: () -> Array[CommentsField::Comment] - - # Fetch the trailing comments of the value. - # -- - # : () -> Array[CommentsField::Comment] - def trailing_comments: () -> Array[CommentsField::Comment] - - # Fetch the leading and trailing comments of the value. - # -- - # : () -> Array[CommentsField::Comment] - def comments: () -> Array[CommentsField::Comment] - # Reify the values on this entry with the given values. This is an # internal-only API that is called from the repository when it is time to # reify the values. @@ -339,43 +320,6 @@ module Prism def cache: () -> _CodeUnitsCache end - # An abstract field used as the parent class of the two comments fields. - class CommentsField - # An object that represents a slice of a comment. - class Comment - # The slice of the comment. - attr_reader slice: String - - # Initialize a new comment with the given slice. - # - # : (String slice) -> void - def initialize: (String slice) -> void - end - - private - - # Create comment objects from the given values. - # -- - # : (entry_value values) -> Array[Comment] - def comments: (entry_value values) -> Array[Comment] - end - - # A field representing the leading comments. - class LeadingCommentsField < CommentsField - # Fetches the leading comments of a value. - # -- - # : (_Value value) -> entry_values - def fields: (_Value value) -> entry_values - end - - # A field representing the trailing comments. - class TrailingCommentsField < CommentsField - # Fetches the trailing comments of a value. - # -- - # : (_Value value) -> entry_values - def fields: (_Value value) -> entry_values - end - # A repository is a configured collection of fields and a set of entries # that knows how to reparse a source and reify the values. class Repository @@ -448,24 +392,6 @@ module Prism # : (Encoding encoding) -> self def code_unit_columns: (Encoding encoding) -> self - # Configure the leading comments field for this repository and return - # self. - # -- - # : () -> self - def leading_comments: () -> self - - # Configure the trailing comments field for this repository and return - # self. - # -- - # : () -> self - def trailing_comments: () -> self - - # Configure both the leading and trailing comment fields for this - # repository and return self. - # -- - # : () -> self - def comments: () -> self - # This method is called from nodes and locations when they want to enter # themselves into the repository. It it internal-only and meant to be # called from the #save* APIs. diff --git a/sig/generated/prism/serialize.rbs b/sig/generated/prism/serialize.rbs index a83dae70d8..1e2da08762 100644 --- a/sig/generated/prism/serialize.rbs +++ b/sig/generated/prism/serialize.rbs @@ -82,8 +82,10 @@ module Prism # : () -> bool def eof?: () -> bool - # : (ConstantPool constant_pool) -> void - def load_constant_pool: (ConstantPool constant_pool) -> void + # : (Array[Comment] comments, bool freeze) -> Hash[Integer, Comments::Base]? + def load_attached_comments: (Array[Comment] comments, bool freeze) -> Hash[Integer, Comments::Base]? + + def load_constant_pool: (untyped constant_pool) -> untyped # : () -> void def load_header: () -> void @@ -138,8 +140,8 @@ module Prism # : () -> Integer def load_uint32: () -> Integer - # : (ConstantPool constant_pool, Encoding encoding, bool freeze) -> node? - def load_optional_node: (ConstantPool constant_pool, Encoding encoding, bool freeze) -> node? + # : (ConstantPool constant_pool, Encoding encoding, bool freeze, ?Hash[Integer, Comments::Base]? comments) -> (node | Comment)? + def load_optional_node: (ConstantPool constant_pool, Encoding encoding, bool freeze, ?Hash[Integer, Comments::Base]? comments) -> (node | Comment)? # : (Encoding encoding) -> String def load_string: (Encoding encoding) -> String @@ -154,6 +156,8 @@ module Prism # : (bool freeze) -> Location def load_location: (bool freeze) -> Location + def load_location_object_from_packed: (untyped packed) -> untyped + # Load an optional location object from the serialized data if it is # present. Note that we are lying about the signature a bit here, because # we sometimes load it as a packed integer instead of an object. @@ -170,8 +174,8 @@ module Prism # : (ConstantPool constant_pool, Encoding encoding) -> Symbol? def load_optional_constant: (ConstantPool constant_pool, Encoding encoding) -> Symbol? - # : (ConstantPool constant_pool, Encoding encoding, bool freeze) -> node - def load_node: (ConstantPool constant_pool, Encoding encoding, bool freeze) -> node + # : (ConstantPool constant_pool, Encoding encoding, bool freeze, Hash[Integer, Comments::Base]? comments) -> (node | Comment) + def load_node: (ConstantPool constant_pool, Encoding encoding, bool freeze, Hash[Integer, Comments::Base]? comments) -> (node | Comment) @load_node_lambdas: Array[Proc] diff --git a/src/comments.c b/src/comments.c new file mode 100644 index 0000000000..138ed38945 --- /dev/null +++ b/src/comments.c @@ -0,0 +1,2590 @@ +#include "prism/internal/comments.h" + +#include "prism/compiler/align.h" +#include "prism/internal/allocator.h" +#include "prism/internal/parser.h" +#include "prism/internal/node.h" +#include "prism/internal/line_offset_list.h" + +#include +#include +#include +#include + +/* The context passed around while visiting nodes to attach comments. */ +typedef struct { + pm_parser_t *parser; + pm_comments_map_t *map; + const pm_comment_t **comments; + int32_t min_line; + int32_t max_line; +} pm_comments_context_t; + +#define PM_COMMENTS_UPCAST(value_) ((pm_comments_t *) (value_)) +#define PM_COMMENTS_ALLOC(ctx_, type_) ((type_ *) pm_arena_zalloc((ctx_)->parser->arena, sizeof(type_), PRISM_ALIGNOF(type_))) + +/* Create a CommentNode from a pm_comment_t. */ +static pm_node_t * +pm_comment_node_new(pm_comments_context_t *ctx, const pm_comment_t *comment) { + pm_node_t *node = pm_arena_alloc(ctx->parser->arena, sizeof(pm_node_t), PRISM_ALIGNOF(pm_node_t)); + *node = (pm_node_t) { + .type = PM_COMMENT_NODE, + .flags = (comment->type == PM_COMMENT_EMBDOC) ? PM_COMMENT_NODE_FLAG_EMBDOC : 0, + .node_id = (uint32_t) -1, + .location = comment->location + }; + return node; +} + +/******************************************************************************/ +/* Functions that create comments objects. */ +/******************************************************************************/ + +static pm_alias_method_comments_t * +pm_alias_method_comments_new(pm_comments_context_t *ctx, pm_comments_list_t *gap_comments) { + pm_alias_method_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_alias_method_comments_t); + comments->base.type = PM_COMMENTS_ALIAS_METHOD; + comments->gap_comments = *gap_comments; + return comments; +} + +static pm_binary_comments_t * +pm_binary_comments_new(pm_comments_context_t *ctx, const pm_comment_t *operator_comment, const pm_comments_list_t *gap_comments) { + pm_binary_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_binary_comments_t); + comments->base.type = PM_COMMENTS_BINARY; + comments->operator_comment = operator_comment; + comments->gap_comments = *gap_comments; + return comments; +} + +static pm_body_comments_t * +pm_body_comments_new(pm_comments_context_t *ctx, const pm_comment_t *opening_comment, const pm_comment_t *trailing_comment) { + pm_body_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_body_comments_t); + comments->base.type = PM_COMMENTS_BODY; + comments->opening_comment = opening_comment; + comments->trailing_comment = trailing_comment; + return comments; +} + +static pm_call_comments_t * +pm_call_comments_new(pm_comments_context_t *ctx, const pm_comment_t *trailing_comment, const pm_comments_list_t *receiver_gap, const pm_comment_t *operator_comment, const pm_comments_list_t *message_gap) { + pm_call_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_call_comments_t); + comments->base.type = PM_COMMENTS_CALL; + comments->trailing_comment = trailing_comment; + comments->receiver_gap_comments = *receiver_gap; + comments->operator_comment = operator_comment; + comments->message_gap_comments = *message_gap; + return comments; +} + +static pm_call_write_comments_t * +pm_call_write_comments_new(pm_comments_context_t *ctx, const pm_comment_t *call_operator_comment, const pm_comments_list_t *call_gap, const pm_comment_t *operator_comment, const pm_comments_list_t *operator_gap) { + pm_call_write_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_call_write_comments_t); + comments->base.type = PM_COMMENTS_CALL_WRITE; + comments->call_operator_comment = call_operator_comment; + comments->call_gap_comments = *call_gap; + comments->operator_comment = operator_comment; + comments->operator_gap_comments = *operator_gap; + return comments; +} + +static pm_case_comments_t * +pm_case_comments_new(pm_comments_context_t *ctx, const pm_comment_t *keyword_comment, const pm_comments_list_t *keyword_gap, const pm_comments_list_t *predicate_gap, const pm_comment_t *trailing_comment) { + pm_case_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_case_comments_t); + comments->base.type = PM_COMMENTS_CASE; + comments->keyword_comment = keyword_comment; + comments->keyword_gap_comments = *keyword_gap; + comments->predicate_gap_comments = *predicate_gap; + comments->trailing_comment = trailing_comment; + return comments; +} + +static pm_class_comments_t * +pm_class_comments_new(pm_comments_context_t *ctx, const pm_comment_t *opening_comment, const pm_comments_list_t *keyword_gap_comments, const pm_comment_t *inheritance_operator_comment, const pm_comments_list_t *inheritance_gap_comments, const pm_comment_t *trailing_comment) { + pm_class_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_class_comments_t); + comments->base.type = PM_COMMENTS_CLASS; + comments->opening_comment = opening_comment; + comments->keyword_gap_comments = *keyword_gap_comments; + comments->inheritance_operator_comment = inheritance_operator_comment; + comments->inheritance_gap_comments = *inheritance_gap_comments; + comments->trailing_comment = trailing_comment; + return comments; +} + +static pm_clause_comments_t * +pm_clause_comments_new(pm_comments_context_t *ctx, const pm_comment_t *opening_comment) { + pm_clause_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_clause_comments_t); + comments->base.type = PM_COMMENTS_CLAUSE; + comments->opening_comment = opening_comment; + return comments; +} + +static pm_collection_comments_t * +pm_collection_comments_new(pm_comments_context_t *ctx, const pm_comment_t *opening_comment, const pm_comment_t *closing_comment) { + pm_collection_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_collection_comments_t); + comments->base.type = PM_COMMENTS_COLLECTION; + comments->opening_comment = opening_comment; + comments->closing_comment = closing_comment; + return comments; +} + +static pm_def_comments_t * +pm_def_comments_new(pm_comments_context_t *ctx, const pm_comment_t *opening_comment, const pm_comments_list_t *keyword_gap_comments, const pm_comment_t *lparen_comment, const pm_comment_t *rparen_comment, const pm_comment_t *trailing_comment) { + pm_def_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_def_comments_t); + comments->base.type = PM_COMMENTS_DEF; + comments->opening_comment = opening_comment; + comments->keyword_gap_comments = *keyword_gap_comments; + comments->lparen_comment = lparen_comment; + comments->rparen_comment = rparen_comment; + comments->trailing_comment = trailing_comment; + return comments; +} + +static pm_embedded_statements_comments_t * +pm_embedded_statements_comments_new(pm_comments_context_t *ctx, const pm_comment_t *opening_comment) { + pm_embedded_statements_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_embedded_statements_comments_t); + comments->base.type = PM_COMMENTS_EMBEDDED_STATEMENTS; + comments->opening_comment = opening_comment; + return comments; +} + +static pm_endless_def_comments_t * +pm_endless_def_comments_new(pm_comments_context_t *ctx, const pm_comment_t *opening_comment, const pm_comments_list_t *keyword_gap_comments, const pm_comment_t *lparen_comment, const pm_comment_t *rparen_comment, const pm_comment_t *operator_comment) { + pm_endless_def_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_endless_def_comments_t); + comments->base.type = PM_COMMENTS_ENDLESS_DEF; + comments->opening_comment = opening_comment; + comments->keyword_gap_comments = *keyword_gap_comments; + comments->lparen_comment = lparen_comment; + comments->rparen_comment = rparen_comment; + comments->operator_comment = operator_comment; + return comments; +} + +static pm_find_pattern_comments_t * +pm_find_pattern_comments_new(pm_comments_context_t *ctx, const pm_comment_t *opening_comment, const pm_comment_t *closing_comment, const pm_comments_list_t *pre_left_gap, const pm_comments_list_t *post_right_gap) { + pm_find_pattern_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_find_pattern_comments_t); + comments->base.type = PM_COMMENTS_FIND_PATTERN; + comments->opening_comment = opening_comment; + comments->closing_comment = closing_comment; + comments->pre_left_gap_comments = *pre_left_gap; + comments->post_right_gap_comments = *post_right_gap; + return comments; +} + +static pm_for_comments_t * +pm_for_comments_new(pm_comments_context_t *ctx, const pm_comment_t *for_comment, const pm_comment_t *in_comment, const pm_comment_t *do_comment, const pm_comment_t *trailing_comment) { + pm_for_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_for_comments_t); + comments->base.type = PM_COMMENTS_FOR; + comments->for_comment = for_comment; + comments->in_comment = in_comment; + comments->do_comment = do_comment; + comments->trailing_comment = trailing_comment; + return comments; +} + +static pm_hash_pattern_comments_t * +pm_hash_pattern_comments_new(pm_comments_context_t *ctx, const pm_comment_t *opening_comment, const pm_comment_t *closing_comment, const pm_comments_list_t *post_rest_gap) { + pm_hash_pattern_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_hash_pattern_comments_t); + comments->base.type = PM_COMMENTS_HASH_PATTERN; + comments->opening_comment = opening_comment; + comments->closing_comment = closing_comment; + comments->post_rest_gap_comments = *post_rest_gap; + return comments; +} + +static pm_keyword_call_comments_t * +pm_keyword_call_comments_new(pm_comments_context_t *ctx, const pm_comment_t *lparen_comment, const pm_comment_t *rparen_comment) { + pm_keyword_call_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_keyword_call_comments_t); + comments->base.type = PM_COMMENTS_KEYWORD_CALL; + comments->lparen_comment = lparen_comment; + comments->rparen_comment = rparen_comment; + return comments; +} + +static pm_leaf_comments_t * +pm_leaf_comments_new(pm_comments_context_t *ctx, const pm_comment_t *trailing_comment) { + pm_leaf_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_leaf_comments_t); + comments->base.type = PM_COMMENTS_LEAF; + comments->trailing_comment = trailing_comment; + return comments; +} + +static pm_logical_keyword_comments_t * +pm_logical_keyword_comments_new(pm_comments_context_t *ctx, const pm_comment_t *operator_comment, const pm_comments_list_t *left_gap, const pm_comments_list_t *right_gap) { + pm_logical_keyword_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_logical_keyword_comments_t); + comments->base.type = PM_COMMENTS_LOGICAL_KEYWORD; + comments->operator_comment = operator_comment; + comments->left_gap_comments = *left_gap; + comments->right_gap_comments = *right_gap; + return comments; +} + +static pm_module_comments_t * +pm_module_comments_new(pm_comments_context_t *ctx, const pm_comment_t *opening_comment, const pm_comments_list_t *keyword_gap, const pm_comment_t *trailing_comment) { + pm_module_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_module_comments_t); + comments->base.type = PM_COMMENTS_MODULE; + comments->opening_comment = opening_comment; + comments->keyword_gap_comments = *keyword_gap; + comments->trailing_comment = trailing_comment; + return comments; +} + +static pm_parenthesized_comments_t * +pm_parenthesized_comments_new(pm_comments_context_t *ctx, const pm_comment_t *opening_comment, const pm_comments_list_t *opening_gap, const pm_comments_list_t *closing_gap) { + pm_parenthesized_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_parenthesized_comments_t); + comments->base.type = PM_COMMENTS_PARENTHESIZED; + comments->opening_comment = opening_comment; + comments->opening_gap_comments = *opening_gap; + comments->closing_gap_comments = *closing_gap; + return comments; +} + +static pm_prefix_comments_t * +pm_prefix_comments_new(pm_comments_context_t *ctx, const pm_comment_t *operator_comment, const pm_comments_list_t *gap) { + pm_prefix_comments_t *comments = PM_COMMENTS_ALLOC(ctx, pm_prefix_comments_t); + comments->base.type = PM_COMMENTS_PREFIX; + comments->operator_comment = operator_comment; + comments->gap_comments = *gap; + return comments; +} + +/******************************************************************************/ +/* Helper functions that are used by the various visitors. */ +/******************************************************************************/ + +/* Store comments for a node in the comments map. */ +static void +comments_store(pm_comments_context_t *ctx, uint32_t node_id, const pm_comments_t *comments) { + assert(node_id < ctx->map->size); + assert(ctx->map->entries[node_id] == NULL); + ctx->map->entries[node_id] = comments; +} + +/* Return the line number for a given byte offset. */ +static inline int32_t +comments_line(const pm_comments_context_t *ctx, uint32_t offset) { + return pm_line_offset_list_line(&ctx->parser->line_offsets, offset, ctx->parser->start_line); +} + +/* Return the start line of a node. */ +static inline int32_t +comments_node_start_line(const pm_comments_context_t *ctx, const pm_node_t *node) { + return comments_line(ctx, node->location.start); +} + +/* Return the end line of a node. */ +static inline int32_t +comments_node_end_line(const pm_comments_context_t *ctx, const pm_node_t *node) { + uint32_t end_offset = node->location.start + node->location.length; + return comments_line(ctx, end_offset > 0 ? end_offset - 1 : 0); +} + +/* Return the start line of a location. */ +static inline int32_t +comments_loc_start_line(const pm_comments_context_t *ctx, pm_location_t loc) { + return comments_line(ctx, loc.start); +} + +/* Return the end line of a location. */ +static inline int32_t +comments_loc_end_line(const pm_comments_context_t *ctx, pm_location_t loc) { + uint32_t end_offset = loc.start + loc.length; + return comments_line(ctx, end_offset > 0 ? end_offset - 1 : 0); +} + +/* Checks if an optional location is set. */ +static inline bool +comments_loc_set(pm_location_t loc) { + return loc.length > 0; +} + +/* Claim the comment at a specific line, returning NULL if there is no comment + * or if the line has already been claimed. */ +static const pm_comment_t * +comments_claim_comment(pm_comments_context_t *ctx, int32_t line) { + if (line < ctx->min_line || line > ctx->max_line) return NULL; + + int32_t idx = line - ctx->min_line; + const pm_comment_t *comment = ctx->comments[idx]; + + /* Clear the comments map at this line so that subsequent claims will not + * find it. */ + if (comment != NULL) ctx->comments[idx] = NULL; + + return comment; +} + +/* Claim comments in the range [start_line, end_line], returning them in a list. + */ +static void +comments_claim_comments(pm_comments_context_t *ctx, int32_t start_line, int32_t end_line, pm_comments_list_t *list) { + /* First pass: count. */ + size_t size = 0; + for (int32_t line = start_line; line <= end_line; line++) { + if (line >= ctx->min_line && line <= ctx->max_line) { + if (ctx->comments[line - ctx->min_line] != NULL) { + size++; + } + } + } + + if (size == 0) { + list->comments = NULL; + list->size = 0; + return; + } + + const pm_comment_t **comments = (const pm_comment_t **) pm_arena_alloc( + ctx->parser->arena, + sizeof(pm_comment_t *) * size, + PRISM_ALIGNOF(pm_comment_t *) + ); + + /* Second pass: collect and clear. */ + size_t index = 0; + for (int32_t line = start_line; line <= end_line; line++) { + if (line >= ctx->min_line && line <= ctx->max_line) { + const pm_comment_t *comment = ctx->comments[line - ctx->min_line]; + + if (comment != NULL) { + comments[index++] = comment; + ctx->comments[line - ctx->min_line] = NULL; + } + } + } + + list->comments = comments; + list->size = size; +} + +/* A comparison function for qsort to sort nodes by their start offset. */ +static int +node_compare(const void *left, const void *right) { + const pm_node_t *left_node = *(const pm_node_t **) left; + const pm_node_t *right_node = *(const pm_node_t **) right; + if (left_node->location.start < right_node->location.start) return -1; + if (left_node->location.start > right_node->location.start) return 1; + return 0; +} + +/* Interleave comments with nodes in a list by creating CommentNode instances + * for each comment and appending them to the list, then sorting the entire list + * by start offset. */ +static void +comments_interleave(pm_comments_context_t *ctx, pm_node_list_t *list, const pm_comments_list_t *comments) { + /* Return if there are no comments to be had. */ + if (comments->size == 0) return; + + /* Create comment nodes and append to list. */ + for (size_t index = 0; index < comments->size; index++) { + pm_node_list_append(ctx->parser->arena, list, pm_comment_node_new(ctx, comments->comments[index])); + } + + /* Sort the entire list by start offset. */ + if (list->size > 1) { + qsort(list->nodes, list->size, sizeof(pm_node_t *), node_compare); + } +} + +/* Claim comments in the given range, insert them as CommentNode instances into + * the body of the given StatementsNode instance. Create the StatementsNode + * instance if it is NULL. */ +static pm_statements_node_t * +comments_fold(pm_comments_context_t *ctx, int32_t start_line, int32_t end_line, pm_statements_node_t *statements) { + pm_comments_list_t claimed; + comments_claim_comments(ctx, start_line, end_line, &claimed); + + if (claimed.size == 0) { + return statements; + } + + if (statements != NULL) { + for (size_t index = 0; index < claimed.size; index++) { + pm_node_list_append(ctx->parser->arena, &statements->body, pm_comment_node_new(ctx, claimed.comments[index])); + } + + if (statements->body.size > 1) { + qsort(statements->body.nodes, statements->body.size, sizeof(pm_node_t *), node_compare); + } + + pm_node_t *first = statements->body.nodes[0]; + pm_node_t *last = statements->body.nodes[statements->body.size - 1]; + + uint32_t new_start = first->location.start; + uint32_t last_end = last->location.start + last->location.length; + statements->base.location.start = new_start; + statements->base.location.length = last_end - new_start; + + return statements; + } else { + pm_node_list_t body = { 0 }; + for (size_t index = 0; index < claimed.size; index++) { + pm_node_list_append(ctx->parser->arena, &body, pm_comment_node_new(ctx, claimed.comments[index])); + } + + if (body.size > 1) { + qsort(body.nodes, body.size, sizeof(pm_node_t *), node_compare); + } + + pm_node_t *first = body.nodes[0]; + pm_node_t *last = body.nodes[body.size - 1]; + + uint32_t new_start = first->location.start; + uint32_t last_end = last->location.start + last->location.length; + + return pm_statements_node_new( + ctx->parser->arena, + ++ctx->parser->node_id, + 0, + (pm_location_t) { .start = new_start, .length = last_end - new_start }, + body + ); + } +} + +static void comments_visit(pm_comments_context_t *ctx, pm_node_t *node); + +/* Visit the children of a node in reverse order, so that later children get to + * claim comments before earlier children. */ +static void +comments_visit_reverse(pm_comments_context_t *ctx, pm_node_list_t *list) { + for (size_t index = list->size; index > 0; index--) { + comments_visit(ctx, list->nodes[index - 1]); + } +} + +/* Claim a trailing comment on the end line of the give node if one exists. */ +static void +comments_attach_leaf_comments(pm_comments_context_t *ctx, pm_node_t *node) { + const pm_comment_t *trailing = comments_claim_comment(ctx, comments_node_end_line(ctx, node)); + + if (trailing != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_leaf_comments_new(ctx, trailing))); + } +} + +/* If the keyword has arguments, then visit them, because that means comments + * should necessarily be attached to the arguments. Otherwise, attach leaf + * comments to the bare keyword. */ +static void +comments_attach_keyword_comments(pm_comments_context_t *ctx, pm_node_t *node, pm_arguments_node_t *arguments) { + if (arguments != NULL) { + comments_visit(ctx, PM_NODE_UPCAST(arguments)); + } else { + comments_attach_leaf_comments(ctx, node); + } +} + +/* Visit the right, claim the operator, visit the left, then claim any comments + * in the gap between the start of the node and the end of the right. */ +static void +comments_attach_binary_comments(pm_comments_context_t *ctx, pm_node_t *node, pm_node_t *left, pm_node_t *right, pm_location_t operator_loc) { + comments_visit(ctx, right); + const pm_comment_t *operator_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, operator_loc)); + comments_visit(ctx, left); + pm_comments_list_t gap_comments; + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &gap_comments); + + if (operator_comment != NULL || gap_comments.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_binary_comments_new(ctx, operator_comment, &gap_comments))); + } +} + +/* Handle "and" and "or" keyword forms which are allowed to have newlines + * between the left and the operator. */ +static void +comments_attach_logical_keyword_comments(pm_comments_context_t *ctx, pm_node_t *node, pm_node_t *left, pm_node_t *right, pm_location_t operator_loc) { + comments_visit(ctx, right); + + const pm_comment_t *operator_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, operator_loc)); + comments_visit(ctx, left); + + pm_comments_list_t right_gap_comments; + comments_claim_comments(ctx, comments_loc_end_line(ctx, operator_loc), comments_node_end_line(ctx, node), &right_gap_comments); + + pm_comments_list_t left_gap_comments; + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_loc_start_line(ctx, operator_loc), &left_gap_comments); + + if (operator_comment != NULL || left_gap_comments.size > 0 || right_gap_comments.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_logical_keyword_comments_new(ctx, operator_comment, &left_gap_comments, &right_gap_comments))); + } +} + +/* Visit the value, claim the comment on the operator, then claim any comments + * in the gap between the start of the node and the end of the value. */ +static void +comments_attach_write_comments(pm_comments_context_t *ctx, pm_node_t *node, pm_node_t *value, pm_location_t operator_loc) { + comments_visit(ctx, value); + const pm_comment_t *operator_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, operator_loc)); + + pm_comments_list_t gap_comments; + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &gap_comments); + + if (operator_comment != NULL || gap_comments.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_binary_comments_new(ctx, operator_comment, &gap_comments))); + } +} + +/* Visit the child, claim the comment on the operator, then claim any comments + * in the gap between the start of the node and the end of the child. */ +static void +comments_attach_prefix_comments(pm_comments_context_t *ctx, pm_node_t *node, pm_node_t *child, pm_location_t operator_loc) { + comments_visit(ctx, child); + const pm_comment_t *operator_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, operator_loc)); + pm_comments_list_t gap_comments; + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &gap_comments); + + if (operator_comment != NULL || gap_comments.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_prefix_comments_new(ctx, operator_comment, &gap_comments))); + } +} + +/* If the parameter has a name, claim the operator and gap comments as prefix + * comments. Otherwise treat the bare operator as a leaf. */ +static void +comments_attach_prefix_parameter_comments(pm_comments_context_t *ctx, pm_node_t *node, pm_constant_id_t name, pm_location_t operator_loc) { + if (name != 0) { + const pm_comment_t *operator_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, operator_loc)); + pm_comments_list_t gap_comments; + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &gap_comments); + + if (operator_comment != NULL || gap_comments.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_prefix_comments_new(ctx, operator_comment, &gap_comments))); + } + } else { + comments_attach_leaf_comments(ctx, node); + } +} + +/* Claim the opening and trailing comments, visit the body, and fold any + * remaining comments into the statements. */ +static void +comments_attach_body_comments_generic(pm_comments_context_t *ctx, pm_node_t *node, pm_location_t opening_loc, pm_location_t closing_loc, pm_statements_node_t **statements_ptr) { + const pm_comment_t *trailing = comments_claim_comment(ctx, comments_loc_start_line(ctx, closing_loc)); + if (*statements_ptr != NULL) { + comments_visit(ctx, PM_NODE_UPCAST(*statements_ptr)); + } + const pm_comment_t *opening = comments_claim_comment(ctx, comments_loc_start_line(ctx, opening_loc)); + *statements_ptr = comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), *statements_ptr); + + if (opening != NULL || trailing != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_body_comments_new(ctx, opening, trailing))); + } +} + +/* Like binary comments, but both left and right are optional. */ +static void +comments_attach_range_comments(pm_comments_context_t *ctx, pm_node_t *node, pm_node_t *left, pm_node_t *right, pm_location_t operator_loc) { + if (right != NULL) comments_visit(ctx, right); + const pm_comment_t *operator_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, operator_loc)); + if (left != NULL) comments_visit(ctx, left); + pm_comments_list_t gap_comments; + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &gap_comments); + + if (operator_comment != NULL || gap_comments.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_binary_comments_new(ctx, operator_comment, &gap_comments))); + } +} + +/* Claim a trailing comment and visit the interpolated parts in reverse. */ +static void +comments_attach_interpolated_comments(pm_comments_context_t *ctx, pm_node_t *node, pm_node_list_t *parts) { + const pm_comment_t *trailing_comment = comments_claim_comment(ctx, comments_node_end_line(ctx, node)); + comments_visit_reverse(ctx, parts); + + if (trailing_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_leaf_comments_new(ctx, trailing_comment))); + } +} + +/* Claim trailing and operator comments, visit the parent, then split gap + * comments into receiver and message gaps. */ +static void +comments_attach_constant_path_comments(pm_comments_context_t *ctx, pm_node_t *node, pm_node_t *parent, pm_location_t delimiter_loc) { + const pm_comment_t *trailing = comments_claim_comment(ctx, comments_node_end_line(ctx, node)); + const pm_comment_t *operator_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, delimiter_loc)); + if (parent != NULL) comments_visit(ctx, parent); + + int32_t op_line = comments_loc_start_line(ctx, delimiter_loc); + pm_comments_list_t receiver_gap; + comments_claim_comments(ctx, comments_node_start_line(ctx, node), op_line, &receiver_gap); + pm_comments_list_t message_gap; + comments_claim_comments(ctx, op_line, comments_node_end_line(ctx, node), &message_gap); + + if (trailing != NULL || receiver_gap.size > 0 || operator_comment != NULL || message_gap.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_call_comments_new(ctx, trailing, &receiver_gap, operator_comment, &message_gap))); + } +} + +/* Visit the value, claim the call operator and assignment operator comments, + * visit the receiver, then split gap comments around the operators. */ +static void +comments_attach_call_write_comments(pm_comments_context_t *ctx, pm_node_t *node, pm_node_t *receiver, pm_node_t *value, pm_location_t call_operator_loc, pm_location_t operator_loc) { + comments_visit(ctx, value); + const pm_comment_t *operator_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, operator_loc)); + const pm_comment_t *call_operator_comment = NULL; + if (comments_loc_set(call_operator_loc)) { + call_operator_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, call_operator_loc)); + } + if (receiver != NULL) comments_visit(ctx, receiver); + + /* Split gap comments: after operator vs before */ + pm_comments_list_t operator_gap_comments; + comments_claim_comments(ctx, comments_loc_start_line(ctx, operator_loc), comments_node_end_line(ctx, node), &operator_gap_comments); + pm_comments_list_t call_gap_comments; + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &call_gap_comments); + + if (call_operator_comment != NULL || operator_comment != NULL || call_gap_comments.size > 0 || operator_gap_comments.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_call_write_comments_new(ctx, call_operator_comment, &call_gap_comments, operator_comment, &operator_gap_comments))); + } +} + +/* Visit the value, claim the operator comment, visit the block/arguments/ + * receiver, then claim gap comments. */ +static void +comments_attach_index_write_comments(pm_comments_context_t *ctx, pm_node_t *node, pm_node_t *receiver, pm_arguments_node_t *arguments, pm_block_argument_node_t *block, pm_node_t *value, pm_location_t operator_loc) { + comments_visit(ctx, value); + const pm_comment_t *operator_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, operator_loc)); + if (block != NULL) comments_visit(ctx, PM_NODE_UPCAST(block)); + if (arguments != NULL) comments_visit(ctx, PM_NODE_UPCAST(arguments)); + if (receiver != NULL) comments_visit(ctx, receiver); + pm_comments_list_t gap_comments; + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &gap_comments); + + if (operator_comment != NULL || gap_comments.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_binary_comments_new(ctx, operator_comment, &gap_comments))); + } +} + +/* Visit the child, claim the opening comment, then split gap comments into + * before and after the child. */ +static void +comments_attach_parenthesized_comments(pm_comments_context_t *ctx, pm_node_t *node, pm_node_t *child, pm_location_t lparen_loc) { + comments_visit(ctx, child); + const pm_comment_t *opening = comments_claim_comment(ctx, comments_loc_start_line(ctx, lparen_loc)); + + pm_comments_list_t closing_gap_comments; + comments_claim_comments(ctx, comments_node_end_line(ctx, child), comments_node_end_line(ctx, node), &closing_gap_comments); + + pm_comments_list_t opening_gap_comments; + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &opening_gap_comments); + + if (opening != NULL || opening_gap_comments.size > 0 || closing_gap_comments.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_parenthesized_comments_new(ctx, opening, &opening_gap_comments, &closing_gap_comments))); + } +} + +/* Shared handler for CaseNode and CaseMatchNode. Claims keyword and trailing + * comments, visits conditions via a callback, then splits gap comments. */ +typedef void (*comments_case_condition_visitor_t)(pm_comments_context_t *ctx, pm_node_t *condition, int32_t effective_end); + +static void +comments_attach_case_comments(pm_comments_context_t *ctx, pm_node_t *node, pm_node_t *predicate, pm_node_list_t *conditions, pm_else_node_t *else_clause, pm_location_t case_keyword_loc, pm_location_t end_keyword_loc, comments_case_condition_visitor_t condition_visitor) { + /* Trailing comment on end keyword */ + const pm_comment_t *trailing = comments_claim_comment(ctx, comments_loc_start_line(ctx, end_keyword_loc)); + + /* Visit else clause */ + if (else_clause != NULL) { + comments_visit(ctx, PM_NODE_UPCAST(else_clause)); + } + + /* Build boundaries: each condition's boundary is the start_line of the + * next condition (or else clause keyword, or end keyword). + */ + int32_t final_boundary; + if (else_clause != NULL) { + final_boundary = comments_loc_start_line(ctx, else_clause->else_keyword_loc); + } else { + final_boundary = comments_loc_start_line(ctx, end_keyword_loc); + } + + /* Visit conditions in reverse */ + for (size_t index = conditions->size; index > 0; index--) { + size_t condition_index = index - 1; + int32_t effective_end; + + if (condition_index + 1 < conditions->size) { + effective_end = comments_node_start_line(ctx, conditions->nodes[condition_index + 1]) - 1; + } else { + effective_end = final_boundary - 1; + } + + condition_visitor(ctx, conditions->nodes[condition_index], effective_end); + } + + /* Visit predicate */ + if (predicate != NULL) comments_visit(ctx, predicate); + + /* Claim keyword comment */ + const pm_comment_t *keyword = comments_claim_comment(ctx, comments_loc_start_line(ctx, case_keyword_loc)); + + /* Split: comments between keyword and predicate vs between predicate and first when/in */ + pm_comments_list_t keyword_gap_comments = { NULL, 0 }; + pm_comments_list_t predicate_gap_comments = { NULL, 0 }; + + if (predicate != NULL) { + comments_claim_comments(ctx, comments_node_end_line(ctx, predicate), comments_node_end_line(ctx, node), &predicate_gap_comments); + } + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &keyword_gap_comments); + + if (keyword != NULL || trailing != NULL || keyword_gap_comments.size > 0 || predicate_gap_comments.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_case_comments_new(ctx, keyword, &keyword_gap_comments, &predicate_gap_comments, trailing))); + } +} + +/* Case condition visitor for CaseNode (WhenNode). */ +static void +comments_visit_when_condition(pm_comments_context_t *ctx, pm_node_t *condition_node, int32_t effective_end) { + pm_when_node_t *condition = (pm_when_node_t *) condition_node; + + pm_statements_node_t *statements = condition->statements; + if (statements != NULL) { + comments_visit(ctx, PM_NODE_UPCAST(statements)); + } + comments_visit_reverse(ctx, &condition->conditions); + + int32_t body_start; + if (comments_loc_set(condition->then_keyword_loc)) { + body_start = comments_loc_start_line(ctx, condition->then_keyword_loc); + } else if (condition->conditions.size > 0) { + body_start = comments_node_end_line(ctx, condition->conditions.nodes[condition->conditions.size - 1]); + } else { + body_start = comments_loc_start_line(ctx, condition->keyword_loc); + } + + condition->statements = comments_fold(ctx, body_start, effective_end, statements); + + /* Claim any remaining comments in the condition range and merge into + * the conditions list. */ + pm_comments_list_t conditions_comments; + comments_claim_comments(ctx, comments_node_start_line(ctx, condition_node), effective_end, &conditions_comments); + comments_interleave(ctx, &condition->conditions, &conditions_comments); +} + +/* Case condition visitor for CaseMatchNode (InNode). */ +static void +comments_visit_in_condition(pm_comments_context_t *ctx, pm_node_t *condition_node, int32_t effective_end) { + pm_in_node_t *condition = (pm_in_node_t *) condition_node; + + pm_statements_node_t *statements = condition->statements; + if (statements != NULL) { + comments_visit(ctx, PM_NODE_UPCAST(statements)); + } + comments_visit(ctx, condition->pattern); + + int32_t body_start; + if (comments_loc_set(condition->then_loc)) { + body_start = comments_loc_start_line(ctx, condition->then_loc); + } else { + body_start = comments_node_end_line(ctx, condition->pattern); + } + + condition->statements = comments_fold(ctx, body_start, effective_end, statements); +} + +/* + * The main visit function responsible for traversing the parse tree and + * claiming/storing comments as needed. + */ +static void +comments_visit(pm_comments_context_t *ctx, pm_node_t *node) { + switch (PM_NODE_TYPE(node)) { + case PM_ERROR_RECOVERY_NODE: { + pm_error_recovery_node_t *cast = (pm_error_recovery_node_t *) node; + if (cast->unexpected) comments_visit(ctx, cast->unexpected); + break; + } + case PM_COMMENT_NODE: + case PM_EMBEDDED_VARIABLE_NODE: + case PM_IN_NODE: /* handled by CaseMatchNode */ + case PM_IT_PARAMETERS_NODE: + case PM_NUMBERED_PARAMETERS_NODE: + case PM_SCOPE_NODE: + case PM_WHEN_NODE: /* handled by CaseNode */ + break; + case PM_BACK_REFERENCE_READ_NODE: + case PM_BLOCK_LOCAL_VARIABLE_NODE: + case PM_CLASS_VARIABLE_READ_NODE: + case PM_CLASS_VARIABLE_TARGET_NODE: + case PM_CONSTANT_READ_NODE: + case PM_CONSTANT_TARGET_NODE: + case PM_FALSE_NODE: + case PM_FLOAT_NODE: + case PM_FORWARDING_ARGUMENTS_NODE: + case PM_FORWARDING_PARAMETER_NODE: + case PM_GLOBAL_VARIABLE_READ_NODE: + case PM_GLOBAL_VARIABLE_TARGET_NODE: + case PM_IMPLICIT_REST_NODE: + case PM_INSTANCE_VARIABLE_READ_NODE: + case PM_INSTANCE_VARIABLE_TARGET_NODE: + case PM_INTEGER_NODE: + case PM_IT_LOCAL_VARIABLE_READ_NODE: + case PM_LOCAL_VARIABLE_READ_NODE: + case PM_LOCAL_VARIABLE_TARGET_NODE: + case PM_MATCH_LAST_LINE_NODE: + case PM_NIL_NODE: + case PM_NO_BLOCK_PARAMETER_NODE: + case PM_NO_KEYWORDS_PARAMETER_NODE: + case PM_NUMBERED_REFERENCE_READ_NODE: + case PM_RATIONAL_NODE: + case PM_REDO_NODE: + case PM_REGULAR_EXPRESSION_NODE: + case PM_REQUIRED_KEYWORD_PARAMETER_NODE: + case PM_REQUIRED_PARAMETER_NODE: + case PM_RETRY_NODE: + case PM_SELF_NODE: + case PM_SOURCE_ENCODING_NODE: + case PM_SOURCE_FILE_NODE: + case PM_SOURCE_LINE_NODE: + case PM_STRING_NODE: + case PM_SYMBOL_NODE: + case PM_TRUE_NODE: + case PM_X_STRING_NODE: + comments_attach_leaf_comments(ctx, node); + break; + /* + * alias $a $b + */ + case PM_ALIAS_GLOBAL_VARIABLE_NODE: { + pm_alias_global_variable_node_t *cast = (pm_alias_global_variable_node_t *) node; + + comments_visit(ctx, cast->old_name); + comments_visit(ctx, cast->new_name); + break; + } + /* + * alias a + * # comment + * b + */ + case PM_ALIAS_METHOD_NODE: { + pm_alias_method_node_t *cast = (pm_alias_method_node_t *) node; + pm_comments_list_t gap_comments; + + comments_visit(ctx, cast->old_name); + comments_visit(ctx, cast->new_name); + + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &gap_comments); + + if (gap_comments.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_alias_method_comments_new(ctx, &gap_comments))); + } + break; + } + /* + * foo in a | # comment + * # comment + * b + */ + case PM_ALTERNATION_PATTERN_NODE: { + pm_alternation_pattern_node_t *cast = (pm_alternation_pattern_node_t *) node; + comments_attach_binary_comments(ctx, node, cast->left, cast->right, cast->operator_loc); + break; + } + /* + * a && # comment + * # comment + * b + */ + case PM_AND_NODE: { + pm_and_node_t *cast = (pm_and_node_t *) node; + + if (cast->operator_loc.length == 3) { + /* "and" operator can begin a line */ + comments_attach_logical_keyword_comments(ctx, node, cast->left, cast->right, cast->operator_loc); + } else { + /* "&&" operator is a normal binary operator */ + comments_attach_binary_comments(ctx, node, cast->left, cast->right, cast->operator_loc); + } + break; + } + /* + * foo( + * # comment + * a, + * # comment + * b + * ) + */ + case PM_ARGUMENTS_NODE: { + pm_arguments_node_t *cast = (pm_arguments_node_t *) node; + pm_comments_list_t inner; + + comments_visit_reverse(ctx, &cast->arguments); + + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &inner); + comments_interleave(ctx, &cast->arguments, &inner); + break; + } + /* + * [ # comment + * # comment + * 1, + * # comment + * 2 + * # comment + * ] # comment + */ + case PM_ARRAY_NODE: { + pm_array_node_t *cast = (pm_array_node_t *) node; + const pm_comment_t *opening_comment = NULL; + pm_comments_list_t inner_comments; + const pm_comment_t *closing_comment = NULL; + + if (comments_loc_set(cast->closing_loc)) { + closing_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->closing_loc)); + } + + comments_visit_reverse(ctx, &cast->elements); + + if (comments_loc_set(cast->opening_loc)) { + opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->opening_loc)); + } + + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &inner_comments); + comments_interleave(ctx, &cast->elements, &inner_comments); + + if (opening_comment != NULL || closing_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_collection_comments_new(ctx, opening_comment, closing_comment))); + } + break; + } + /* + * foo in [ # comment + * 1, *a, 2 + * ] # comment + */ + case PM_ARRAY_PATTERN_NODE: { + pm_array_pattern_node_t *cast = (pm_array_pattern_node_t *) node; + const pm_comment_t *opening_comments = NULL; + const pm_comment_t *closing_comments = NULL; + + if (comments_loc_set(cast->closing_loc)) { + closing_comments = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->closing_loc)); + } + + comments_visit_reverse(ctx, &cast->posts); + if (cast->rest != NULL) comments_visit(ctx, cast->rest); + + comments_visit_reverse(ctx, &cast->requireds); + + if (comments_loc_set(cast->opening_loc)) { + opening_comments = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->opening_loc)); + } + + if (cast->constant != NULL) comments_visit(ctx, cast->constant); + + if (cast->rest != NULL) { + pm_comments_list_t requireds_comments; + pm_comments_list_t posts_comments; + + comments_claim_comments(ctx, comments_node_end_line(ctx, cast->rest), comments_node_end_line(ctx, node), &posts_comments); + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_start_line(ctx, cast->rest), &requireds_comments); + + comments_interleave(ctx, &cast->posts, &posts_comments); + comments_interleave(ctx, &cast->requireds, &requireds_comments); + } else { + pm_comments_list_t inner_comments; + + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &inner_comments); + comments_interleave(ctx, &cast->requireds, &inner_comments); + } + + if (opening_comments != NULL || closing_comments != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_collection_comments_new(ctx, opening_comments, closing_comments))); + } + break; + } + /* + * { a => # comment + * b } + */ + case PM_ASSOC_NODE: { + pm_assoc_node_t *cast = (pm_assoc_node_t *) node; + + if (comments_loc_set(cast->operator_loc)) { + /* a => b */ + comments_attach_binary_comments(ctx, node, cast->key, cast->value, cast->operator_loc); + } else if (PM_NODE_TYPE_P(cast->value, PM_IMPLICIT_NODE)) { + /* a: - implicit value, only the key is visible */ + comments_visit(ctx, cast->key); + } else { + /* a: b — key includes the colon, acts like a write */ + comments_attach_write_comments(ctx, node, cast->value, cast->key->location); + } + break; + } + /* + * foo(** # comment + * a) + */ + case PM_ASSOC_SPLAT_NODE: { + pm_assoc_splat_node_t *cast = (pm_assoc_splat_node_t *) node; + + if (cast->value != NULL) { + comments_attach_prefix_comments(ctx, node, cast->value, cast->operator_loc); + } else { + comments_attach_leaf_comments(ctx, node); + } + break; + } + /* + * begin # comment + * foo + * rescue + * bar + * end # comment + */ + case PM_BEGIN_NODE: { + pm_begin_node_t *cast = (pm_begin_node_t *) node; + const pm_comment_t *opening_comment = NULL; + const pm_comment_t *trailing_comment = NULL; + + if (comments_loc_set(cast->end_keyword_loc)) { + trailing_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->end_keyword_loc)); + } + + if (cast->ensure_clause != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->ensure_clause)); + if (cast->else_clause != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->else_clause)); + if (cast->rescue_clause != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->rescue_clause)); + if (cast->statements != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->statements)); + + if (comments_loc_set(cast->begin_keyword_loc)) { + opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->begin_keyword_loc)); + } + + cast->statements = comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), cast->statements); + + if (opening_comment != NULL || trailing_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_body_comments_new(ctx, opening_comment, trailing_comment))); + } + break; + } + /* + * foo(& # comment + * bar) + */ + case PM_BLOCK_ARGUMENT_NODE: { + pm_block_argument_node_t *cast = (pm_block_argument_node_t *) node; + + if (cast->expression != NULL) { + comments_attach_prefix_comments(ctx, node, cast->expression, cast->operator_loc); + } else { + comments_attach_leaf_comments(ctx, node); + } + break; + } + /* + * foo { # comment + * bar + * } # comment + */ + case PM_BLOCK_NODE: { + pm_block_node_t *cast = (pm_block_node_t *) node; + const pm_comment_t *opening_comment; + const pm_comment_t *trailing_comment; + + trailing_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->closing_loc)); + if (cast->body != NULL) comments_visit(ctx, cast->body); + if (cast->parameters != NULL) comments_visit(ctx, cast->parameters); + opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->opening_loc)); + + if (cast->body == NULL || PM_NODE_TYPE_P(cast->body, PM_STATEMENTS_NODE)) { + cast->body = (pm_node_t *) comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), (pm_statements_node_t *) cast->body); + } + + if (opening_comment != NULL || trailing_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_body_comments_new(ctx, opening_comment, trailing_comment))); + } + break; + } + /* + * foo { |& # comment + * a| } + */ + case PM_BLOCK_PARAMETER_NODE: { + pm_block_parameter_node_t *cast = (pm_block_parameter_node_t *) node; + comments_attach_prefix_parameter_comments(ctx, node, cast->name, cast->operator_loc); + break; + } + /* + * foo { | # comment + * a, b + * | # comment } + */ + case PM_BLOCK_PARAMETERS_NODE: { + pm_block_parameters_node_t *cast = (pm_block_parameters_node_t *) node; + const pm_comment_t *opening = NULL; + const pm_comment_t *closing = NULL; + + if (comments_loc_set(cast->closing_loc)) { + closing = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->closing_loc)); + } + + comments_visit_reverse(ctx, &cast->locals); + + if (cast->locals.size > 0) { + int32_t locals_start = (cast->parameters != NULL) + ? comments_node_end_line(ctx, PM_NODE_UPCAST(cast->parameters)) + : comments_node_start_line(ctx, node); + + int32_t locals_end = comments_loc_set(cast->closing_loc) + ? comments_loc_start_line(ctx, cast->closing_loc) + : comments_node_end_line(ctx, node); + + pm_comments_list_t locals_gap; + comments_claim_comments(ctx, locals_start, locals_end, &locals_gap); + comments_interleave(ctx, &cast->locals, &locals_gap); + } + + if (cast->parameters != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->parameters)); + + if (comments_loc_set(cast->opening_loc)) { + opening = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->opening_loc)); + } + + if (opening != NULL || closing != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_collection_comments_new(ctx, opening, closing))); + } + break; + } + /* + * break # comment + */ + case PM_BREAK_NODE: { + pm_break_node_t *cast = (pm_break_node_t *) node; + comments_attach_keyword_comments(ctx, node, cast->arguments); + break; + } + /* + * foo. # comment + * bar &&= 1 + */ + case PM_CALL_AND_WRITE_NODE: { + pm_call_and_write_node_t *cast = (pm_call_and_write_node_t *) node; + comments_attach_call_write_comments(ctx, node, cast->receiver, cast->value, cast->call_operator_loc, cast->operator_loc); + break; + } + /* + * foo. # comment + * bar # comment + */ + case PM_CALL_NODE: { + pm_call_node_t *cast = (pm_call_node_t *) node; + + if (PM_NODE_FLAG_P(node, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) { + comments_attach_leaf_comments(ctx, node); + } else { + pm_comments_list_t receiver_gap = { NULL, 0 }; + const pm_comment_t *operator_comment = NULL; + pm_comments_list_t message_gap = { NULL, 0 }; + const pm_comment_t *trailing_comment = NULL; + + if (cast->block != NULL && PM_NODE_TYPE_P(cast->block, PM_BLOCK_NODE)) { + comments_visit(ctx, cast->block); + } else { + trailing_comment = comments_claim_comment(ctx, comments_node_end_line(ctx, node)); + if (cast->block != NULL) comments_visit(ctx, cast->block); + } + + if (cast->arguments != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->arguments)); + if (comments_loc_set(cast->call_operator_loc)) { + operator_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->call_operator_loc)); + } + if (cast->receiver != NULL) comments_visit(ctx, cast->receiver); + + if (comments_loc_set(cast->call_operator_loc)) { + int32_t op_line = comments_loc_start_line(ctx, cast->call_operator_loc); + comments_claim_comments(ctx, comments_node_start_line(ctx, node), op_line, &receiver_gap); + comments_claim_comments(ctx, op_line, comments_node_end_line(ctx, node), &message_gap); + } else { + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &message_gap); + } + + if (trailing_comment != NULL || receiver_gap.size > 0 || operator_comment != NULL || message_gap.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_call_comments_new(ctx, trailing_comment, &receiver_gap, operator_comment, &message_gap))); + } + } + break; + } + /* + * foo. # comment + * bar += 1 + */ + case PM_CALL_OPERATOR_WRITE_NODE: { + pm_call_operator_write_node_t *cast = (pm_call_operator_write_node_t *) node; + comments_attach_call_write_comments(ctx, node, cast->receiver, cast->value, cast->call_operator_loc, cast->binary_operator_loc); + break; + } + /* + * foo. # comment + * bar ||= 1 + */ + case PM_CALL_OR_WRITE_NODE: { + pm_call_or_write_node_t *cast = (pm_call_or_write_node_t *) node; + comments_attach_call_write_comments(ctx, node, cast->receiver, cast->value, cast->call_operator_loc, cast->operator_loc); + break; + } + /* + * foo. # comment + * bar, baz = 1, 2 + */ + case PM_CALL_TARGET_NODE: { + pm_call_target_node_t *cast = (pm_call_target_node_t *) node; + pm_comments_list_t receiver_gap; + const pm_comment_t *operator_comment; + pm_comments_list_t message_gap; + const pm_comment_t *trailing_comment; + + trailing_comment = comments_claim_comment(ctx, comments_node_end_line(ctx, node)); + operator_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->call_operator_loc)); + comments_visit(ctx, cast->receiver); + + int32_t op_line = comments_loc_start_line(ctx, cast->call_operator_loc); + comments_claim_comments(ctx, comments_node_start_line(ctx, node), op_line, &receiver_gap); + comments_claim_comments(ctx, op_line, comments_node_end_line(ctx, node), &message_gap); + + if (trailing_comment != NULL || receiver_gap.size > 0 || operator_comment != NULL || message_gap.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_call_comments_new(ctx, trailing_comment, &receiver_gap, operator_comment, &message_gap))); + } + break; + } + /* + * foo in a => # comment + * b + */ + case PM_CAPTURE_PATTERN_NODE: { + pm_capture_pattern_node_t *cast = (pm_capture_pattern_node_t *) node; + comments_attach_binary_comments(ctx, node, cast->value, PM_NODE_UPCAST(cast->target), cast->operator_loc); + break; + } + /* + * case foo # comment + * in bar + * baz + * end # comment + */ + case PM_CASE_MATCH_NODE: { + pm_case_match_node_t *cast = (pm_case_match_node_t *) node; + comments_attach_case_comments(ctx, node, cast->predicate, &cast->conditions, cast->else_clause, cast->case_keyword_loc, cast->end_keyword_loc, comments_visit_in_condition); + break; + } + /* + * case foo # comment + * when bar + * baz + * end # comment + */ + case PM_CASE_NODE: { + pm_case_node_t *cast = (pm_case_node_t *) node; + comments_attach_case_comments(ctx, node, cast->predicate, &cast->conditions, cast->else_clause, cast->case_keyword_loc, cast->end_keyword_loc, comments_visit_when_condition); + break; + } + /* + * class # comment + * Foo < # comment + * Bar + * end # comment + */ + case PM_CLASS_NODE: { + pm_class_node_t *cast = (pm_class_node_t *) node; + + const pm_comment_t *trailing_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->end_keyword_loc)); + if (cast->body != NULL) comments_visit(ctx, cast->body); + + pm_comments_list_t inheritance_gap_comments = { 0 }; + const pm_comment_t *inheritance_operator_comment = NULL; + + if (cast->superclass != NULL) { + comments_visit(ctx, cast->superclass); + + inheritance_operator_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->inheritance_operator_loc)); + comments_claim_comments(ctx, comments_loc_start_line(ctx, cast->inheritance_operator_loc), comments_node_start_line(ctx, cast->superclass), &inheritance_gap_comments); + } + + comments_visit(ctx, cast->constant_path); + + const pm_comment_t *opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->class_keyword_loc)); + pm_comments_list_t keyword_gap_comments; + comments_claim_comments(ctx, comments_loc_start_line(ctx, cast->class_keyword_loc), comments_node_start_line(ctx, cast->constant_path), &keyword_gap_comments); + + if (cast->body == NULL || PM_NODE_TYPE_P(cast->body, PM_STATEMENTS_NODE)) { + cast->body = (pm_node_t *) comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), (pm_statements_node_t *) cast->body); + } + + if (opening_comment != NULL || keyword_gap_comments.size > 0 || inheritance_operator_comment != NULL || inheritance_gap_comments.size > 0 || trailing_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_class_comments_new(ctx, opening_comment, &keyword_gap_comments, inheritance_operator_comment, &inheritance_gap_comments, trailing_comment))); + } + break; + } + /* + * @@a &&= # comment + * 1 + */ + case PM_CLASS_VARIABLE_AND_WRITE_NODE: { + pm_class_variable_and_write_node_t *cast = (pm_class_variable_and_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->operator_loc); + break; + } + /* + * @@a += # comment + * 1 + */ + case PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE: { + pm_class_variable_operator_write_node_t *cast = (pm_class_variable_operator_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->binary_operator_loc); + break; + } + /* + * @@a ||= # comment + * 1 + */ + case PM_CLASS_VARIABLE_OR_WRITE_NODE: { + pm_class_variable_or_write_node_t *cast = (pm_class_variable_or_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->operator_loc); + break; + } + /* + * @@a = # comment + * 1 + */ + case PM_CLASS_VARIABLE_WRITE_NODE: { + pm_class_variable_write_node_t *cast = (pm_class_variable_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->operator_loc); + break; + } + /* + * A &&= # comment + * 1 + */ + case PM_CONSTANT_AND_WRITE_NODE: { + pm_constant_and_write_node_t *cast = (pm_constant_and_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->operator_loc); + break; + } + /* + * A += # comment + * 1 + */ + case PM_CONSTANT_OPERATOR_WRITE_NODE: { + pm_constant_operator_write_node_t *cast = (pm_constant_operator_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->binary_operator_loc); + break; + } + /* + * A ||= # comment + * 1 + */ + case PM_CONSTANT_OR_WRITE_NODE: { + pm_constant_or_write_node_t *cast = (pm_constant_or_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->operator_loc); + break; + } + /* + * A::B &&= # comment + * 1 + */ + case PM_CONSTANT_PATH_AND_WRITE_NODE: { + pm_constant_path_and_write_node_t *cast = (pm_constant_path_and_write_node_t *) node; + comments_attach_binary_comments(ctx, node, PM_NODE_UPCAST(cast->target), cast->value, cast->operator_loc); + break; + } + /* + * A:: # comment + * B + */ + case PM_CONSTANT_PATH_NODE: { + pm_constant_path_node_t *cast = (pm_constant_path_node_t *) node; + comments_attach_constant_path_comments(ctx, node, cast->parent, cast->delimiter_loc); + break; + } + /* + * A::B += # comment + * 1 + */ + case PM_CONSTANT_PATH_OPERATOR_WRITE_NODE: { + pm_constant_path_operator_write_node_t *cast = (pm_constant_path_operator_write_node_t *) node; + comments_attach_binary_comments(ctx, node, PM_NODE_UPCAST(cast->target), cast->value, cast->binary_operator_loc); + break; + } + /* + * A::B ||= # comment + * 1 + */ + case PM_CONSTANT_PATH_OR_WRITE_NODE: { + pm_constant_path_or_write_node_t *cast = (pm_constant_path_or_write_node_t *) node; + comments_attach_binary_comments(ctx, node, PM_NODE_UPCAST(cast->target), cast->value, cast->operator_loc); + break; + } + /* + * A:: # comment + * B, C = 1, 2 + */ + case PM_CONSTANT_PATH_TARGET_NODE: { + pm_constant_path_target_node_t *cast = (pm_constant_path_target_node_t *) node; + comments_attach_constant_path_comments(ctx, node, cast->parent, cast->delimiter_loc); + break; + } + /* + * A::B = # comment + * 1 + */ + case PM_CONSTANT_PATH_WRITE_NODE: { + pm_constant_path_write_node_t *cast = (pm_constant_path_write_node_t *) node; + comments_attach_binary_comments(ctx, node, PM_NODE_UPCAST(cast->target), cast->value, cast->operator_loc); + break; + } + /* + * A = # comment + * 1 + */ + case PM_CONSTANT_WRITE_NODE: { + pm_constant_write_node_t *cast = (pm_constant_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->operator_loc); + break; + } + /* + * def foo( # comment + * a + * ) # comment + * bar + * end # comment + */ + case PM_DEF_NODE: { + pm_def_node_t *cast = (pm_def_node_t *) node; + + if (comments_loc_set(cast->equal_loc)) { + const pm_comment_t *opening_comment; + const pm_comment_t *lparen_comment = NULL; + const pm_comment_t *rparen_comment = NULL; + const pm_comment_t *equal_comment; + + if (cast->body != NULL) comments_visit(ctx, cast->body); + equal_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->equal_loc)); + + if (comments_loc_set(cast->rparen_loc)) { + rparen_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->rparen_loc)); + } + if (cast->parameters != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->parameters)); + if (comments_loc_set(cast->lparen_loc)) { + lparen_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->lparen_loc)); + } + + if (cast->receiver != NULL) comments_visit(ctx, cast->receiver); + opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->def_keyword_loc)); + + pm_comments_list_t keyword_gap; + comments_claim_comments(ctx, comments_loc_start_line(ctx, cast->def_keyword_loc), comments_loc_start_line(ctx, cast->name_loc), &keyword_gap); + + if (opening_comment != NULL || keyword_gap.size > 0 || lparen_comment != NULL || rparen_comment != NULL || equal_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_endless_def_comments_new(ctx, opening_comment, &keyword_gap, lparen_comment, rparen_comment, equal_comment))); + } + } else { + const pm_comment_t *opening_comment; + const pm_comment_t *lparen_comment = NULL; + const pm_comment_t *rparen_comment = NULL; + const pm_comment_t *trailing_comment = NULL; + + if (comments_loc_set(cast->end_keyword_loc)) { + trailing_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->end_keyword_loc)); + } + + if (cast->body != NULL) comments_visit(ctx, cast->body); + + if (comments_loc_set(cast->rparen_loc)) { + rparen_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->rparen_loc)); + } + if (cast->parameters != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->parameters)); + if (comments_loc_set(cast->lparen_loc)) { + lparen_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->lparen_loc)); + } + + if (cast->receiver != NULL) comments_visit(ctx, cast->receiver); + opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->def_keyword_loc)); + + pm_comments_list_t keyword_gap; + comments_claim_comments(ctx, comments_loc_start_line(ctx, cast->def_keyword_loc), comments_loc_start_line(ctx, cast->name_loc), &keyword_gap); + + if (cast->body == NULL || PM_NODE_TYPE_P(cast->body, PM_STATEMENTS_NODE)) { + cast->body = (pm_node_t *) comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), (pm_statements_node_t *) cast->body); + } + + if (opening_comment != NULL || keyword_gap.size > 0 || trailing_comment != NULL || lparen_comment != NULL || rparen_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_def_comments_new(ctx, opening_comment, &keyword_gap, lparen_comment, rparen_comment, trailing_comment))); + } + } + break; + } + /* + * defined?( # comment + * foo) + */ + case PM_DEFINED_NODE: { + pm_defined_node_t *cast = (pm_defined_node_t *) node; + + if (comments_loc_set(cast->lparen_loc)) { + comments_attach_parenthesized_comments(ctx, node, cast->value, cast->lparen_loc); + } else { + comments_attach_prefix_comments(ctx, node, cast->value, cast->keyword_loc); + } + break; + } + /* + * if a + * else # comment + * b + * end + */ + case PM_ELSE_NODE: { + pm_else_node_t *cast = (pm_else_node_t *) node; + + if (cast->statements != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->statements)); + const pm_comment_t *opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->else_keyword_loc)); + cast->statements = comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), cast->statements); + + if (opening_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_clause_comments_new(ctx, opening_comment))); + } + break; + } + /* + * "foo #{ # comment + * bar}" + */ + case PM_EMBEDDED_STATEMENTS_NODE: { + pm_embedded_statements_node_t *cast = (pm_embedded_statements_node_t *) node; + + if (cast->statements != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->statements)); + + const pm_comment_t *opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->opening_loc)); + cast->statements = comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), cast->statements); + + if (opening_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_embedded_statements_comments_new(ctx, opening_comment))); + } + break; + } + /* + * begin + * ensure # comment + * foo + * end + */ + case PM_ENSURE_NODE: { + pm_ensure_node_t *cast = (pm_ensure_node_t *) node; + + if (cast->statements != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->statements)); + + const pm_comment_t *opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->ensure_keyword_loc)); + cast->statements = comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), cast->statements); + + if (opening_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_clause_comments_new(ctx, opening_comment))); + } + break; + } + /* + * foo in [ # comment + * *a, b, *c + * ] # comment + */ + case PM_FIND_PATTERN_NODE: { + pm_find_pattern_node_t *cast = (pm_find_pattern_node_t *) node; + const pm_comment_t *closing_comment = NULL; + const pm_comment_t *opening_comment = NULL; + + if (comments_loc_set(cast->closing_loc)) { + closing_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->closing_loc)); + } + + comments_visit(ctx, PM_NODE_UPCAST(cast->right)); + comments_visit_reverse(ctx, &cast->requireds); + comments_visit(ctx, PM_NODE_UPCAST(cast->left)); + + if (comments_loc_set(cast->opening_loc)) { + opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->opening_loc)); + } + + if (cast->constant != NULL) comments_visit(ctx, cast->constant); + + pm_comments_list_t pre_left_comments; + pm_comments_list_t requireds_comments; + pm_comments_list_t post_right_comments; + + comments_claim_comments(ctx, comments_node_end_line(ctx, PM_NODE_UPCAST(cast->left)), comments_node_start_line(ctx, PM_NODE_UPCAST(cast->right)), &requireds_comments); + comments_interleave(ctx, &cast->requireds, &requireds_comments); + + comments_claim_comments(ctx, comments_node_end_line(ctx, PM_NODE_UPCAST(cast->right)), comments_node_end_line(ctx, node), &post_right_comments); + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &pre_left_comments); + + if (opening_comment != NULL || closing_comment != NULL || pre_left_comments.size > 0 || post_right_comments.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_find_pattern_comments_new(ctx, opening_comment, closing_comment, &pre_left_comments, &post_right_comments))); + } + break; + } + /* + * a .. # comment + * b + */ + case PM_FLIP_FLOP_NODE: { + pm_flip_flop_node_t *cast = (pm_flip_flop_node_t *) node; + comments_attach_range_comments(ctx, node, cast->left, cast->right, cast->operator_loc); + break; + } + /* + * for a in b do # comment + * c + * end # comment + */ + case PM_FOR_NODE: { + pm_for_node_t *cast = (pm_for_node_t *) node; + + const pm_comment_t *trailing_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->end_keyword_loc)); + const pm_comment_t *do_comment = NULL; + if (comments_loc_set(cast->do_keyword_loc)) { + do_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->do_keyword_loc)); + } + + if (cast->statements != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->statements)); + comments_visit(ctx, cast->collection); + const pm_comment_t *in_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->in_keyword_loc)); + comments_visit(ctx, cast->index); + const pm_comment_t *for_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->for_keyword_loc)); + + cast->statements = comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), cast->statements); + + if (for_comment != NULL || in_comment != NULL || do_comment != NULL || trailing_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_for_comments_new(ctx, for_comment, in_comment, do_comment, trailing_comment))); + } + break; + } + /* + * super # comment + */ + case PM_FORWARDING_SUPER_NODE: { + pm_forwarding_super_node_t *cast = (pm_forwarding_super_node_t *) node; + if (cast->block != NULL) { + comments_visit(ctx, PM_NODE_UPCAST(cast->block)); + } else { + comments_attach_leaf_comments(ctx, node); + } + break; + } + /* + * $a &&= # comment + * 1 + */ + case PM_GLOBAL_VARIABLE_AND_WRITE_NODE: { + pm_global_variable_and_write_node_t *cast = (pm_global_variable_and_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->operator_loc); + break; + } + /* + * $a += # comment + * 1 + */ + case PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: { + pm_global_variable_operator_write_node_t *cast = (pm_global_variable_operator_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->binary_operator_loc); + break; + } + /* + * $a ||= # comment + * 1 + */ + case PM_GLOBAL_VARIABLE_OR_WRITE_NODE: { + pm_global_variable_or_write_node_t *cast = (pm_global_variable_or_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->operator_loc); + break; + } + /* + * $a = # comment + * 1 + */ + case PM_GLOBAL_VARIABLE_WRITE_NODE: { + pm_global_variable_write_node_t *cast = (pm_global_variable_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->operator_loc); + break; + } + /* + * { # comment + * a: 1 + * } # comment + */ + case PM_HASH_NODE: { + pm_hash_node_t *cast = (pm_hash_node_t *) node; + + const pm_comment_t *closing = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->closing_loc)); + comments_visit_reverse(ctx, &cast->elements); + const pm_comment_t *opening = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->opening_loc)); + + pm_comments_list_t inner; + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &inner); + comments_interleave(ctx, &cast->elements, &inner); + + if (opening != NULL || closing != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_collection_comments_new(ctx, opening, closing))); + } + break; + } + /* + * foo in { # comment + * a:, **b + * } # comment + */ + case PM_HASH_PATTERN_NODE: { + pm_hash_pattern_node_t *cast = (pm_hash_pattern_node_t *) node; + const pm_comment_t *closing = NULL; + const pm_comment_t *opening = NULL; + + if (comments_loc_set(cast->closing_loc)) { + closing = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->closing_loc)); + } + + if (cast->rest != NULL) comments_visit(ctx, cast->rest); + comments_visit_reverse(ctx, &cast->elements); + + if (comments_loc_set(cast->opening_loc)) { + opening = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->opening_loc)); + } + + if (cast->constant != NULL) comments_visit(ctx, cast->constant); + + pm_comments_list_t post_rest_comments = { NULL, 0 }; + if (cast->rest != NULL) { + comments_claim_comments(ctx, comments_node_end_line(ctx, cast->rest), comments_node_end_line(ctx, node), &post_rest_comments); + } + + pm_comments_list_t elements_comments; + + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &elements_comments); + comments_interleave(ctx, &cast->elements, &elements_comments); + + if (opening != NULL || closing != NULL || post_rest_comments.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_hash_pattern_comments_new(ctx, opening, closing, &post_rest_comments))); + } + break; + } + /* + * if a # comment + * b + * end # comment + */ + case PM_IF_NODE: { + pm_if_node_t *cast = (pm_if_node_t *) node; + const pm_comment_t *trailing_comment = NULL; + + if (comments_loc_set(cast->end_keyword_loc)) { + trailing_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->end_keyword_loc)); + } + if (cast->subsequent != NULL) comments_visit(ctx, cast->subsequent); + if (cast->statements != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->statements)); + comments_visit(ctx, cast->predicate); + + const pm_comment_t *opening_comment = NULL; + if (comments_loc_set(cast->if_keyword_loc)) { + opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->if_keyword_loc)); + } + cast->statements = comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), cast->statements); + + if (opening_comment != NULL || trailing_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_body_comments_new(ctx, opening_comment, trailing_comment))); + } + break; + } + /* + * 1i # comment + */ + case PM_IMAGINARY_NODE: { + pm_imaginary_node_t *cast = (pm_imaginary_node_t *) node; + + const pm_comment_t *trailing_comment = comments_claim_comment(ctx, comments_node_end_line(ctx, node)); + comments_visit(ctx, cast->numeric); + + if (trailing_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_leaf_comments_new(ctx, trailing_comment))); + } + break; + } + case PM_IMPLICIT_NODE: { + pm_implicit_node_t *cast = (pm_implicit_node_t *) node; + comments_visit(ctx, cast->value); + break; + } + /* + * foo[bar] &&= baz + */ + case PM_INDEX_AND_WRITE_NODE: { + pm_index_and_write_node_t *cast = (pm_index_and_write_node_t *) node; + comments_attach_index_write_comments(ctx, node, cast->receiver, cast->arguments, cast->block, cast->value, cast->operator_loc); + break; + } + /* + * foo[bar] += baz + */ + case PM_INDEX_OPERATOR_WRITE_NODE: { + pm_index_operator_write_node_t *cast = (pm_index_operator_write_node_t *) node; + comments_attach_index_write_comments(ctx, node, cast->receiver, cast->arguments, cast->block, cast->value, cast->binary_operator_loc); + break; + } + /* + * foo[bar] ||= baz + */ + case PM_INDEX_OR_WRITE_NODE: { + pm_index_or_write_node_t *cast = (pm_index_or_write_node_t *) node; + comments_attach_index_write_comments(ctx, node, cast->receiver, cast->arguments, cast->block, cast->value, cast->operator_loc); + break; + } + /* + * foo[bar], baz = 1, 2 + */ + case PM_INDEX_TARGET_NODE: { + pm_index_target_node_t *cast = (pm_index_target_node_t *) node; + + const pm_comment_t *trailing = comments_claim_comment(ctx, comments_node_end_line(ctx, node)); + if (cast->block != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->block)); + if (cast->arguments != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->arguments)); + comments_visit(ctx, cast->receiver); + + if (trailing != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_leaf_comments_new(ctx, trailing))); + } + break; + } + /* + * @a &&= # comment + * 1 + */ + case PM_INSTANCE_VARIABLE_AND_WRITE_NODE: { + pm_instance_variable_and_write_node_t *cast = (pm_instance_variable_and_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->operator_loc); + break; + } + /* + * @a += # comment + * 1 + */ + case PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: { + pm_instance_variable_operator_write_node_t *cast = (pm_instance_variable_operator_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->binary_operator_loc); + break; + } + /* + * @a ||= # comment + * 1 + */ + case PM_INSTANCE_VARIABLE_OR_WRITE_NODE: { + pm_instance_variable_or_write_node_t *cast = (pm_instance_variable_or_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->operator_loc); + break; + } + /* + * @a = # comment + * 1 + */ + case PM_INSTANCE_VARIABLE_WRITE_NODE: { + pm_instance_variable_write_node_t *cast = (pm_instance_variable_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->operator_loc); + break; + } + case PM_INTERPOLATED_MATCH_LAST_LINE_NODE: { + pm_interpolated_match_last_line_node_t *cast = (pm_interpolated_match_last_line_node_t *) node; + comments_attach_interpolated_comments(ctx, node, &cast->parts); + break; + } + case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE: { + pm_interpolated_regular_expression_node_t *cast = (pm_interpolated_regular_expression_node_t *) node; + comments_attach_interpolated_comments(ctx, node, &cast->parts); + break; + } + case PM_INTERPOLATED_STRING_NODE: { + pm_interpolated_string_node_t *cast = (pm_interpolated_string_node_t *) node; + comments_attach_interpolated_comments(ctx, node, &cast->parts); + break; + } + case PM_INTERPOLATED_SYMBOL_NODE: { + pm_interpolated_symbol_node_t *cast = (pm_interpolated_symbol_node_t *) node; + comments_attach_interpolated_comments(ctx, node, &cast->parts); + break; + } + case PM_INTERPOLATED_X_STRING_NODE: { + pm_interpolated_x_string_node_t *cast = (pm_interpolated_x_string_node_t *) node; + comments_attach_interpolated_comments(ctx, node, &cast->parts); + break; + } + case PM_KEYWORD_HASH_NODE: { + pm_keyword_hash_node_t *cast = (pm_keyword_hash_node_t *) node; + comments_visit_reverse(ctx, &cast->elements); + + pm_comments_list_t inner; + + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &inner); + comments_interleave(ctx, &cast->elements, &inner); + break; + } + /* + * def foo(** # comment + * a) end + */ + case PM_KEYWORD_REST_PARAMETER_NODE: { + pm_keyword_rest_parameter_node_t *cast = (pm_keyword_rest_parameter_node_t *) node; + comments_attach_prefix_parameter_comments(ctx, node, cast->name, cast->operator_loc); + break; + } + /* + * -> { # comment + * foo + * } # comment + */ + case PM_LAMBDA_NODE: { + pm_lambda_node_t *cast = (pm_lambda_node_t *) node; + const pm_comment_t *trailing_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->closing_loc)); + + if (cast->body != NULL) comments_visit(ctx, cast->body); + if (cast->parameters != NULL) comments_visit(ctx, cast->parameters); + + const pm_comment_t *opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->opening_loc)); + if (cast->body == NULL || PM_NODE_TYPE_P(cast->body, PM_STATEMENTS_NODE)) { + cast->body = (pm_node_t *) comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), (pm_statements_node_t *) cast->body); + } + + if (opening_comment != NULL || trailing_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_body_comments_new(ctx, opening_comment, trailing_comment))); + } + break; + } + /* + * a &&= # comment + * 1 + */ + case PM_LOCAL_VARIABLE_AND_WRITE_NODE: { + pm_local_variable_and_write_node_t *cast = (pm_local_variable_and_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->operator_loc); + break; + } + /* + * a += # comment + * 1 + */ + case PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: { + pm_local_variable_operator_write_node_t *cast = (pm_local_variable_operator_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->binary_operator_loc); + break; + } + /* + * a ||= # comment + * 1 + */ + case PM_LOCAL_VARIABLE_OR_WRITE_NODE: { + pm_local_variable_or_write_node_t *cast = (pm_local_variable_or_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->operator_loc); + break; + } + /* + * a = # comment + * 1 + */ + case PM_LOCAL_VARIABLE_WRITE_NODE: { + pm_local_variable_write_node_t *cast = (pm_local_variable_write_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->operator_loc); + break; + } + /* + * foo in # comment + * bar + */ + case PM_MATCH_PREDICATE_NODE: { + pm_match_predicate_node_t *cast = (pm_match_predicate_node_t *) node; + comments_attach_binary_comments(ctx, node, cast->value, cast->pattern, cast->operator_loc); + break; + } + /* + * foo => # comment + * bar + */ + case PM_MATCH_REQUIRED_NODE: { + pm_match_required_node_t *cast = (pm_match_required_node_t *) node; + comments_attach_binary_comments(ctx, node, cast->value, cast->pattern, cast->operator_loc); + break; + } + case PM_MATCH_WRITE_NODE: { + pm_match_write_node_t *cast = (pm_match_write_node_t *) node; + comments_visit(ctx, PM_NODE_UPCAST(cast->call)); + break; + } + /* + * module # comment + * Foo + * end # comment + */ + case PM_MODULE_NODE: { + pm_module_node_t *cast = (pm_module_node_t *) node; + const pm_comment_t *trailing_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->end_keyword_loc)); + if (cast->body != NULL) comments_visit(ctx, cast->body); + comments_visit(ctx, cast->constant_path); + + const pm_comment_t *opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->module_keyword_loc)); + pm_comments_list_t keyword_gap_comments; + comments_claim_comments(ctx, comments_loc_start_line(ctx, cast->module_keyword_loc), comments_node_start_line(ctx, cast->constant_path), &keyword_gap_comments); + + if (cast->body == NULL || PM_NODE_TYPE_P(cast->body, PM_STATEMENTS_NODE)) { + cast->body = (pm_node_t *) comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), (pm_statements_node_t *) cast->body); + } + + if (opening_comment != NULL || keyword_gap_comments.size > 0 || trailing_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_module_comments_new(ctx, opening_comment, &keyword_gap_comments, trailing_comment))); + } + break; + } + /* + * a, b = 1, 2 + */ + case PM_MULTI_TARGET_NODE: { + pm_multi_target_node_t *cast = (pm_multi_target_node_t *) node; + const pm_comment_t *rparen = NULL; + const pm_comment_t *lparen = NULL; + + if (comments_loc_set(cast->rparen_loc)) + rparen = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->rparen_loc)); + + comments_visit_reverse(ctx, &cast->rights); + if (cast->rest != NULL) comments_visit(ctx, cast->rest); + comments_visit_reverse(ctx, &cast->lefts); + + if (comments_loc_set(cast->lparen_loc)) + lparen = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->lparen_loc)); + + if (cast->rest != NULL) { + pm_comments_list_t rights_comments; + pm_comments_list_t lefts_comments; + + comments_claim_comments(ctx, comments_node_end_line(ctx, cast->rest), comments_node_end_line(ctx, node), &rights_comments); + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_start_line(ctx, cast->rest), &lefts_comments); + + comments_interleave(ctx, &cast->rights, &rights_comments); + comments_interleave(ctx, &cast->lefts, &lefts_comments); + } else { + pm_comments_list_t inner; + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &inner); + comments_interleave(ctx, &cast->lefts, &inner); + } + + if (lparen != NULL || rparen != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_collection_comments_new(ctx, lparen, rparen))); + } + break; + } + /* + * a, b = # comment + * 1, 2 + */ + case PM_MULTI_WRITE_NODE: { + pm_multi_write_node_t *cast = (pm_multi_write_node_t *) node; + + comments_visit(ctx, cast->value); + const pm_comment_t *operator_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->operator_loc)); + + comments_visit_reverse(ctx, &cast->rights); + if (cast->rest != NULL) comments_visit(ctx, cast->rest); + comments_visit_reverse(ctx, &cast->lefts); + + if (cast->rest != NULL) { + pm_comments_list_t rights_comments; + pm_comments_list_t lefts_comments; + + comments_claim_comments(ctx, comments_node_end_line(ctx, cast->rest), comments_loc_start_line(ctx, cast->operator_loc), &rights_comments); + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_start_line(ctx, cast->rest), &lefts_comments); + + comments_interleave(ctx, &cast->rights, &rights_comments); + comments_interleave(ctx, &cast->lefts, &lefts_comments); + } else { + pm_comments_list_t inner; + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_loc_start_line(ctx, cast->operator_loc), &inner); + comments_interleave(ctx, &cast->lefts, &inner); + } + + pm_comments_list_t gap_comments; + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &gap_comments); + + if (operator_comment != NULL || gap_comments.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_binary_comments_new(ctx, operator_comment, &gap_comments))); + } + break; + } + /* + * next # comment + */ + case PM_NEXT_NODE: { + pm_next_node_t *cast = (pm_next_node_t *) node; + comments_attach_keyword_comments(ctx, node, cast->arguments); + break; + } + /* + * def foo(a: # comment + * 1) end + */ + case PM_OPTIONAL_KEYWORD_PARAMETER_NODE: { + pm_optional_keyword_parameter_node_t *cast = (pm_optional_keyword_parameter_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->name_loc); + break; + } + /* + * def foo(a = # comment + * 1) end + */ + case PM_OPTIONAL_PARAMETER_NODE: { + pm_optional_parameter_node_t *cast = (pm_optional_parameter_node_t *) node; + comments_attach_write_comments(ctx, node, cast->value, cast->operator_loc); + break; + } + /* + * a || # comment + * b + */ + case PM_OR_NODE: { + pm_or_node_t *cast = (pm_or_node_t *) node; + + if (ctx->parser->start[cast->operator_loc.start] == 'o') { + comments_attach_logical_keyword_comments(ctx, node, cast->left, cast->right, cast->operator_loc); + } else { + comments_attach_binary_comments(ctx, node, cast->left, cast->right, cast->operator_loc); + } + break; + } + case PM_PARAMETERS_NODE: { + pm_parameters_node_t *cast = (pm_parameters_node_t *) node; + + if (cast->block != NULL) comments_visit(ctx, cast->block); + if (cast->keyword_rest != NULL) comments_visit(ctx, cast->keyword_rest); + comments_visit_reverse(ctx, &cast->keywords); + comments_visit_reverse(ctx, &cast->posts); + if (cast->rest != NULL) comments_visit(ctx, cast->rest); + comments_visit_reverse(ctx, &cast->optionals); + comments_visit_reverse(ctx, &cast->requireds); + + /* Interleave remaining gap comments into whichever parameter + * list they fall within. Build a list of all boundaries + * (parameter groups and singular params like rest/keyword_rest/block) + * in source order, then claim the range between each pair for + * the preceding group. */ + pm_node_list_t *group_lists[7]; + int32_t group_starts[7]; + size_t group_count = 0; + +#define PARAM_GROUP(list_ptr, start_line) do { group_lists[group_count] = (list_ptr); group_starts[group_count] = (start_line); group_count++; } while (0) + if (cast->requireds.size > 0) PARAM_GROUP(&cast->requireds, comments_node_start_line(ctx, cast->requireds.nodes[0])); + if (cast->optionals.size > 0) PARAM_GROUP(&cast->optionals, comments_node_start_line(ctx, cast->optionals.nodes[0])); + if (cast->rest != NULL) PARAM_GROUP(NULL, comments_node_start_line(ctx, cast->rest)); + if (cast->posts.size > 0) PARAM_GROUP(&cast->posts, comments_node_start_line(ctx, cast->posts.nodes[0])); + if (cast->keywords.size > 0) PARAM_GROUP(&cast->keywords, comments_node_start_line(ctx, cast->keywords.nodes[0])); + if (cast->keyword_rest != NULL) PARAM_GROUP(NULL, comments_node_start_line(ctx, cast->keyword_rest)); + if (cast->block != NULL) PARAM_GROUP(NULL, comments_node_start_line(ctx, cast->block)); +#undef PARAM_GROUP + + int32_t claim_start = comments_node_start_line(ctx, node); + for (size_t index = 0; index < group_count; index++) { + int32_t end = (index + 1 < group_count) ? group_starts[index + 1] : comments_node_end_line(ctx, node); + + if (group_lists[index] != NULL) { + pm_comments_list_t gap; + comments_claim_comments(ctx, claim_start, end, &gap); + comments_interleave(ctx, group_lists[index], &gap); + claim_start = end; + } + } + break; + } + /* + * (# comment + * foo + * ) + */ + case PM_PARENTHESES_NODE: { + pm_parentheses_node_t *cast = (pm_parentheses_node_t *) node; + const pm_comment_t *trailing_comment = comments_claim_comment(ctx, comments_node_end_line(ctx, node)); + + if (cast->body != NULL && PM_NODE_TYPE_P(cast->body, PM_STATEMENTS_NODE)) { + pm_statements_node_t *statements = (pm_statements_node_t *) cast->body; + comments_visit(ctx, cast->body); + + const pm_comment_t *opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->opening_loc)); + statements = comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), statements); + cast->body = PM_NODE_UPCAST(statements); + + if (opening_comment != NULL || trailing_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_body_comments_new(ctx, opening_comment, trailing_comment))); + } + } else if (cast->body != NULL) { + comments_visit(ctx, cast->body); + const pm_comment_t *opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->opening_loc)); + + pm_comments_list_t closing_gap_comments; + comments_claim_comments(ctx, comments_node_end_line(ctx, cast->body), comments_node_end_line(ctx, node), &closing_gap_comments); + + pm_comments_list_t opening_gap_comments; + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &opening_gap_comments); + + if (opening_comment != NULL || opening_gap_comments.size > 0 || closing_gap_comments.size > 0) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_parenthesized_comments_new(ctx, opening_comment, &opening_gap_comments, &closing_gap_comments))); + } + } else { + const pm_comment_t *opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->opening_loc)); + pm_statements_node_t *statements = comments_fold( + ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), NULL + ); + + if (statements != NULL) { + cast->body = PM_NODE_UPCAST(statements); + } + + if (opening_comment != NULL || trailing_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_body_comments_new(ctx, opening_comment, trailing_comment))); + } + } + break; + } + case PM_PINNED_EXPRESSION_NODE: { + pm_pinned_expression_node_t *cast = (pm_pinned_expression_node_t *) node; + comments_attach_parenthesized_comments(ctx, node, cast->expression, cast->lparen_loc); + break; + } + /* + * foo in ^ # comment + * a + */ + case PM_PINNED_VARIABLE_NODE: { + pm_pinned_variable_node_t *cast = (pm_pinned_variable_node_t *) node; + comments_attach_prefix_comments(ctx, node, cast->variable, cast->operator_loc); + break; + } + /* + * END { # comment + * foo + * } # comment + */ + case PM_POST_EXECUTION_NODE: { + pm_post_execution_node_t *cast = (pm_post_execution_node_t *) node; + comments_attach_body_comments_generic(ctx, node, cast->opening_loc, cast->closing_loc, (pm_statements_node_t **)&cast->statements); + break; + } + /* + * BEGIN { # comment + * foo + * } # comment + */ + case PM_PRE_EXECUTION_NODE: { + pm_pre_execution_node_t *cast = (pm_pre_execution_node_t *) node; + comments_attach_body_comments_generic(ctx, node, cast->opening_loc, cast->closing_loc, (pm_statements_node_t **)&cast->statements); + break; + } + case PM_PROGRAM_NODE: { + pm_program_node_t *cast = (pm_program_node_t *) node; + comments_visit(ctx, PM_NODE_UPCAST(cast->statements)); + cast->statements = comments_fold(ctx, ctx->min_line, ctx->max_line, cast->statements); + break; + } + /* + * a .. # comment + * b + */ + case PM_RANGE_NODE: { + pm_range_node_t *cast = (pm_range_node_t *) node; + comments_attach_range_comments(ctx, node, cast->left, cast->right, cast->operator_loc); + break; + } + /* + * foo rescue # comment + * bar + */ + case PM_RESCUE_MODIFIER_NODE: { + pm_rescue_modifier_node_t *cast = (pm_rescue_modifier_node_t *) node; + comments_attach_binary_comments(ctx, node, cast->expression, cast->rescue_expression, cast->keyword_loc); + break; + } + /* + * begin + * rescue # comment + * foo + * end + */ + case PM_RESCUE_NODE: { + pm_rescue_node_t *cast = (pm_rescue_node_t *) node; + + if (cast->subsequent != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->subsequent)); + if (cast->statements != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->statements)); + if (cast->reference != NULL) comments_visit(ctx, cast->reference); + comments_visit_reverse(ctx, &cast->exceptions); + + const pm_comment_t *opening = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->keyword_loc)); + cast->statements = comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), cast->statements); + + if (opening != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_clause_comments_new(ctx, opening))); + } + break; + } + /* + * def foo(* # comment + * a) end + */ + case PM_REST_PARAMETER_NODE: { + pm_rest_parameter_node_t *cast = (pm_rest_parameter_node_t *) node; + comments_attach_prefix_parameter_comments(ctx, node, cast->name, cast->operator_loc); + break; + } + /* + * return # comment + */ + case PM_RETURN_NODE: { + pm_return_node_t *cast = (pm_return_node_t *) node; + comments_attach_keyword_comments(ctx, node, cast->arguments); + break; + } + case PM_SHAREABLE_CONSTANT_NODE: { + pm_shareable_constant_node_t *cast = (pm_shareable_constant_node_t *) node; + comments_visit(ctx, cast->write); + break; + } + /* + * class << # comment + * self + * end # comment + */ + case PM_SINGLETON_CLASS_NODE: { + pm_singleton_class_node_t *cast = (pm_singleton_class_node_t *) node; + + const pm_comment_t *trailing_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->end_keyword_loc)); + if (cast->body != NULL) comments_visit(ctx, cast->body); + comments_visit(ctx, cast->expression); + const pm_comment_t *opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->operator_loc)); + + if (cast->body == NULL || PM_NODE_TYPE_P(cast->body, PM_STATEMENTS_NODE)) { + cast->body = (pm_node_t *) comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), (pm_statements_node_t *) cast->body); + } + + if (opening_comment != NULL || trailing_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_body_comments_new(ctx, opening_comment, trailing_comment))); + } + break; + } + /* + * * # comment + * a + */ + case PM_SPLAT_NODE: { + pm_splat_node_t *cast = (pm_splat_node_t *) node; + + if (cast->expression != NULL) { + comments_attach_prefix_comments(ctx, node, cast->expression, cast->operator_loc); + } else { + comments_attach_leaf_comments(ctx, node); + } + break; + } + case PM_STATEMENTS_NODE: { + pm_statements_node_t *cast = (pm_statements_node_t *) node; + comments_visit_reverse(ctx, &cast->body); + break; + } + /* + * super(# comment + * foo + * ) # comment + */ + case PM_SUPER_NODE: { + pm_super_node_t *cast = (pm_super_node_t *) node; + + if (cast->block != NULL && PM_NODE_TYPE_P(cast->block, PM_BLOCK_NODE)) { + comments_visit(ctx, cast->block); + } + + const pm_comment_t *rparen = NULL; + if (comments_loc_set(cast->rparen_loc)) + rparen = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->rparen_loc)); + + if (cast->arguments != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->arguments)); + if (cast->block != NULL && !PM_NODE_TYPE_P(cast->block, PM_BLOCK_NODE)) + comments_visit(ctx, cast->block); + + const pm_comment_t *lparen = NULL; + if (comments_loc_set(cast->lparen_loc)) + lparen = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->lparen_loc)); + + if (lparen != NULL || rparen != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_keyword_call_comments_new(ctx, lparen, rparen))); + } + break; + } + /* + * undef a, b + */ + case PM_UNDEF_NODE: { + pm_undef_node_t *cast = (pm_undef_node_t *) node; + comments_visit_reverse(ctx, &cast->names); + const pm_comment_t *keyword = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->keyword_loc)); + + pm_comments_list_t inner; + comments_claim_comments(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), &inner); + comments_interleave(ctx, &cast->names, &inner); + + if (keyword != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_leaf_comments_new(ctx, keyword))); + } + break; + } + /* + * unless a # comment + * b + * end # comment + */ + case PM_UNLESS_NODE: { + pm_unless_node_t *cast = (pm_unless_node_t *) node; + const pm_comment_t *trailing_comment = NULL; + + if (comments_loc_set(cast->end_keyword_loc)) { + trailing_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->end_keyword_loc)); + } + + if (cast->else_clause != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->else_clause)); + if (cast->statements != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->statements)); + comments_visit(ctx, cast->predicate); + + const pm_comment_t *opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->keyword_loc)); + cast->statements = comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), cast->statements); + + if (opening_comment != NULL || trailing_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_body_comments_new(ctx, opening_comment, trailing_comment))); + } + break; + } + /* + * until a # comment + * b + * end # comment + */ + case PM_UNTIL_NODE: { + pm_until_node_t *cast = (pm_until_node_t *) node; + const pm_comment_t *trailing_comment = NULL; + + if (comments_loc_set(cast->closing_loc)) { + trailing_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->closing_loc)); + } + if (cast->statements != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->statements)); + comments_visit(ctx, cast->predicate); + + const pm_comment_t *opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->keyword_loc)); + cast->statements = comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), cast->statements); + + if (opening_comment != NULL || trailing_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_body_comments_new(ctx, opening_comment, trailing_comment))); + } + break; + } + /* + * while a # comment + * b + * end # comment + */ + case PM_WHILE_NODE: { + pm_while_node_t *cast = (pm_while_node_t *) node; + const pm_comment_t *trailing_comment = NULL; + + if (comments_loc_set(cast->closing_loc)) { + trailing_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->closing_loc)); + } + if (cast->statements != NULL) comments_visit(ctx, PM_NODE_UPCAST(cast->statements)); + comments_visit(ctx, cast->predicate); + + const pm_comment_t *opening_comment = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->keyword_loc)); + cast->statements = comments_fold(ctx, comments_node_start_line(ctx, node), comments_node_end_line(ctx, node), cast->statements); + + if (opening_comment != NULL || trailing_comment != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_body_comments_new(ctx, opening_comment, trailing_comment))); + } + break; + } + /* + * yield( # comment + * foo + * ) # comment + */ + case PM_YIELD_NODE: { + pm_yield_node_t *cast = (pm_yield_node_t *) node; + + if (cast->arguments != NULL) { + const pm_comment_t *rparen = NULL; + if (comments_loc_set(cast->rparen_loc)) + rparen = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->rparen_loc)); + + comments_visit(ctx, PM_NODE_UPCAST(cast->arguments)); + + const pm_comment_t *lparen = NULL; + if (comments_loc_set(cast->lparen_loc)) + lparen = comments_claim_comment(ctx, comments_loc_start_line(ctx, cast->lparen_loc)); + + if (lparen != NULL || rparen != NULL) { + comments_store(ctx, node->node_id, PM_COMMENTS_UPCAST(pm_keyword_call_comments_new(ctx, lparen, rparen))); + } + } else { + comments_attach_leaf_comments(ctx, node); + } + break; + } + } +} + +/** + * After parsing, traverse the AST and attach each comment to the most + * appropriate node based on its position in the source. + * + * 1. Build a map of comments keyed by their start line + * 2. Walk the AST, visiting children in reverse order (right-to-left) + * 3. At each node, claim comments from the map based on line positions + * 4. Insert CommentNode instances into node lists where appropriate + */ +void +pm_attach_comments(pm_parser_t *parser, pm_node_t *root) { + /* Allocate the comments map from the metadata arena. */ + pm_comments_map_t *map = pm_arena_alloc(&parser->metadata_arena, sizeof(pm_comments_map_t), PRISM_ALIGNOF(pm_comments_map_t)); + map->size = parser->node_id; + map->entries = pm_arena_zalloc(&parser->metadata_arena, map->size * sizeof(const pm_comments_t *), PRISM_ALIGNOF(pm_comments_t *)); + parser->comments_map = map; + + /* If there are no comments, then the empty map is enough. */ + if (parser->comment_list.head == NULL) return; + + /* Determine the range of lines that could have comments. */ + int32_t min_line = INT32_MAX; + int32_t max_line = INT32_MIN; + + for (pm_list_node_t *list_node = parser->comment_list.head; list_node != NULL; list_node = list_node->next) { + const pm_comment_t *comment = (const pm_comment_t *) list_node; + + int32_t line = pm_line_offset_list_line(&parser->line_offsets, comment->location.start, parser->start_line); + if (line < min_line) min_line = line; + if (line > max_line) max_line = line; + } + + assert(min_line <= max_line); + + /* Build a context object and fill in the comments per line list. */ + const pm_comment_t **comments = xcalloc((size_t) (max_line - min_line + 1), sizeof(pm_comment_t *)); + pm_comments_context_t ctx = { + .parser = parser, + .map = map, + .comments = comments, + .min_line = min_line, + .max_line = max_line + }; + + for (pm_list_node_t *list_node = parser->comment_list.head; list_node != NULL; list_node = list_node->next) { + const pm_comment_t *comment = (const pm_comment_t *) list_node; + + int32_t line = pm_line_offset_list_line(&parser->line_offsets, comment->location.start, parser->start_line); + ctx.comments[line - min_line] = comment; + } + + /* Walk the AST and attach comments to nodes. */ + comments_visit(&ctx, root); + xfree(comments); +} diff --git a/src/options.c b/src/options.c index b589865a2a..5578f28eef 100644 --- a/src/options.c +++ b/src/options.c @@ -243,6 +243,22 @@ pm_options_freeze_set(pm_options_t *options, bool freeze) { options->freeze = freeze; } +/** + * Return the attach_comments option on the given options struct. + */ +bool +pm_options_attach_comments(const pm_options_t *options) { + return options->attach_comments; +} + +/** + * Set the attach_comments option on the given options struct. + */ +void +pm_options_attach_comments_set(pm_options_t *options, bool attach_comments) { + options->attach_comments = attach_comments; +} + // For some reason, GCC analyzer thinks we're leaking allocated scopes and // locals here, even though we definitely aren't. This is a false positive. // Ideally we wouldn't need to suppress this. @@ -387,6 +403,7 @@ pm_options_read(pm_options_t *options, const char *data) { options->main_script = ((uint8_t) *data++) > 0; options->partial_script = ((uint8_t) *data++) > 0; options->freeze = ((uint8_t) *data++) > 0; + options->attach_comments = ((uint8_t) *data++) > 0; uint32_t scopes_count = pm_options_read_u32(data); data += 4; diff --git a/src/prism.c b/src/prism.c index 72c49da6f2..b16cfde2bb 100644 --- a/src/prism.c +++ b/src/prism.c @@ -22372,6 +22372,7 @@ pm_parser_init(pm_arena_t *arena, pm_parser_t *parser, const uint8_t *source, si .command_line = 0, .parsing_eval = false, .partial_script = false, + .attach_comments = false, .command_start = true, .recovering = false, .continuable = true, @@ -22437,6 +22438,9 @@ pm_parser_init(pm_arena_t *arena, pm_parser_t *parser, const uint8_t *source, si // partial_script parser->partial_script = options->partial_script; + // attach_comments + parser->attach_comments = options->attach_comments; + // scopes option parser->parsing_eval = options->scopes_count > 0; if (parser->parsing_eval) parser->warn_mismatched_indentation = false; @@ -22619,6 +22623,16 @@ pm_parser_cleanup(pm_parser_t *parser) { } } +/** + * Returns the comment attachment data for the given node_id. + */ +const pm_comments_t * +pm_parser_comments(const pm_parser_t *parser, uint32_t node_id) { + const pm_comments_map_t *map = parser->comments_map; + if (map == NULL || node_id >= map->size) return NULL; + return map->entries[node_id]; +} + /** * Free both the memory held by the given parser and the parser itself. */ @@ -22797,6 +22811,11 @@ pm_node_t * pm_parse(pm_parser_t *parser) { pm_node_t *node = parse_program(parser); pm_parse_continuable(parser); + + if (parser->attach_comments) { + pm_attach_comments(parser, node); + } + return node; } diff --git a/templates/ext/prism/api_node.c.erb b/templates/ext/prism/api_node.c.erb index 41d7165930..d8e3669c39 100644 --- a/templates/ext/prism/api_node.c.erb +++ b/templates/ext/prism/api_node.c.erb @@ -148,6 +148,78 @@ pm_ast_constants_each(const pm_constant_t *constant, void *data) { rb_ary_push(constants_data->constants, value); } +// --------------------------------------------------------------------------- +// Comment attachment application +// --------------------------------------------------------------------------- + +#include "prism/comments.h" + +static VALUE +pm_comments_make_ruby_comment(const pm_comment_t *comment, VALUE source, bool freeze) { + if (comment == NULL) return Qnil; + extern VALUE rb_cPrismInlineComment; + extern VALUE rb_cPrismEmbDocComment; + VALUE location_argv[] = { source, LONG2FIX(pm_comment_location(comment).start), LONG2FIX(pm_comment_location(comment).length) }; + VALUE loc = rb_class_new_instance(3, location_argv, rb_cPrismLocation); + if (freeze) rb_obj_freeze(loc); + VALUE argv[] = { loc }; + VALUE comment_class = (pm_comment_type(comment) == PM_COMMENT_EMBDOC) ? rb_cPrismEmbDocComment : rb_cPrismInlineComment; + VALUE val = rb_class_new_instance(1, argv, comment_class); + if (freeze) rb_obj_freeze(val); + return val; +} + +static VALUE +pm_comments_make_ruby_comment_list(const pm_comment_t **comments, size_t size, VALUE source, bool freeze) { + VALUE ary = rb_ary_new_capa(size); + for (size_t i = 0; i < size; i++) { + rb_ary_push(ary, pm_comments_make_ruby_comment(comments[i], source, freeze)); + } + if (freeze) rb_obj_freeze(ary); + return ary; +} + +#define RC(c) pm_comments_make_ruby_comment((c), source, freeze) +#define RL(l) pm_comments_make_ruby_comment_list((l).comments, (l).size, source, freeze) + +static VALUE +pm_comments_get_comments(const pm_parser_t *parser, uint32_t node_id, VALUE source, bool freeze) { + const pm_comments_t *c = pm_parser_comments(parser, node_id); + if (c == NULL) return Qnil; + + // Cache the Comments module (initialized once). + static VALUE rb_mComments = Qundef; + if (rb_mComments == Qundef) { + rb_mComments = rb_const_get(rb_cPrism, rb_intern("Comments")); + rb_gc_register_address(&rb_mComments); + } + + VALUE klass; + VALUE argv[5]; + int argc; + + switch (c->type) { + <%- comments.each do |comment| -%> + case PM_COMMENTS_<%= comment.enum_name %>: { + const <%= comment.c_type %> *t = (const <%= comment.c_type %> *) c; + klass = rb_const_get(rb_mComments, rb_intern("<%= comment.name %>")); + <%- comment.fields.each_with_index do |field, index| -%> + argv[<%= index %>] = <%= field.list? ? "RL" : "RC" %>(t-><%= field.name %>); + <%- end -%> + argc = <%= comment.fields.length %>; + break; + } + <%- end -%> + default: + return Qnil; + } + + return rb_class_new_instance(argc, argv, klass); +} + +#undef RC +#undef RL + VALUE pm_ast_new(const pm_parser_t *parser, const pm_node_t *node, rb_encoding *encoding, VALUE source, bool freeze) { VALUE constants = rb_ary_new_capa(pm_parser_constants_size(parser)); @@ -190,6 +262,9 @@ pm_ast_new(const pm_parser_t *parser, const pm_node_t *node, rb_encoding *encodi } <%- end -%> <%- end -%> + case PM_COMMENT_NODE: + // CommentNode has no children to push + break; default: break; } @@ -204,7 +279,7 @@ pm_ast_new(const pm_parser_t *parser, const pm_node_t *node, rb_encoding *encodi <%- if node.fields.any? { |field| ![Prism::Template::NodeField, Prism::Template::OptionalNodeField].include?(field.class) } -%> pm_<%= node.human %>_t *cast = (pm_<%= node.human %>_t *) node; <%- end -%> - VALUE argv[<%= node.fields.length + 4 %>]; + VALUE argv[<%= node.fields.length + 5 %>]; // source argv[0] = source; @@ -217,7 +292,10 @@ pm_ast_new(const pm_parser_t *parser, const pm_node_t *node, rb_encoding *encodi // flags argv[3] = ULONG2NUM(node->flags); - <%- node.fields.each.with_index(4) do |field, index| -%> + + // comments + argv[4] = pm_comments_get_comments(parser, node->node_id, source, freeze); + <%- node.fields.each.with_index(5) do |field, index| -%> // <%= field.name %> <%- case field -%> @@ -271,13 +349,29 @@ pm_ast_new(const pm_parser_t *parser, const pm_node_t *node, rb_encoding *encodi <%- end -%> <%- end -%> - VALUE value = rb_class_new_instance(<%= node.fields.length + 4 %>, argv, rb_cPrism<%= node.name %>); + VALUE value = rb_class_new_instance(<%= node.fields.length + 5 %>, argv, rb_cPrism<%= node.name %>); if (freeze) rb_obj_freeze(value); rb_ary_push(value_stack, value); break; } <%- end -%> + case PM_COMMENT_NODE: { + // CommentNode is materialized as an InlineComment or + // EmbDocComment in Ruby depending on the flags. + extern VALUE rb_cPrismInlineComment; + extern VALUE rb_cPrismEmbDocComment; + extern VALUE rb_cPrismLocation; + VALUE location_argv[] = { source, LONG2FIX(node->location.start), LONG2FIX(node->location.length) }; + VALUE loc = rb_class_new_instance(3, location_argv, rb_cPrismLocation); + if (freeze) rb_obj_freeze(loc); + VALUE argv[] = { loc }; + VALUE comment_class = (node->flags & PM_COMMENT_NODE_FLAG_EMBDOC) ? rb_cPrismEmbDocComment : rb_cPrismInlineComment; + VALUE value = rb_class_new_instance(1, argv, comment_class); + if (freeze) rb_obj_freeze(value); + rb_ary_push(value_stack, value); + break; + } default: rb_raise(rb_eRuntimeError, "unknown node type: %d", PM_NODE_TYPE(node)); } diff --git a/templates/include/prism/ast.h.erb b/templates/include/prism/ast.h.erb index 3b3be25e76..b390719a46 100644 --- a/templates/include/prism/ast.h.erb +++ b/templates/include/prism/ast.h.erb @@ -98,7 +98,10 @@ enum pm_node_type { <%- end -%> /** A special kind of node used for compilation. */ - PM_SCOPE_NODE + PM_SCOPE_NODE, + + /** A special kind of node used for comment attachment. */ + PM_COMMENT_NODE }; /** diff --git a/templates/include/prism/comments.h.erb b/templates/include/prism/comments.h.erb new file mode 100644 index 0000000000..3c88b959e6 --- /dev/null +++ b/templates/include/prism/comments.h.erb @@ -0,0 +1,99 @@ +/** + * @file comments.h + * + * Types and functions related to comments found during parsing. + */ +#ifndef PRISM_COMMENTS_H +#define PRISM_COMMENTS_H + +#include "prism/compiler/exported.h" +#include "prism/compiler/nodiscard.h" +#include "prism/compiler/nonnull.h" + +#include "prism/ast.h" + +#include + +/** This is the type of a comment that we've found while parsing. */ +typedef enum { + PM_COMMENT_INLINE, + PM_COMMENT_EMBDOC +} pm_comment_type_t; + +/** An opaque pointer to a comment found while parsing. */ +typedef struct pm_comment_t pm_comment_t; + +/** + * Returns the location associated with the given comment. + * + * @param comment the comment whose location we want to get + * @returns the location associated with the given comment + */ +PRISM_EXPORTED_FUNCTION pm_location_t pm_comment_location(const pm_comment_t *comment) PRISM_NONNULL(1); + +/** + * Returns the type associated with the given comment. + * + * @param comment the comment whose type we want to get + * @returns the type associated with the given comment. This can either be + * PM_COMMENT_INLINE or PM_COMMENT_EMBDOC. + */ +PRISM_EXPORTED_FUNCTION pm_comment_type_t pm_comment_type(const pm_comment_t *comment) PRISM_NONNULL(1); + +/** + * Flag bit on PM_COMMENT_NODE to distinguish embdoc from inline comments. + */ +#define PM_COMMENT_NODE_FLAG_EMBDOC 0x4 + +/** + * The type of comment attachment on a node. + */ +typedef enum { + PM_COMMENTS_NONE = 0, +<%- comments.each do |comment| -%> + PM_COMMENTS_<%= comment.enum_name %>, +<%- end -%> +} pm_comments_type_t; + +/** + * A list of comment pointers. + */ +typedef struct { + /** The array of comment pointers. */ + const pm_comment_t **comments; + + /** The number of comments in the list. */ + size_t size; +} pm_comments_list_t; + +/** + * Base type for comment attachment data on a node. Cast to the specific type + * based on the `type` field. + */ +typedef struct { + /** The type of comment attachment. */ + pm_comments_type_t type; +} pm_comments_t; + +<%- comments.each do |comment| -%> +/** +<%- comment.each_comment_line do |line| -%> + *<%= line %> +<%- end -%> + */ +typedef struct { + /** The base comment attachment data. */ + pm_comments_t base; +<%- comment.fields.each do |field| -%> + + /** <%= field.comment %> */ +<%- if field.list? -%> + pm_comments_list_t <%= field.name %>; +<%- else -%> + const pm_comment_t *<%= field.name %>; +<%- end -%> +<%- end -%> +} <%= comment.c_type %>; + +<%- end -%> +#endif diff --git a/templates/java/api/src/main/java-templates/org/ruby_lang/prism/Loader.java.erb b/templates/java/api/src/main/java-templates/org/ruby_lang/prism/Loader.java.erb index f1785e5d30..3edd81d2b1 100644 --- a/templates/java/api/src/main/java-templates/org/ruby_lang/prism/Loader.java.erb +++ b/templates/java/api/src/main/java-templates/org/ruby_lang/prism/Loader.java.erb @@ -102,6 +102,9 @@ public class Loader { ParseResult.Warning[] warnings = loadWarnings(); boolean continuable = buffer.get() != 0; + // Skip the attached comments map (always empty for Java). + loadVarUInt(); + int constantPoolBufferOffset = buffer.getInt(); int constantPoolLength = loadVarUInt(); this.constantPool = new ConstantPool(this, constantPoolBufferOffset, constantPoolLength); diff --git a/templates/javascript/src/deserialize.js.erb b/templates/javascript/src/deserialize.js.erb index 34ff1574da..b9bcfd20a2 100644 --- a/templates/javascript/src/deserialize.js.erb +++ b/templates/javascript/src/deserialize.js.erb @@ -336,6 +336,9 @@ export function deserialize(array) { const continuable = buffer.readByte() !== 0; + // Skip the attached comments map (always empty for JavaScript). + buffer.readVarInt(); + const constantPoolOffset = buffer.readUint32(); const constants = Array.from({ length: buffer.readVarInt() }, () => null); diff --git a/templates/lib/prism/comments.rb.erb b/templates/lib/prism/comments.rb.erb new file mode 100644 index 0000000000..f0d2c63ffd --- /dev/null +++ b/templates/lib/prism/comments.rb.erb @@ -0,0 +1,33 @@ +#-- +# rbs_inline: enabled + +module Prism + # The module containing definitions of all of the various comment attachment + # objects. + module Comments + # The base class for all comment attachment types. + class Base + end +<%- comments.each do |comment| -%> + +<%- comment.each_comment_line do |line| -%> + #<%= line %> +<%- end -%> + class <%= comment.name %> < Base +<%- comment.fields.each do |field| -%> +<%- field.each_comment_line do |line| -%> + #<%= line %> +<%- end -%> + attr_reader :<%= field.name %> #: <%= field.list? ? "Array[Comment]" : "Comment?" %> + +<%- end -%> + #: (<%= comment.fields.map { |f| "#{f.list? ? "Array[Comment]" : "Comment?"} #{f.name}" }.join(", ") %>) -> void + def initialize(<%= comment.fields.map(&:name).join(", ") %>) +<%- comment.fields.each do |field| -%> + @<%= field.name %> = <%= field.name %> +<%- end -%> + end + end +<%- end -%> + end +end diff --git a/templates/lib/prism/dsl.rb.erb b/templates/lib/prism/dsl.rb.erb index be7dc6d9c1..07c2644806 100644 --- a/templates/lib/prism/dsl.rb.erb +++ b/templates/lib/prism/dsl.rb.erb @@ -111,7 +111,7 @@ module Prism raise end }].join(", ") %>) - <%= node.name %>.new(<%= ["source", "node_id", "location", "flags", *node.fields.map(&:name)].join(", ") %>) + <%= node.name %>.new(<%= ["source", "node_id", "location", "flags", "nil", *node.fields.map(&:name)].join(", ") %>) end <%- end -%> <%- flags.each do |flag| -%> @@ -152,7 +152,7 @@ module Prism #-- #: (Source source, Location location) -> node def default_node(source, location) - ErrorRecoveryNode.new(source, -1, location, 0, nil) + ErrorRecoveryNode.new(source, -1, location, 0, nil, nil) end private diff --git a/templates/lib/prism/node.rb.erb b/templates/lib/prism/node.rb.erb index fb13051aba..4b94b7c7a8 100644 --- a/templates/lib/prism/node.rb.erb +++ b/templates/lib/prism/node.rb.erb @@ -29,6 +29,10 @@ module Prism # will be consistent across multiple parses of the same source code. attr_reader :node_id #: Integer + # The comments attached to this node, or nil if comment attachment was + # not requested during parsing. + attr_reader :comments #: Comments::Base? + # The location associated with this node. For lazily loading Location # objects, we keep it as a packed integer until it is accessed. # @rbs @location: Location | Integer @@ -170,27 +174,6 @@ module Prism location.cached_end_code_units_column(cache) end - # Delegates to [`leading_comments`](rdoc-ref:Location#leading_comments) of the associated location object. - #-- - #: () -> Array[Comment] - def leading_comments - location.leading_comments - end - - # Delegates to [`trailing_comments`](rdoc-ref:Location#trailing_comments) of the associated location object. - #-- - #: () -> Array[Comment] - def trailing_comments - location.trailing_comments - end - - # Delegates to [`comments`](rdoc-ref:Location#comments) of the associated location object. - #-- - #: () -> Array[Comment] - def comments - location.comments - end - # :section: # Returns all of the lines of the source code associated with this node. @@ -380,14 +363,6 @@ module Prism raise NoMethodError, "undefined method `compact_child_nodes' for #{inspect}" end - # Returns an array of child nodes and locations that could potentially have - # comments attached to them. - #-- - #: () -> Array[node | Location] - def comment_targets - raise NoMethodError, "undefined method `comment_targets' for #{inspect}" - end - # Returns a string representation of the node. #-- #: () -> String @@ -435,12 +410,13 @@ module Prism # Initialize a new <%= node.name %> node. #-- - #: (Source source, Integer node_id, Location location, Integer flags, <%= node.fields.map { |field| "#{field.rbs_class} #{field.name}" }.join(", ") %>) -> void - def initialize(<%= ["source", "node_id", "location", "flags", *node.fields.map(&:name)].join(", ") %>) + #: (Source source, Integer node_id, Location location, Integer flags, Comments::Base? comments, <%= node.fields.map { |field| "#{field.rbs_class} #{field.name}" }.join(", ") %>) -> void + def initialize(<%= ["source", "node_id", "location", "flags", "comments", *node.fields.map(&:name)].join(", ") %>) @source = source @node_id = node_id @location = location @flags = flags + @comments = comments <%- node.fields.each do |field| -%> <%- if Prism::Template::CHECK_FIELD_KIND && field.respond_to?(:check_field_kind) -%> raise "<%= node.name %>#<%= field.name %> was of unexpected type:\n#{<%= field.name %>.inspect}" unless <%= field.check_field_kind %> @@ -525,26 +501,14 @@ module Prism <%- end -%> end - # See Node.comment_targets. - #-- - #: () -> Array[node | Location] - def comment_targets - [<%= node.fields.map { |field| - case field - when Prism::Template::NodeField, Prism::Template::LocationField then field.name - when Prism::Template::OptionalNodeField, Prism::Template::NodeListField, Prism::Template::OptionalLocationField then "*#{field.name}" - end - }.compact.join(", ") %>] #: Array[Prism::node | Location] - end - # :call-seq: # copy(**fields) -> <%= node.name %> # # Creates a copy of self with the given fields, using self as the template. #-- - #: (?node_id: Integer, ?location: Location, ?flags: Integer, <%= node.fields.map { |field| "?#{field.name}: #{field.rbs_class}" }.join(", ") %>) -> <%= node.name %> - def copy(<%= (["node_id", "location", "flags"] + node.fields.map(&:name)).map { |field| "#{field}: self.#{field}" }.join(", ") %>) - <%= node.name %>.new(<%= ["source", "node_id", "location", "flags", *node.fields.map(&:name)].join(", ") %>) + #: (?node_id: Integer, ?location: Location, ?flags: Integer, ?comments: Comments::Base?, <%= node.fields.map { |field| "?#{field.name}: #{field.rbs_class}" }.join(", ") %>) -> <%= node.name %> + def copy(<%= (["node_id", "location", "flags", "comments"] + node.fields.map(&:name)).map { |field| "#{field}: self.#{field}" }.join(", ") %>) + <%= node.name %>.new(<%= ["source", "node_id", "location", "flags", "comments", *node.fields.map(&:name)].join(", ") %>) end alias deconstruct child_nodes diff --git a/templates/lib/prism/serialize.rb.erb b/templates/lib/prism/serialize.rb.erb index a676f957af..d7ccc88a23 100644 --- a/templates/lib/prism/serialize.rb.erb +++ b/templates/lib/prism/serialize.rb.erb @@ -30,26 +30,27 @@ module Prism source = Source.for(input, 1, []) loader = Loader.new(source, serialized) - loader.load_header - encoding = loader.load_encoding - start_line = loader.load_varsint - offsets = loader.load_line_offsets(freeze) + loader.load_header + encoding = loader.load_encoding + start_line = loader.load_varsint + offsets = loader.load_line_offsets(freeze) source.replace_start_line(start_line) source.replace_offsets(offsets) - comments = loader.load_comments(freeze) - magic_comments = loader.load_magic_comments(freeze) - data_loc = loader.load_optional_location_object(freeze) - errors = loader.load_errors(encoding, freeze) - warnings = loader.load_warnings(encoding, freeze) - continuable = loader.load_bool - cpool_base = loader.load_uint32 - cpool_size = loader.load_varuint + comments = loader.load_comments(freeze) + magic_comments = loader.load_magic_comments(freeze) + data_loc = loader.load_optional_location_object(freeze) + errors = loader.load_errors(encoding, freeze) + warnings = loader.load_warnings(encoding, freeze) + continuable = loader.load_bool + attached_comments = loader.load_attached_comments(comments, freeze) + cpool_base = loader.load_uint32 + cpool_size = loader.load_varuint constant_pool = ConstantPool.new(serialized, cpool_base, cpool_size) - node = loader.load_node(constant_pool, encoding, freeze) #: ProgramNode + node = loader.load_node(constant_pool, encoding, freeze, attached_comments) #: ProgramNode loader.load_constant_pool(constant_pool) raise unless loader.eof? @@ -156,29 +157,30 @@ module Prism source = Source.for(input, 1, []) loader = Loader.new(source, serialized) - tokens = loader.load_tokens - loader.load_header - encoding = loader.load_encoding - start_line = loader.load_varsint - offsets = loader.load_line_offsets(freeze) + tokens = loader.load_tokens + loader.load_header + encoding = loader.load_encoding + start_line = loader.load_varsint + offsets = loader.load_line_offsets(freeze) source.replace_start_line(start_line) source.replace_offsets(offsets) - comments = loader.load_comments(freeze) - magic_comments = loader.load_magic_comments(freeze) - data_loc = loader.load_optional_location_object(freeze) - errors = loader.load_errors(encoding, freeze) - warnings = loader.load_warnings(encoding, freeze) - continuable = loader.load_bool - cpool_base = loader.load_uint32 - cpool_size = loader.load_varuint + comments = loader.load_comments(freeze) + magic_comments = loader.load_magic_comments(freeze) + data_loc = loader.load_optional_location_object(freeze) + errors = loader.load_errors(encoding, freeze) + warnings = loader.load_warnings(encoding, freeze) + continuable = loader.load_bool + attached_comments = loader.load_attached_comments(comments, freeze) + cpool_base = loader.load_uint32 + cpool_size = loader.load_varuint constant_pool = ConstantPool.new(serialized, cpool_base, cpool_size) - node = loader.load_node(constant_pool, encoding, freeze) #: ProgramNode - loader.load_constant_pool(constant_pool) - raise unless loader.eof? + node = loader.load_node(constant_pool, encoding, freeze, attached_comments) #: ProgramNode + loader.load_constant_pool(constant_pool) + raise unless loader.eof? value = [node, tokens] #: [ProgramNode, Array[[Token, Integer]]] result = ParseLexResult.new(value, comments, magic_comments, data_loc, errors, warnings, continuable, source) @@ -281,7 +283,41 @@ module Prism io.eof? end - #: (ConstantPool constant_pool) -> void + #: (Array[Comment] comments, bool freeze) -> Hash[Integer, Comments::Base]? + def load_attached_comments(comments, freeze) + count = load_varuint + return nil if count == 0 + + comment_lookup = {} #: Hash[Integer, Comment] + comments.each { |c| comment_lookup[c.location.start_offset] = c } + + load_comment = -> { + if io.getbyte == 1 + comment_lookup[load_varuint] + end + } + + load_comment_list = -> { + Array.new(load_varuint) { comment_lookup[load_varuint] }.tap { |a| a.freeze if freeze } + } + + comments_by_node_id = {} #: Hash[Integer, Comments::Base] + count.times do + node_id = load_varuint + type = io.getbyte + + obj = case type + <%- comments.each_with_index do |comment, index| -%> + when <%= index + 1 %> then Comments::<%= comment.name %>.new(<%= comment.fields.map { |f| f.list? ? "load_comment_list.call" : "load_comment.call" }.join(", ") %>) + <%- end -%> + end + + comments_by_node_id[node_id] = obj if obj + end + + comments_by_node_id + end + def load_constant_pool(constant_pool) trailer = 0 @@ -500,11 +536,11 @@ module Prism (io.read(4) or raise).unpack1("L") #: Integer end - #: (ConstantPool constant_pool, Encoding encoding, bool freeze) -> node? - def load_optional_node(constant_pool, encoding, freeze) + #: (ConstantPool constant_pool, Encoding encoding, bool freeze, ?Hash[Integer, Comments::Base]? comments) -> (node | Comment)? + def load_optional_node(constant_pool, encoding, freeze, comments = nil) if io.getbyte != 0 io.pos -= 1 - load_node(constant_pool, encoding, freeze) + load_node(constant_pool, encoding, freeze, comments) end end @@ -530,6 +566,12 @@ module Prism (load_varuint << 32) | load_varuint #: Location end + def load_location_object_from_packed(packed) + start_offset = packed >> 32 + length = packed & 0xFFFFFFFF + Location.new(source, start_offset, length) + end + # Load an optional location object from the serialized data if it is # present. Note that we are lying about the signature a bit here, because # we sometimes load it as a packed integer instead of an object. @@ -557,8 +599,8 @@ module Prism end if RUBY_ENGINE == "ruby" - #: (ConstantPool constant_pool, Encoding encoding, bool freeze) -> node - def load_node(constant_pool, encoding, freeze) + #: (ConstantPool constant_pool, Encoding encoding, bool freeze, Hash[Integer, Comments::Base]? comments) -> (node | Comment) + def load_node(constant_pool, encoding, freeze, comments = nil) type = io.getbyte node_id = load_varuint location = load_location(freeze) #: Location @@ -574,17 +616,18 @@ module Prism node_id, location, load_varuint, + comments&.[](node_id), <%- node.fields.each do |field| -%> <%- case field -%> <%- when Prism::Template::NodeField -%> - load_node(constant_pool, encoding, freeze), #: <%= field.rbs_class %> + load_node(constant_pool, encoding, freeze, comments), #: <%= field.rbs_class %> <%- when Prism::Template::OptionalNodeField -%> - load_optional_node(constant_pool, encoding, freeze), #: <%= field.rbs_class %> + load_optional_node(constant_pool, encoding, freeze, comments), #: <%= field.rbs_class %> <%- when Prism::Template::StringField -%> load_string(encoding), <%- when Prism::Template::NodeListField -%> Array.new(load_varuint) do - load_node(constant_pool, encoding, freeze) #: <%= field.element_rbs_class %> + load_node(constant_pool, encoding, freeze, comments) #: <%= field.element_rbs_class %> end.tap { |nodes| nodes.freeze if freeze }, <%- when Prism::Template::ConstantField -%> load_constant(constant_pool, encoding), @@ -609,6 +652,11 @@ module Prism <%- end -%> ) <%- end -%> + when <%= nodes.length + 2 %> + flags = load_varuint + comment_class = (flags & 0x4 != 0) ? EmbDocComment : InlineComment + loc = location.is_a?(Integer) ? load_location_object_from_packed(location) : location + comment_class.new(loc) # steep:ignore else raise "Unknown node type: #{type}" end @@ -618,8 +666,8 @@ module Prism end else # @rbs skip - def load_node(constant_pool, encoding, freeze) - @load_node_lambdas[(io.getbyte or raise)].call(constant_pool, encoding, freeze) + def load_node(constant_pool, encoding, freeze, comments = nil) + @load_node_lambdas[(io.getbyte or raise)].call(constant_pool, encoding, freeze, comments) end # @rbs skip @@ -627,7 +675,7 @@ module Prism @load_node_lambdas = [ nil, <%- nodes.each do |node| -%> - -> (constant_pool, encoding, freeze) { + -> (constant_pool, encoding, freeze, comments) { node_id = load_varuint location = load_location(freeze) <%- if node.needs_serialized_length? -%> @@ -639,17 +687,18 @@ module Prism node_id, location, load_varuint, + comments&.[](node_id), <%- node.fields.map do |field| -%> <%- case field -%> <%- when Prism::Template::NodeField -%> - load_node(constant_pool, encoding, freeze), #: <%= field.rbs_class %> + load_node(constant_pool, encoding, freeze, comments), #: <%= field.rbs_class %> <%- when Prism::Template::OptionalNodeField -%> - load_optional_node(constant_pool, encoding, freeze), #: <%= field.rbs_class %> + load_optional_node(constant_pool, encoding, freeze, comments), #: <%= field.rbs_class %> <%- when Prism::Template::StringField -%> load_string(encoding), <%- when Prism::Template::NodeListField -%> Array.new(load_varuint) do - load_node(constant_pool, encoding, freeze) #: <%= field.element_rbs_class %> + load_node(constant_pool, encoding, freeze, comments) #: <%= field.element_rbs_class %> end, <%- when Prism::Template::ConstantField -%> load_constant(constant_pool, encoding), @@ -677,6 +726,17 @@ module Prism value }, <%- end -%> + nil, # PM_SCOPE_NODE + -> (constant_pool, encoding, freeze, comments) { + load_varuint # node_id (unused) + location = load_location(freeze) + flags = load_varuint + comment_class = (flags & 0x4 != 0) ? EmbDocComment : InlineComment + loc = location.is_a?(Integer) ? load_location_object_from_packed(location) : location + value = comment_class.new(loc) # steep:ignore + value.freeze if freeze + value + }, ] end end diff --git a/templates/src/json.c.erb b/templates/src/json.c.erb index 5c4ab8d92a..39daec0905 100644 --- a/templates/src/json.c.erb +++ b/templates/src/json.c.erb @@ -123,6 +123,7 @@ pm_dump_json(pm_buffer_t *buffer, const pm_parser_t *parser, const pm_node_t *no } <%- end -%> case PM_SCOPE_NODE: + case PM_COMMENT_NODE: break; } } diff --git a/templates/src/node.c.erb b/templates/src/node.c.erb index f51aff6e53..29450f637e 100644 --- a/templates/src/node.c.erb +++ b/templates/src/node.c.erb @@ -141,6 +141,7 @@ pm_visit_child_nodes(const pm_node_t *node, bool (*visitor)(const pm_node_t *nod <%- end -%> <%- end -%> case PM_SCOPE_NODE: + case PM_COMMENT_NODE: break; } } diff --git a/templates/src/prettyprint.c.erb b/templates/src/prettyprint.c.erb index f12531d934..45789d98a5 100644 --- a/templates/src/prettyprint.c.erb +++ b/templates/src/prettyprint.c.erb @@ -38,7 +38,8 @@ static void prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm_node_t *node, pm_buffer_t *prefix_buffer) { switch (PM_NODE_TYPE(node)) { case PM_SCOPE_NODE: - // We do not need to print a ScopeNode as it's not part of the AST. + case PM_COMMENT_NODE: + // We do not need to print these as they're not standard AST nodes. return; <%- nodes.each do |node| -%> case <%= node.type %>: { diff --git a/templates/src/serialize.c.erb b/templates/src/serialize.c.erb index 3d9811e5db..aa1b094670 100644 --- a/templates/src/serialize.c.erb +++ b/templates/src/serialize.c.erb @@ -83,6 +83,9 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) { // it is not part of the AST case PM_SCOPE_NODE: return; + case PM_COMMENT_NODE: + pm_buffer_append_varuint(buffer, node->flags); + return; <%- nodes.each do |node| -%> case <%= node.type %>: { <%- if node.needs_serialized_length? -%> @@ -279,9 +282,59 @@ void pm_serialize_content(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) { pm_serialize_metadata(parser, buffer); - // Here we're going to leave space for the offset of the constant pool in - // the buffer. - size_t offset = buffer->length; + // Serialize the comments map before the nodes so the deserializer can + // read it first and pass comments into node constructors. + const pm_comments_map_t *comments_map = parser->comments_map; + if (comments_map != NULL) { + // Count non-NONE entries. + uint32_t count = 0; + for (size_t index = 0; index < comments_map->size; index++) { + if (comments_map->entries[index] != NULL) count++; + } + pm_buffer_append_varuint(buffer, count); + + for (size_t index = 0; index < comments_map->size; index++) { + const pm_comments_t *entry = comments_map->entries[index]; + if (entry == NULL) continue; + + pm_buffer_append_varuint(buffer, (uint32_t) index); // node_id + pm_buffer_append_byte(buffer, (uint8_t) entry->type); + + // Serialize fields based on type. Single comments are serialized + // as a boolean + start_offset. Lists are count + start_offsets. + #define SERIALIZE_COMMENT(c) do { \ + if (c) { pm_buffer_append_byte(buffer, 1); pm_buffer_append_varuint(buffer, (c)->location.start); } \ + else { pm_buffer_append_byte(buffer, 0); } \ + } while (0) + #define SERIALIZE_LIST(l) do { \ + pm_buffer_append_varuint(buffer, (uint32_t) (l).size); \ + for (size_t _i = 0; _i < (l).size; _i++) { \ + pm_buffer_append_varuint(buffer, (l).comments[_i]->location.start); \ + } \ + } while (0) + + switch (entry->type) { + case PM_COMMENTS_NONE: break; + <%- comments.each do |comment| -%> + case PM_COMMENTS_<%= comment.enum_name %>: { + const <%= comment.c_type %> *t = (const <%= comment.c_type %> *) entry; + <%- comment.fields.each do |field| -%> + <%= field.list? ? "SERIALIZE_LIST" : "SERIALIZE_COMMENT" %>(t-><%= field.name %>); + <%- end -%> + break; + } + <%- end -%> + } + + #undef SERIALIZE_COMMENT + #undef SERIALIZE_LIST + } + } else { + pm_buffer_append_varuint(buffer, 0); + } + + // Leave space for the offset of the constant pool. + size_t cpool_offset_location = buffer->length; pm_buffer_append_zeroes(buffer, 4); // Next, encode the length of the constant pool. @@ -292,11 +345,11 @@ pm_serialize_content(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) // Now we're going to serialize the offset of the constant pool back where // we left space for it. - uint32_t length = pm_sizet_to_u32(buffer->length); - memcpy(buffer->value + offset, &length, sizeof(uint32_t)); + uint32_t cpool_offset = pm_sizet_to_u32(buffer->length); + memcpy(buffer->value + cpool_offset_location, &cpool_offset, sizeof(uint32_t)); // Now we're going to serialize the constant pool. - offset = buffer->length; + size_t cpool_data_offset = buffer->length; pm_buffer_append_zeroes(buffer, parser->constant_pool.size * 8); for (uint32_t index = 0; index < parser->constant_pool.capacity; index++) { @@ -306,7 +359,7 @@ pm_serialize_content(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) // index in the buffer. if (bucket->id != 0) { pm_constant_t *constant = &parser->constant_pool.constants[bucket->id - 1]; - size_t buffer_offset = offset + ((((size_t)bucket->id) - 1) * 8); + size_t buffer_offset = cpool_data_offset + ((((size_t)bucket->id) - 1) * 8); // Write the constant contents into the buffer after the constant // pool. In place of the source offset, we store a buffer offset. diff --git a/templates/template.rb b/templates/template.rb index 7638c9c058..48728e2add 100755 --- a/templates/template.rb +++ b/templates/template.rb @@ -171,10 +171,10 @@ def call_seq_type end def check_field_kind - if union_kind - "[#{union_kind.join(', ')}, ErrorRecoveryNode].include?(#{name}.class)" + if @kind + "[#{[*@kind, "ErrorRecoveryNode"].join(', ')}].include?(#{name}.class) || #{name}.is_a?(Comment)" else - "#{name}.is_a?(#{ruby_type}) || #{name}.is_a?(ErrorRecoveryNode)" + "#{name}.is_a?(Node) || #{name}.is_a?(Comment)" end end end @@ -203,10 +203,10 @@ def call_seq_type end def check_field_kind - if union_kind - "[#{union_kind.join(', ')}, ErrorRecoveryNode, NilClass].include?(#{name}.class)" + if @kind + "[#{[*@kind, "ErrorRecoveryNode", "NilClass"].join(', ')}].include?(#{name}.class) || #{name}.is_a?(Comment)" else - "#{name}.nil? || #{name}.is_a?(#{ruby_type}) || #{name}.is_a?(ErrorRecoveryNode)" + "#{name}.nil? || #{name}.is_a?(Node) || #{name}.is_a?(Comment)" end end end @@ -247,10 +247,10 @@ def java_type end def check_field_kind - if union_kind - "#{name}.all? { |n| [#{union_kind.join(', ')}, ErrorRecoveryNode].include?(n.class) }" + if @kind + "#{name}.all? { |n| [#{[*@kind, "ErrorRecoveryNode"].join(', ')}].include?(n.class) || n.is_a?(Comment) }" else - "#{name}.all? { |n| n.is_a?(#{ruby_type}) || n.is_a?(ErrorRecoveryNode) }" + "#{name}.all? { |n| n.is_a?(Node) || n.is_a?(Comment) }" end end end @@ -566,6 +566,54 @@ def initialize(config) end end + # Represents a comment attachment type with its fields. + class CommentType + # Represents a field in a comment attachment type. + class Field + attr_reader :name, :type, :comment + + def initialize(config) + @name = config.fetch("name") + @type = config.fetch("type") # "comment" or "list" + @comment = config.fetch("comment") + end + + def comment? + type == "comment" + end + + def list? + type == "list" + end + + def each_comment_line(&block) + ConfigComment.new(comment).each_line(&block) + end + end + + attr_reader :name, :comment, :fields + + def initialize(config) + @name = config.fetch("name") + @comment = config.fetch("comment") + @fields = config.fetch("fields").map { |field| Field.new(field) } + end + + def each_comment_line(&block) + ConfigComment.new(comment).each_line(&block) + end + + # The SCREAMING_SNAKE_CASE enum name (e.g., "ALIAS" from "AliasMethodComments"). + def enum_name + @enum_name ||= name.sub(/Comments$/, "").gsub(/([a-z])([A-Z])/, '\1_\2').upcase + end + + # The snake_case C struct name (e.g., "pm_alias_method_comments_t"). + def c_type + @c_type ||= "pm_#{name.gsub(/([a-z])([A-Z])/, '\1_\2').downcase}_t" + end + end + # Represents a set of flags that should be internally represented with an enum. class Flags # Represents an individual flag within a set of flags. @@ -671,7 +719,8 @@ def locals warnings: config.fetch("warnings").map { |name| Warning.new(name) }, nodes: config.fetch("nodes").map { |node| NodeType.new(node, flags) }.sort_by(&:name), tokens: config.fetch("tokens").map { |token| Token.new(token) }, - flags: flags.values + flags: flags.values, + comments: config.fetch("comments", []).map { |c| CommentType.new(c) } } end end @@ -680,6 +729,7 @@ def locals TEMPLATES = [ "ext/prism/api_node.c", "include/prism/ast.h", + "include/prism/comments.h", "include/prism/internal/diagnostic.h", "javascript/src/deserialize.js", "javascript/src/nodes.js", @@ -687,6 +737,7 @@ def locals "java/api/src/main/java-templates/org/ruby_lang/prism/Loader.java", "java/api/src/main/java-templates/org/ruby_lang/prism/Nodes.java", "java/api/src/main/java-templates/org/ruby_lang/prism/AbstractNodeVisitor.java", + "lib/prism/comments.rb", "lib/prism/compiler.rb", "lib/prism/dispatcher.rb", "lib/prism/dot_visitor.rb", diff --git a/test/prism/comments_test.rb b/test/prism/comments_test.rb new file mode 100644 index 0000000000..dee2395a4b --- /dev/null +++ b/test/prism/comments_test.rb @@ -0,0 +1,2229 @@ +# frozen_string_literal: true + +require_relative "test_helper" +require "strscan" + +module Prism + class CommentsTest < TestCase + def test_AliasMethod_1 + source = <<~'RUBY' + alias a #0 + #1 + #2 + b #3 + RUBY + + assert_comments(source, [ + ".statements.body[0].new_name.comments.trailing_comment", + ".statements.body[0].comments.gap_comments[0]", + ".statements.body[0].comments.gap_comments[1]", + ".statements.body[0].old_name.comments.trailing_comment", + ]) + end + + def test_AliasMethod_2 + assert_comments("alias a b #0", [".statements.body[0].old_name.comments.trailing_comment"]) + end + + def test_AliasMethod_3 + source = <<~'RUBY' + alias a #0 + b #1 + RUBY + + assert_comments(source, [ + ".statements.body[0].new_name.comments.trailing_comment", + ".statements.body[0].old_name.comments.trailing_comment", + ]) + end + + def test_AlternationPattern_1 + assert_comments("1 => 2 | 3 #0", [".statements.body[0].pattern.right.comments.trailing_comment"]) + end + + def test_AlternationPattern_2 + source = <<~'RUBY' + 1 => 2 | #0 + 3 #1 + RUBY + + assert_comments(source, [ + ".statements.body[0].pattern.comments.operator_comment", + ".statements.body[0].pattern.right.comments.trailing_comment", + ]) + end + + def test_AlternationPattern_3 + source = <<~'RUBY' + 1 => 2 | #0 + #1 + #2 + 3 #3 + RUBY + + assert_comments(source, [ + ".statements.body[0].pattern.comments.operator_comment", + ".statements.body[0].pattern.comments.gap_comments[0]", + ".statements.body[0].pattern.comments.gap_comments[1]", + ".statements.body[0].pattern.right.comments.trailing_comment", + ]) + end + + def test_MatchRequired_1 + assert_comments("1 => 2 #0", [".statements.body[0].pattern.comments.trailing_comment"]) + end + + def test_MatchRequired_2 + source = <<~'RUBY' + 1 => #0 + 2 #1 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.operator_comment", + ".statements.body[0].pattern.comments.trailing_comment", + ]) + end + + def test_MatchRequired_3 + source = <<~'RUBY' + 1 => #0 + #1 + #2 + 2 #3 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.operator_comment", + ".statements.body[0].comments.gap_comments[0]", + ".statements.body[0].comments.gap_comments[1]", + ".statements.body[0].pattern.comments.trailing_comment", + ]) + end + + def test_MatchPredicate_1 + assert_comments("1 in 2 #0", [".statements.body[0].pattern.comments.trailing_comment"]) + end + + def test_MatchPredicate_2 + source = <<~'RUBY' + 1 in #0 + 2 #1 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.operator_comment", + ".statements.body[0].pattern.comments.trailing_comment", + ]) + end + + def test_MatchPredicate_3 + source = <<~'RUBY' + 1 in #0 + #1 + #2 + 2 #3 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.operator_comment", + ".statements.body[0].comments.gap_comments[0]", + ".statements.body[0].comments.gap_comments[1]", + ".statements.body[0].pattern.comments.trailing_comment", + ]) + end + + def test_And_1 + source = <<~'RUBY' + 1 #0 + #1 + #2 + and #3 + #4 + #5 + 2 #6 + RUBY + + assert_comments(source, [ + ".statements.body[0].left.comments.trailing_comment", + ".statements.body[0].comments.left_gap_comments[0]", + ".statements.body[0].comments.left_gap_comments[1]", + ".statements.body[0].comments.operator_comment", + ".statements.body[0].comments.right_gap_comments[0]", + ".statements.body[0].comments.right_gap_comments[1]", + ".statements.body[0].right.comments.trailing_comment", + ]) + end + + def test_And_2 + source = <<~'RUBY' + 1 && #0 + #1 + #2 + 2 #3 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.operator_comment", + ".statements.body[0].comments.gap_comments[0]", + ".statements.body[0].comments.gap_comments[1]", + ".statements.body[0].right.comments.trailing_comment", + ]) + end + + def test_Or_1 + source = <<~'RUBY' + 1 #0 + #1 + #2 + or #3 + #4 + #5 + 2 #6 + RUBY + + assert_comments(source, [ + ".statements.body[0].left.comments.trailing_comment", + ".statements.body[0].comments.left_gap_comments[0]", + ".statements.body[0].comments.left_gap_comments[1]", + ".statements.body[0].comments.operator_comment", + ".statements.body[0].comments.right_gap_comments[0]", + ".statements.body[0].comments.right_gap_comments[1]", + ".statements.body[0].right.comments.trailing_comment", + ]) + end + + def test_Or_2 + source = <<~'RUBY' + 1 || #0 + #1 + #2 + 2 #3 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.operator_comment", + ".statements.body[0].comments.gap_comments[0]", + ".statements.body[0].comments.gap_comments[1]", + ".statements.body[0].right.comments.trailing_comment", + ]) + end + + def test_BackReferenceRead_1 + assert_comments("$' #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_BlockArgument_1 + source = <<~'RUBY' + a( + & #0 + #1 + b #2 + ) + RUBY + + assert_comments(source, [ + ".statements.body[0].block.comments.operator_comment", + ".statements.body[0].block.comments.gap_comments[0]", + ".statements.body[0].block.expression.comments.trailing_comment", + ]) + end + + def test_Case_1 + source = <<~'RUBY' + case 1 + when 2 + 3 #0 + end #1 + RUBY + + assert_comments(source, [ + ".statements.body[0].conditions[0].statements.body[0].comments.trailing_comment", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_Case_2 + source = <<~'RUBY' + case 1 + when 2 + #0 + end + RUBY + + assert_comments(source, [".statements.body[0].conditions[0].statements.body[0]"]) + end + + def test_Case_3 + source = <<~'RUBY' + case 1 + when 2 + #0 + 3 #1 + #2 + when 4 + #3 + end + RUBY + + assert_comments(source, [ + ".statements.body[0].conditions[0].statements.body[0]", + ".statements.body[0].conditions[0].statements.body[1].comments.trailing_comment", + ".statements.body[0].conditions[0].statements.body[2]", + ".statements.body[0].conditions[1].statements.body[0]", + ]) + end + + def test_When_1 + source = <<~'RUBY' + case 1 + when #0 + #1 + 2 + 3 + end + RUBY + + assert_comments(source, [ + ".statements.body[0].conditions[0].conditions[0]", + ".statements.body[0].conditions[0].conditions[1]", + ]) + end + + def test_When_2 + source = <<~'RUBY' + case 1 + when #0 + 2, #1 + #2 + 3 + #3 + 4 + end + RUBY + + assert_comments(source, [ + ".statements.body[0].conditions[0].conditions[0]", + ".statements.body[0].conditions[0].conditions[1].comments.trailing_comment", + ".statements.body[0].conditions[0].conditions[2]", + ".statements.body[0].conditions[0].statements.body[0]", + ]) + end + + def test_CaseMatch_1 + source = <<~'RUBY' + case 1 + in 2 + 3 #0 + end #1 + RUBY + + assert_comments(source, [ + ".statements.body[0].conditions[0].statements.body[0].comments.trailing_comment", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_CaseMatch_2 + source = <<~'RUBY' + case 1 + in 2 + #0 + end + RUBY + + assert_comments(source, [".statements.body[0].conditions[0].statements.body[0]"]) + end + + def test_CaseMatch_3 + source = <<~'RUBY' + case 1 + in 2 + #0 + 3 #1 + #2 + in 4 + #3 + end + RUBY + + assert_comments(source, [ + ".statements.body[0].conditions[0].statements.body[0]", + ".statements.body[0].conditions[0].statements.body[1].comments.trailing_comment", + ".statements.body[0].conditions[0].statements.body[2]", + ".statements.body[0].conditions[1].statements.body[0]", + ]) + end + + def test_Arguments_1 + assert_comments("break 1 #0", [".statements.body[0].arguments.arguments[0].comments.trailing_comment"]) + end + + def test_Break_1 + assert_comments("break #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_ConstantRead_1 + source = <<~'RUBY' + class Foo #0 + #1 + 1 #2 + end #3 + RUBY + + assert_comments(source, [ + ".statements.body[0].constant_path.comments.trailing_comment", + ".statements.body[0].body.body[0]", + ".statements.body[0].body.body[1].comments.trailing_comment", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_ConstantRead_2 + source = <<~'RUBY' + class Foo < Bar #0 + #1 + end + RUBY + + assert_comments(source, [ + ".statements.body[0].superclass.comments.trailing_comment", + ".statements.body[0].body.body[0]", + ]) + end + + def test_Class_1 + source = <<~'RUBY' + class #0 + Foo + #1 + end + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.opening_comment", + ".statements.body[0].body.body[0]", + ]) + end + + def test_Self_1 + source = <<~'RUBY' + class << self #0 + #1 + end #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].expression.comments.trailing_comment", + ".statements.body[0].body.body[0]", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_SingletonClass_1 + source = <<~'RUBY' + class << #0 + self + #1 + end + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.opening_comment", + ".statements.body[0].body.body[0]", + ]) + end + + def test_ConstantRead_3 + source = <<~'RUBY' + module Foo #0 + end + RUBY + + assert_comments(source, [".statements.body[0].constant_path.comments.trailing_comment"]) + end + + def test_Module_1 + source = <<~'RUBY' + module Foo + #0 + 1 #1 + end #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].body.body[0]", + ".statements.body[0].body.body[1].comments.trailing_comment", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_Module_2 + source = <<~'RUBY' + module Foo + #0 + end + RUBY + + assert_comments(source, [".statements.body[0].body.body[0]"]) + end + + def test_Module_3 + source = <<~'RUBY' + module #0 + Foo + end + RUBY + + assert_comments(source, [".statements.body[0].comments.opening_comment"]) + end + + def test_Module_4 + source = <<~'RUBY' + module #0 + Foo + #1 + 1 + end + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.opening_comment", + ".statements.body[0].body.body[0]", + ]) + end + + def test_ConstantPath_1 + source = <<~'RUBY' + module Foo::Bar #0 + #1 + end + RUBY + + assert_comments(source, [ + ".statements.body[0].constant_path.comments.trailing_comment", + ".statements.body[0].body.body[0]", + ]) + end + + def test_ConstantPath_2 + source = <<~'RUBY' + module Foo:: #0 + Bar + #1 + end + RUBY + + assert_comments(source, [ + ".statements.body[0].constant_path.comments.operator_comment", + ".statements.body[0].body.body[0]", + ]) + end + + def test_Arguments_2 + assert_comments("next 1 #0", [".statements.body[0].arguments.arguments[0].comments.trailing_comment"]) + end + + def test_Next_1 + assert_comments("next #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_CapturePattern_1 + source = <<~'RUBY' + 1 in 2 => #0 + a + RUBY + + assert_comments(source, [".statements.body[0].pattern.comments.operator_comment"]) + end + + def test_CapturePattern_2 + source = <<~'RUBY' + 1 in 2 => #0 + #1 + #2 + a + RUBY + + assert_comments(source, [ + ".statements.body[0].pattern.comments.operator_comment", + ".statements.body[0].pattern.comments.gap_comments[0]", + ".statements.body[0].pattern.comments.gap_comments[1]", + ]) + end + + def test_ClassVariableRead_1 + assert_comments("@@a #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_ClassVariableTarget_1 + source = <<~'RUBY' + @@a, #0 + @@b = 1, 2 + RUBY + + assert_comments(source, [".statements.body[0].lefts[0].comments.trailing_comment"]) + end + + def test_ClassVariableWrite_1 + assert_comments("@@a = 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_ClassVariableWrite_2 + source = <<~'RUBY' + @@a = #0 + #1 + 1 #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.operator_comment", + ".statements.body[0].comments.gap_comments[0]", + ".statements.body[0].value.comments.trailing_comment", + ]) + end + + def test_ClassVariableAndWrite_1 + assert_comments("@@a &&= 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_ClassVariableAndWrite_2 + source = <<~'RUBY' + @@a &&= #0 + 1 #1 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.operator_comment", + ".statements.body[0].value.comments.trailing_comment", + ]) + end + + def test_ClassVariableOperatorWrite_1 + assert_comments("@@a += 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_ClassVariableOperatorWrite_2 + source = <<~'RUBY' + @@a += #0 + 1 #1 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.operator_comment", + ".statements.body[0].value.comments.trailing_comment", + ]) + end + + def test_ClassVariableOrWrite_1 + assert_comments("@@a ||= 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_ConstantRead_4 + assert_comments("A #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_ConstantTarget_1 + source = <<~'RUBY' + A, #0 + B = 1, 2 + RUBY + + assert_comments(source, [".statements.body[0].lefts[0].comments.trailing_comment"]) + end + + def test_ConstantPath_3 + assert_comments("A::B #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_ConstantPath_4 + source = <<~'RUBY' + A:: #0 + B + RUBY + + assert_comments(source, [".statements.body[0].comments.operator_comment"]) + end + + def test_ConstantPath_5 + assert_comments("::Foo #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_ConstantPath_6 + source = <<~'RUBY' + :: #0 + Foo + RUBY + + assert_comments(source, [".statements.body[0].comments.operator_comment"]) + end + + def test_ConstantPathTarget_1 + source = <<~'RUBY' + A::B, #0 + c = 1, 2 + RUBY + + assert_comments(source, [".statements.body[0].lefts[0].comments.trailing_comment"]) + end + + def test_ConstantWrite_1 + assert_comments("A = 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_ConstantWrite_2 + source = <<~'RUBY' + A = #0 + #1 + 1 #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.operator_comment", + ".statements.body[0].comments.gap_comments[0]", + ".statements.body[0].value.comments.trailing_comment", + ]) + end + + def test_ConstantAndWrite_1 + assert_comments("A &&= 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_ConstantOperatorWrite_1 + assert_comments("A += 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_ConstantOrWrite_1 + assert_comments("A ||= 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_ConstantPathWrite_1 + assert_comments("A::B = 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_ConstantPathWrite_2 + source = <<~'RUBY' + A::B = #0 + #1 + 1 #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.operator_comment", + ".statements.body[0].comments.gap_comments[0]", + ".statements.body[0].value.comments.trailing_comment", + ]) + end + + def test_ConstantPathAndWrite_1 + assert_comments("A::B &&= 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_ConstantPathOperatorWrite_1 + assert_comments("A::B += 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_ConstantPathOrWrite_1 + assert_comments("A::B ||= 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_False_1 + assert_comments("false #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_Float_1 + assert_comments("1.0 #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_GlobalVariableRead_1 + assert_comments("$a #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_Arguments_3 + source = <<~'RUBY' + def a(...) + b(... #0 + ) + end + RUBY + + assert_comments(source, [".statements.body[0].body.body[0].arguments.arguments[0].comments.trailing_comment"]) + end + + def test_ForwardingParameter_1 + source = <<~'RUBY' + def a(... #0 + ) + end + RUBY + + assert_comments(source, [".statements.body[0].parameters.keyword_rest.comments.trailing_comment"]) + end + + def test_GlobalVariableTarget_1 + source = <<~'RUBY' + $a, #0 + $b = 1, 2 + RUBY + + assert_comments(source, [".statements.body[0].lefts[0].comments.trailing_comment"]) + end + + def test_GlobalVariableWrite_1 + assert_comments("$a = 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_GlobalVariableWrite_2 + source = <<~'RUBY' + $a = #0 + #1 + 1 #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.operator_comment", + ".statements.body[0].comments.gap_comments[0]", + ".statements.body[0].value.comments.trailing_comment", + ]) + end + + def test_GlobalVariableAndWrite_1 + assert_comments("$a &&= 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_GlobalVariableOperatorWrite_1 + assert_comments("$a += 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_GlobalVariableOrWrite_1 + assert_comments("$a ||= 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_InstanceVariableRead_1 + assert_comments("@a #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_InstanceVariableTarget_1 + source = <<~'RUBY' + @a, #0 + @b = 1, 2 + RUBY + + assert_comments(source, [".statements.body[0].lefts[0].comments.trailing_comment"]) + end + + def test_InstanceVariableWrite_1 + assert_comments("@a = 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_InstanceVariableWrite_2 + source = <<~'RUBY' + @a = #0 + #1 + 1 #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.operator_comment", + ".statements.body[0].comments.gap_comments[0]", + ".statements.body[0].value.comments.trailing_comment", + ]) + end + + def test_InstanceVariableAndWrite_1 + assert_comments("@a &&= 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_InstanceVariableOperatorWrite_1 + assert_comments("@a += 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_InstanceVariableOrWrite_1 + assert_comments("@a ||= 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_EmbeddedStatements_1 + source = <<~'RUBY' + "foo #{ #0 + 1 + } bar" + RUBY + + assert_comments(source, [".statements.body[0].parts[1].comments.opening_comment"]) + end + + def test_InterpolatedString_1 + source = <<~'RUBY' + "foo #{ + #0 + 1 + } bar" + RUBY + + assert_comments(source, [".statements.body[0].parts[1].statements.body[0]"]) + end + + def test_InterpolatedString_2 + assert_comments("\"foo \#{1} bar\" #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_InterpolatedString_3 + source = <<~'RUBY' + "foo #{ + 1 #0 + } bar" #1 + RUBY + + assert_comments(source, [ + ".statements.body[0].parts[1].statements.body[0].comments.trailing_comment", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_InterpolatedString_4 + source = <<~'RUBY' + "#{1} #{2 #0 + }" #1 + RUBY + + assert_comments(source, [ + ".statements.body[0].parts[2].statements.body[0].comments.trailing_comment", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_InterpolatedRegularExpression_1 + assert_comments("/foo \#{1} bar/ #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_InterpolatedSymbol_1 + assert_comments(":\"foo \#{1} bar\" #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_InterpolatedXString_1 + assert_comments("`foo \#{1} bar` #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_Call_1 + source = <<~'RUBY' + a { it #0 + } + RUBY + + assert_comments(source, [".statements.body[0].block.body.body[0].comments.trailing_comment"]) + end + + def test_KeywordRestParameter_1 + source = <<~'RUBY' + def a(** #0 + b + ) + end + RUBY + + assert_comments(source, [".statements.body[0].parameters.keyword_rest.comments.operator_comment"]) + end + + def test_KeywordRestParameter_2 + source = <<~'RUBY' + def a(** #0 + ) + end + RUBY + + assert_comments(source, [".statements.body[0].parameters.keyword_rest.comments.trailing_comment"]) + end + + def test_LocalVariableWrite_1 + source = <<~'RUBY' + a = 1 + a #0 + RUBY + + assert_comments(source, [".statements.body[1].comments.trailing_comment"]) + end + + def test_LocalVariableTarget_1 + source = <<~'RUBY' + a, #0 + b = 1, 2 + RUBY + + assert_comments(source, [".statements.body[0].lefts[0].comments.trailing_comment"]) + end + + def test_LocalVariableWrite_2 + assert_comments("a = 1 #0", [".statements.body[0].value.comments.trailing_comment"]) + end + + def test_LocalVariableWrite_3 + source = <<~'RUBY' + a = #0 + #1 + 1 #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.operator_comment", + ".statements.body[0].comments.gap_comments[0]", + ".statements.body[0].value.comments.trailing_comment", + ]) + end + + def test_LocalVariableWrite_4 + source = <<~'RUBY' + a = 1 + a &&= 2 #0 + RUBY + + assert_comments(source, [".statements.body[1].value.comments.trailing_comment"]) + end + + def test_LocalVariableWrite_5 + source = <<~'RUBY' + a = 1 + a += 2 #0 + RUBY + + assert_comments(source, [".statements.body[1].value.comments.trailing_comment"]) + end + + def test_LocalVariableWrite_6 + source = <<~'RUBY' + a = 1 + a ||= 2 #0 + RUBY + + assert_comments(source, [".statements.body[1].value.comments.trailing_comment"]) + end + + def test_Nil_1 + assert_comments("nil #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_NumberedReferenceRead_1 + assert_comments("$1 #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_MatchLastLine_1 + source = <<~'RUBY' + if /foo/ #0 + end + RUBY + + assert_comments(source, [".statements.body[0].predicate.comments.trailing_comment"]) + end + + def test_BlockParameter_1 + source = <<~'RUBY' + def a(& #0 + b + ) + end + RUBY + + assert_comments(source, [".statements.body[0].parameters.block.comments.operator_comment"]) + end + + def test_BlockParameter_2 + source = <<~'RUBY' + def a(& #0 + ) + end + RUBY + + assert_comments(source, [".statements.body[0].parameters.block.comments.trailing_comment"]) + end + + def test_NoBlockParameter_1 + source = <<~'RUBY' + def a(&nil #0 + ) + end + RUBY + + assert_comments(source, [".statements.body[0].parameters.block.comments.trailing_comment"]) + end + + def test_NoKeywordsParameter_1 + source = <<~'RUBY' + def a(**nil #0 + ) + end + RUBY + + assert_comments(source, [".statements.body[0].parameters.keyword_rest.comments.trailing_comment"]) + end + + def test_Defined_1 + source = <<~'RUBY' + defined? #0 + a + RUBY + + assert_comments(source, [".statements.body[0].comments.operator_comment"]) + end + + def test_Defined_2 + source = <<~'RUBY' + defined? #0 + #1 + a #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.operator_comment", + ".statements.body[0].comments.gap_comments[0]", + ".statements.body[0].value.comments.trailing_comment", + ]) + end + + def test_Defined_3 + source = <<~'RUBY' + defined?( #0 + a + ) + RUBY + + assert_comments(source, [".statements.body[0].comments.opening_comment"]) + end + + def test_Defined_4 + source = <<~'RUBY' + defined?( #0 + #1 + a #2 + ) + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.opening_comment", + ".statements.body[0].comments.opening_gap_comments[0]", + ".statements.body[0].value.comments.trailing_comment", + ]) + end + + def test_Call_2 + source = <<~'RUBY' + defined?( + a #0 + #1 + ) + RUBY + + assert_comments(source, [ + ".statements.body[0].value.comments.trailing_comment", + ".statements.body[0].comments.closing_gap_comments[0]", + ]) + end + + def test_Parentheses_1 + assert_comments("(1) #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_Parentheses_2 + source = <<~'RUBY' + ( #0 + 1 + ) + RUBY + + assert_comments(source, [".statements.body[0].comments.opening_comment"]) + end + + def test_Parentheses_3 + source = <<~'RUBY' + ( + #0 + 1 #1 + ) #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].body.body[0]", + ".statements.body[0].body.body[1].comments.trailing_comment", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_PinnedExpression_1 + source = <<~'RUBY' + 1 in ^( #0 + a + ) + RUBY + + assert_comments(source, [".statements.body[0].pattern.comments.opening_comment"]) + end + + def test_PinnedExpression_2 + source = <<~'RUBY' + 1 in ^( #0 + #1 + a #2 + #3 + ) + RUBY + + assert_comments(source, [ + ".statements.body[0].pattern.comments.opening_comment", + ".statements.body[0].pattern.comments.opening_gap_comments[0]", + ".statements.body[0].pattern.expression.comments.trailing_comment", + ".statements.body[0].pattern.comments.closing_gap_comments[0]", + ]) + end + + def test_PinnedVariable_1 + source = <<~'RUBY' + 1 in ^ #0 + @a + RUBY + + assert_comments(source, [".statements.body[0].pattern.comments.operator_comment"]) + end + + def test_PinnedVariable_2 + source = <<~'RUBY' + a = 1 + 1 in ^ #0 + #1 + a + RUBY + + assert_comments(source, [ + ".statements.body[1].pattern.comments.operator_comment", + ".statements.body[1].pattern.comments.gap_comments[0]", + ]) + end + + def test_ArrayPattern_1 + source = <<~'RUBY' + 1 in [ + #0 + 2, + *b, + #1 + 3 + ] + RUBY + + assert_comments(source, [ + ".statements.body[0].pattern.requireds[0]", + ".statements.body[0].pattern.posts[0]", + ]) + end + + def test_ArrayPattern_2 + source = <<~'RUBY' + 1 in [ + #0 + 2 + ] + RUBY + + assert_comments(source, [".statements.body[0].pattern.requireds[0]"]) + end + + def test_FindPattern_1 + source = <<~'RUBY' + 1 in [ + *a, + #0 + 2, #1 + *b + ] + RUBY + + assert_comments(source, [ + ".statements.body[0].pattern.requireds[0]", + ".statements.body[0].pattern.requireds[1].comments.trailing_comment", + ]) + end + + def test_FindPattern_2 + source = <<~'RUBY' + 1 in [ + *a, + 2, + #0 + *b + ] + RUBY + + assert_comments(source, [".statements.body[0].pattern.requireds[1]"]) + end + + def test_FindPattern_3 + source = <<~'RUBY' + 1 in Foo[ #0 + *a, + 2, + *b + ] + RUBY + + assert_comments(source, [".statements.body[0].pattern.comments.opening_comment"]) + end + + def test_HashPattern_1 + source = <<~'RUBY' + 1 in { + #0 + a: 2, + #1 + **b + } + RUBY + + assert_comments(source, [ + ".statements.body[0].pattern.elements[0]", + ".statements.body[0].pattern.elements[2]", + ]) + end + + def test_HashPattern_2 + source = <<~'RUBY' + 1 in { #0 + a: 2 + } #1 + RUBY + + assert_comments(source, [ + ".statements.body[0].pattern.comments.opening_comment", + ".statements.body[0].pattern.comments.closing_comment", + ]) + end + + def test_Imaginary_1 + assert_comments("1i #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_Range_1 + assert_comments("1..2 #0", [".statements.body[0].right.comments.trailing_comment"]) + end + + def test_Range_2 + assert_comments("1.. #0", [".statements.body[0].comments.operator_comment"]) + end + + def test_Range_3 + assert_comments("..2 #0", [".statements.body[0].right.comments.trailing_comment"]) + end + + def test_Range_4 + source = <<~'RUBY' + 1 .. #0 + #1 + 2 #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.operator_comment", + ".statements.body[0].comments.gap_comments[0]", + ".statements.body[0].right.comments.trailing_comment", + ]) + end + + def test_Rational_1 + assert_comments("1r #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_Call_3 + source = <<~'RUBY' + loop do + redo #0 + end + RUBY + + assert_comments(source, [".statements.body[0].block.body.body[0].comments.trailing_comment"]) + end + + def test_PostExecution_1 + source = <<~'RUBY' + END { #0 + 1 + } + RUBY + + assert_comments(source, [".statements.body[0].comments.opening_comment"]) + end + + def test_PostExecution_2 + assert_comments("END { 1 } #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_PostExecution_3 + source = <<~'RUBY' + END { + #0 + 1 #1 + } #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].statements.body[0]", + ".statements.body[0].statements.body[1].comments.trailing_comment", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_PreExecution_1 + assert_comments("BEGIN { 1 } #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_PreExecution_2 + source = <<~'RUBY' + BEGIN { + #0 + 1 #1 + } #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].statements.body[0]", + ".statements.body[0].statements.body[1].comments.trailing_comment", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_RegularExpression_1 + assert_comments("/foo/ #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_RegularExpression_2 + source = <<~'RUBY' + /foo + bar/ #0 + RUBY + + assert_comments(source, [".statements.body[0].comments.trailing_comment"]) + end + + def test_RequiredKeywordParameter_1 + source = <<~'RUBY' + def a(b: #0 + ) + end + RUBY + + assert_comments(source, [".statements.body[0].parameters.keywords[0].comments.trailing_comment"]) + end + + def test_OptionalKeywordParameter_1 + source = <<~'RUBY' + def a(b: #0 + 1 + ) + end + RUBY + + assert_comments(source, [".statements.body[0].parameters.keywords[0].comments.operator_comment"]) + end + + def test_OptionalKeywordParameter_2 + source = <<~'RUBY' + def a(b: #0 + #1 + 1 #2 + ) + end + RUBY + + assert_comments(source, [ + ".statements.body[0].parameters.keywords[0].comments.operator_comment", + ".statements.body[0].parameters.keywords[0].comments.gap_comments[0]", + ".statements.body[0].parameters.keywords[0].value.comments.trailing_comment", + ]) + end + + def test_Parameters_1 + source = <<~'RUBY' + def a(b #0 + ) + end + RUBY + + assert_comments(source, [".statements.body[0].parameters.requireds[0].comments.trailing_comment"]) + end + + def test_OptionalParameter_1 + source = <<~'RUBY' + def a(b = #0 + 1 + ) + end + RUBY + + assert_comments(source, [".statements.body[0].parameters.optionals[0].comments.operator_comment"]) + end + + def test_OptionalParameter_2 + source = <<~'RUBY' + def a(b = #0 + #1 + 1 #2 + ) + end + RUBY + + assert_comments(source, [ + ".statements.body[0].parameters.optionals[0].comments.operator_comment", + ".statements.body[0].parameters.optionals[0].comments.gap_comments[0]", + ".statements.body[0].parameters.optionals[0].value.comments.trailing_comment", + ]) + end + + def test_RestParameter_1 + source = <<~'RUBY' + def a(* #0 + b + ) + end + RUBY + + assert_comments(source, [".statements.body[0].parameters.rest.comments.operator_comment"]) + end + + def test_RestParameter_2 + source = <<~'RUBY' + def a(* #0 + ) + end + RUBY + + assert_comments(source, [".statements.body[0].parameters.rest.comments.trailing_comment"]) + end + + def test_Begin_1 + source = <<~'RUBY' + begin + rescue + retry #0 + end + RUBY + + assert_comments(source, [".statements.body[0].rescue_clause.statements.body[0].comments.trailing_comment"]) + end + + def test_RescueModifier_1 + assert_comments("1 rescue 2 #0", [".statements.body[0].rescue_expression.comments.trailing_comment"]) + end + + def test_RescueModifier_2 + source = <<~'RUBY' + 1 rescue #0 + #1 + #2 + 2 #3 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.operator_comment", + ".statements.body[0].comments.gap_comments[0]", + ".statements.body[0].comments.gap_comments[1]", + ".statements.body[0].rescue_expression.comments.trailing_comment", + ]) + end + + def test_RegularExpression_3 + source = <<~'RUBY' + /foo + bar/ #0 + RUBY + + assert_comments(source, [".statements.body[0].comments.trailing_comment"]) + end + + def test_Arguments_4 + source = <<~'RUBY' + a( + * #0 + #1 + b #2 + ) + RUBY + + assert_comments(source, [ + ".statements.body[0].arguments.arguments[0].comments.operator_comment", + ".statements.body[0].arguments.arguments[0].comments.gap_comments[0]", + ".statements.body[0].arguments.arguments[0].expression.comments.trailing_comment", + ]) + end + + def test_Self_2 + assert_comments("self #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_SourceEncoding_1 + assert_comments("__ENCODING__ #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_SourceFile_1 + assert_comments("__FILE__ #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_SourceLine_1 + assert_comments("__LINE__ #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_String_1 + assert_comments("\"foo\" #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_String_2 + source = <<~'RUBY' + <<~HEREDOC #0 + foo + HEREDOC + RUBY + + assert_comments(source, [".statements.body[0].comments.trailing_comment"]) + end + + def test_True_1 + assert_comments("true #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_XString_1 + assert_comments("`foo` #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_XString_2 + source = <<~'RUBY' + <<~`HEREDOC` #0 + foo + HEREDOC + RUBY + + assert_comments(source, [".statements.body[0].comments.trailing_comment"]) + end + + def test_Def_1 + source = <<~'RUBY' + def foo #0 + #1 + 1 + end #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.opening_comment", + ".statements.body[0].body.body[0]", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_Parameters_2 + source = <<~'RUBY' + def foo(a #0 + ) + #1 + end + RUBY + + assert_comments(source, [ + ".statements.body[0].parameters.requireds[0].comments.trailing_comment", + ".statements.body[0].body.body[0]", + ]) + end + + def test_Def_2 + source = <<~'RUBY' + def foo = #0 + 1 + RUBY + + assert_comments(source, [".statements.body[0].comments.operator_comment"]) + end + + def test_True_2 + source = <<~'RUBY' + if true #0 + #1 + 1 + end #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].predicate.comments.trailing_comment", + ".statements.body[0].statements.body[0]", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_True_3 + source = <<~'RUBY' + unless true #0 + #1 + 1 + end #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].predicate.comments.trailing_comment", + ".statements.body[0].statements.body[0]", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_True_4 + source = <<~'RUBY' + while true #0 + #1 + 1 + end #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].predicate.comments.trailing_comment", + ".statements.body[0].statements.body[0]", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_True_5 + source = <<~'RUBY' + until true #0 + #1 + 1 + end #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].predicate.comments.trailing_comment", + ".statements.body[0].statements.body[0]", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_Call_4 + source = <<~'RUBY' + for i in list #0 + #1 + 1 + end #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].collection.comments.trailing_comment", + ".statements.body[0].statements.body[0]", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_Arguments_5 + assert_comments("return 1 #0", [".statements.body[0].arguments.arguments[0].comments.trailing_comment"]) + end + + def test_Call_5 + source = <<~'RUBY' + foo. #0 + bar + RUBY + + assert_comments(source, [".statements.body[0].comments.operator_comment"]) + end + + def test_Call_6 + assert_comments("foo.bar #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_Return_1 + assert_comments("return #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_Yield_1 + assert_comments("yield #0", [".statements.body[0].comments.trailing_comment"]) + end + + def test_Lambda_1 + source = <<~'RUBY' + -> { #0 + #1 + 1 + } #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.opening_comment", + ".statements.body[0].body.body[0]", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_Hash_1 + source = <<~'RUBY' + { + #0 + a: 1 + } #1 + RUBY + + assert_comments(source, [ + ".statements.body[0].elements[0]", + ".statements.body[0].comments.closing_comment", + ]) + end + + def test_MultiWrite_1 + source = <<~'RUBY' + a, + *b, + c = #0 + 1 + RUBY + + assert_comments(source, [".statements.body[0].comments.operator_comment"]) + end + + def test_Hash_2 + source = <<~'RUBY' + { a => #0 + #1 + b #2 + } + RUBY + + assert_comments(source, [ + ".statements.body[0].elements[0].comments.operator_comment", + ".statements.body[0].elements[0].comments.gap_comments[0]", + ".statements.body[0].elements[0].value.comments.trailing_comment", + ]) + end + + def test_Hash_3 + source = <<~'RUBY' + { ** #0 + #1 + a } + RUBY + + assert_comments(source, [ + ".statements.body[0].elements[0].comments.operator_comment", + ".statements.body[0].elements[0].comments.gap_comments[0]", + ]) + end + + def test_Begin_2 + source = <<~'RUBY' + begin #0 + #1 + 1 + rescue #2 + #3 + 2 + ensure #4 + #5 + 3 + end #6 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.opening_comment", + ".statements.body[0].statements.body[0]", + ".statements.body[0].rescue_clause.comments.opening_comment", + ".statements.body[0].rescue_clause.statements.body[0]", + ".statements.body[0].ensure_clause.comments.opening_comment", + ".statements.body[0].ensure_clause.statements.body[0]", + ".statements.body[0].comments.trailing_comment", + ]) + end + + def test_Block_1 + source = <<~'RUBY' + foo { #0 + #1 + 1 + } #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].block.comments.opening_comment", + ".statements.body[0].block.body.body[0]", + ".statements.body[0].block.comments.trailing_comment", + ]) + end + + def test_Block_2 + source = <<~'RUBY' + foo do #0 + #1 + 1 + end #2 + RUBY + + assert_comments(source, [ + ".statements.body[0].block.comments.opening_comment", + ".statements.body[0].block.body.body[0]", + ".statements.body[0].block.comments.trailing_comment", + ]) + end + + def test_Array_1 + source = <<~'RUBY' + [1, #0 + 2] + RUBY + + assert_comments(source, [".statements.body[0].elements[0].comments.trailing_comment"]) + end + + def test_ArrayPattern_3 + source = <<~'RUBY' + foo in [1, #0 + 2] + RUBY + + assert_comments(source, [".statements.body[0].pattern.requireds[0].comments.trailing_comment"]) + end + + def test_BlockParameters_1 + source = <<~'RUBY' + foo { | #0 + a, b + | #1 + } + RUBY + + assert_comments(source, [ + ".statements.body[0].block.parameters.comments.opening_comment", + ".statements.body[0].block.parameters.comments.closing_comment", + ]) + end + + def test_BlockParameters_2 + source = <<~'RUBY' + foo { |; + #0 + #1 + a + | } + RUBY + + assert_comments(source, [ + ".statements.body[0].block.parameters.locals[0]", + ".statements.body[0].block.parameters.locals[1]", + ]) + end + + def test_OptionalParameter_3 + source = <<~'RUBY' + foo { |a = #0 + 1, b| } + RUBY + + assert_comments(source, [".statements.body[0].block.parameters.parameters.optionals[0].comments.operator_comment"]) + end + + def test_Block_3 + source = <<~'RUBY' + foo.bar do + baz + end #0 + RUBY + + assert_comments(source, [".statements.body[0].block.comments.trailing_comment"]) + end + + def test_Def_3 + source = <<~'RUBY' + def foo(#0 + a + ) = #1 + bar + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.lparen_comment", + ".statements.body[0].comments.operator_comment", + ]) + end + + def test_Def_4 + source = <<~'RUBY' + def #0 + #1 + foo + end + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.opening_comment", + ".statements.body[0].comments.keyword_gap_comments[0]", + ]) + end + + def test_LocalVariableTarget_2 + source = <<~'RUBY' + foo in [*a, #0 + b, *c] + RUBY + + assert_comments(source, [".statements.body[0].pattern.left.expression.comments.trailing_comment"]) + end + + def test_Hash_4 + source = <<~'RUBY' + { a: #0 + 1 } + RUBY + + assert_comments(source, [".statements.body[0].elements[0].comments.operator_comment"]) + end + + def test_MatchPredicate_4 + source = <<~'RUBY' + foo in {a: 1, #0 + b: 2} + RUBY + + assert_comments(source, [".statements.body[0].pattern.elements[0].value.comments.trailing_comment"]) + end + + def test_Yield_2 + source = <<~'RUBY' + yield(#0 + foo + ) #1 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.lparen_comment", + ".statements.body[0].comments.rparen_comment", + ]) + end + + def test_Super_1 + source = <<~'RUBY' + super(#0 + foo + ) #1 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.lparen_comment", + ".statements.body[0].comments.rparen_comment", + ]) + end + + def test_CallOperatorWrite_1 + source = <<~'RUBY' + foo.bar += #0 + 1 + RUBY + + assert_comments(source, [".statements.body[0].comments.operator_comment"]) + end + + def test_CallOperatorWrite_2 + source = <<~'RUBY' + foo. #0 + # comment + bar += #1 + 1 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.call_operator_comment", + ".statements.body[0].comments.operator_comment", + ]) + end + + def test_Case_4 + source = <<~'RUBY' + case #0 + foo + #1 + when bar + baz + end + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.keyword_comment", + ".statements.body[0].comments.predicate_gap_comments[0]", + ]) + end + + def test_Call_7 + source = <<~'RUBY' + foo + # receiver gap + . #0 + # message gap + bar + RUBY + + assert_comments(source, [".statements.body[0].comments.operator_comment"]) + end + + def test_Class_2 + source = <<~'RUBY' + class #0 + # keyword gap + Foo < #1 + # inheritance gap + Bar + end + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.opening_comment", + ".statements.body[0].comments.inheritance_operator_comment", + ]) + end + + def test_For_1 + source = <<~'RUBY' + for a in b do #0 + c + end + RUBY + + assert_comments(source, [".statements.body[0].comments.do_comment"]) + end + + def test_For_2 + source = <<~'RUBY' + for a in #0 + b + c + end + RUBY + + assert_comments(source, [".statements.body[0].comments.in_comment"]) + end + + def test_FindPattern_4 + source = <<~'RUBY' + foo in [#0 + *a, + b, + *c + #1 + ] + RUBY + + assert_comments(source, [ + ".statements.body[0].pattern.comments.opening_comment", + ".statements.body[0].pattern.comments.post_right_gap_comments[0]", + ]) + end + + def test_HashPattern_3 + source = <<~'RUBY' + foo in {a:, **b + #0 + } #1 + RUBY + + assert_comments(source, [ + ".statements.body[0].pattern.comments.post_rest_gap_comments[0]", + ".statements.body[0].pattern.comments.closing_comment", + ]) + end + + def test_CallAndWrite_1 + source = <<~'RUBY' + foo. #0 + #1 + bar &&= #2 + #3 + 1 + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.call_operator_comment", + ".statements.body[0].comments.call_gap_comments[0]", + ".statements.body[0].comments.operator_comment", + ".statements.body[0].comments.operator_gap_comments[0]", + ]) + end + + def test_For_3 + source = <<~'RUBY' + for #0 + a in b + c + end + RUBY + + assert_comments(source, [".statements.body[0].comments.for_comment"]) + end + + def test_Call_8 + source = <<~'RUBY' + foo + #0 + . #1 + #2 + bar + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.receiver_gap_comments[0]", + ".statements.body[0].comments.operator_comment", + ".statements.body[0].comments.message_gap_comments[0]", + ]) + end + + def test_FindPattern_5 + source = <<~'RUBY' + foo in [ + #0 + *a, b, *c + ] #1 + RUBY + + assert_comments(source, [ + ".statements.body[0].pattern.comments.pre_left_gap_comments[0]", + ".statements.body[0].pattern.comments.closing_comment", + ]) + end + + def test_Class_3 + source = <<~'RUBY' + class #0 + #1 + Foo < #2 + #3 + Bar + end + RUBY + + assert_comments(source, [ + ".statements.body[0].comments.opening_comment", + ".statements.body[0].comments.keyword_gap_comments[0]", + ".statements.body[0].comments.inheritance_operator_comment", + ".statements.body[0].comments.inheritance_gap_comments[0]", + ]) + end + + private + + def assert_comments(source, paths) + result = Prism.parse(source, partial_script: true, attach_comments: true) + assert(!result.failure?, "Parse error: #{result.errors.first&.message}") + + root = result.value + + paths.each_with_index do |path, index| + scanner = StringScanner.new(path) + node = root + + until scanner.eos? + case + when scanner.scan(/\.(\w+)/) + node = node.public_send(scanner[1]) + when scanner.scan(/\[(\d+)\]/) + node = node[Integer(scanner[1])] + else + flunk("Unexpected path: #{path.inspect}") + end + end + + assert_equal("##{index}", node&.slice, "at #{path}") + end + end + end +end diff --git a/test/prism/newline_test.rb b/test/prism/newline_test.rb index 97e698202d..882a45015e 100644 --- a/test/prism/newline_test.rb +++ b/test/prism/newline_test.rb @@ -7,6 +7,7 @@ module Prism class NewlineTest < TestCase skips = %w[ + comments_test.rb errors_test.rb locals_test.rb regexp_test.rb diff --git a/test/prism/result/comments_test.rb b/test/prism/result/comments_test.rb index 178623a75f..fcd99059d8 100644 --- a/test/prism/result/comments_test.rb +++ b/test/prism/result/comments_test.rb @@ -95,30 +95,6 @@ def test_comment_embedded_document_with_content_on_same_line ) end - def test_attaching_comments - source = <<~RUBY - # Foo class - class Foo - # bar method - def bar - # baz invocation - baz - end # bar end - end # Foo end - RUBY - - result = Prism.parse(source) - result.attach_comments! - tree = result.value - class_node = tree.statements.body.first - method_node = class_node.body.body.first - call_node = method_node.body.body.first - - assert_equal("# Foo class\n# Foo end", class_node.location.comments.map { |c| c.location.slice }.join("\n")) - assert_equal("# bar method\n# bar end", method_node.location.comments.map { |c| c.location.slice }.join("\n")) - assert_equal("# baz invocation", call_node.location.comments.map { |c| c.location.slice }.join("\n")) - end - private def assert_comment(source, type, start_offset:, end_offset:, start_line:, end_line:, start_column:, end_column:) diff --git a/test/prism/ruby/relocation_test.rb b/test/prism/ruby/relocation_test.rb index f8372afa6d..6a798f42c8 100644 --- a/test/prism/ruby/relocation_test.rb +++ b/test/prism/ruby/relocation_test.rb @@ -123,51 +123,7 @@ def test_code_unit_columns assert_equal 11, location_entry.end_code_units_column end - def test_leading_comments - source = "# leading\nclass Foo\nend" - repository = Relocation.string(source).leading_comments - declaration = Prism.parse(source).value.statements.body.first - - node_entry = declaration.save(repository) - location_entry = declaration.save_location(repository) - - assert_equal ["# leading"], node_entry.leading_comments.map(&:slice) - assert_equal ["# leading"], location_entry.leading_comments.map(&:slice) - end - - def test_trailing_comments - source = "class Foo\nend\n# trailing" - repository = Relocation.string(source).trailing_comments - declaration = Prism.parse(source).value.statements.body.first - - node_entry = declaration.save(repository) - location_entry = declaration.save_location(repository) - - assert_equal ["# trailing"], node_entry.trailing_comments.map(&:slice) - assert_equal ["# trailing"], location_entry.trailing_comments.map(&:slice) - end - - def test_comments - source = "# leading\nclass Foo\nend\n# trailing" - repository = Relocation.string(source).comments - declaration = Prism.parse(source).value.statements.body.first - - node_entry = declaration.save(repository) - location_entry = declaration.save_location(repository) - - assert_equal ["# leading", "# trailing"], node_entry.comments.map(&:slice) - assert_equal ["# leading", "# trailing"], location_entry.comments.map(&:slice) - end - def test_misconfiguration - assert_raise Relocation::Repository::ConfigurationError do - Relocation.string("").comments.leading_comments - end - - assert_raise Relocation::Repository::ConfigurationError do - Relocation.string("").comments.trailing_comments - end - assert_raise Relocation::Repository::ConfigurationError do Relocation.string("").code_unit_offsets(Encoding::UTF_8).code_unit_offsets(Encoding::UTF_16LE) end diff --git a/test/prism/ruby/ruby_parser_test.rb b/test/prism/ruby/ruby_parser_test.rb index bc89bdae72..121f898d21 100644 --- a/test/prism/ruby/ruby_parser_test.rb +++ b/test/prism/ruby/ruby_parser_test.rb @@ -110,12 +110,22 @@ def assert_ruby_parser(fixture, allowed_failure) unless actual.nil? assert_equal(expected.line, actual.line, on_failure) assert_equal(expected.file, actual.file, on_failure) + assert_comments(expected, actual) end elsif expected == actual && expected.line && actual.line && expected.file == actual.file puts "#{name} now passes" end end + def assert_comments(expected, actual) + assert_equal(expected.comments, actual.comments, "comments mismatch on #{expected.inspect}") + + expected.each_with_index do |child, index| + next unless child.is_a?(Sexp) && actual[index].is_a?(Sexp) + assert_comments(child, actual[index]) + end + end + def message(expected, actual) if expected == actual nil