class RuboCop::Cop::Sorbet::SignatureBuildOrder
def node_reparsed_with_modern_features(node)
"index sends" (i.e. `[]` calls) back to index accessors (i.e. as `foo[bar]``).
Modern features include "index send" emitting, which is necessary to unparse
This method exists to reparse the current node with modern features enabled.
def node_reparsed_with_modern_features(node) # Create a new parser with a modern builder class instance parser = Parser::CurrentRuby.new(ModernBuilder.new) # Create a new source buffer with the node source buffer = Parser::Source::Buffer.new(processed_source.path, source: node.source) # Re-parse the buffer parser.parse(buffer) end