
Ruby Prism Release v2.0.0
There was an error while loading. Please reload this page.
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
Code
Issues1 (1)
Pull requests1 (1)
Discussions
Actions
Security and quality
Insights
More items
Releases
v2.0.0
v2.0.0
Latest
Latest
Compare
Choose a tag to compare
Sorry, something went wrong.
Filter
Loading
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
v2.0.0
e272736
Highlights
Significant performance and memory usage improvements.
Precompiled platform-specific variants on rubygems.org.
Many documentation improvements, including a new playground.
Prism now ships accurate and complete RBS and RBI definitions.
The license is now owned by the Ruby developers.
Prism now ships an official C++ interface.
Added
Support for parsing Ruby 4.1 syntax:
Add support for &nil to declare that a method accepts no block.
Thoroughly implement void value expression check.
Allow trailing commas in method signatures like def foo(a,); end.
Reject END { break } and END { next }.
a /b/ no longer warns about ambiguous /.
version: "nearest" is now supported. It behaves similarly to version: "current" but will not raise when the version is unsupported, instead falling back to the nearest syntax version prism currently supports.
raise_error was added as a valid option. Prism will raise a SyntaxError when given syntax-invalid code. When true is given, prism decides the formatting (tty?, NO_COLOR, etc.). If you need a specific style, :plain, :style, and :color are also supported values.
Added Prism::ParseResult#continuable to check if the parsed source can become valid by appending more code.
Prism.find takes a Method, UnboundMethod, Proc, or Thread::Backtrace::Location and returns the associated prism AST node.
ForwardingSuperNode now has keyword_loc.
Allow pattern matching with prism nodes to match on location slices, like node in Prism::StringNode[content: "foo"].
Prism.parse_file and similar now accept anything responding to to_path (like Pathname) directly.
attach_comments was added as a valid option. Each comment is attached to the node that ends latest on the comment's line before it, otherwise to the innermost node that contains it (or to that node's statements, if only whitespace and comments come between the comment and the statements), otherwise to the top-level statements. The attached comments are available through Node#comments and through pm_node_comments_size and pm_node_comment in the C API, as well as pm_parser_comment_attachment, pm_parser_comment_ranges_size, and pm_parser_comment_range, which expose the attachments grouped by node. When the option is set, the comments on the parse result are sorted by start offset.
StringQuery#keyword? was added to check if the string query matches a keyword.
Source#checksum was added to retrieve the checksum of the source content.
Changed
Note that for this major version, almost every change listed below is breaking.
Loading
Uh oh!
There was an error while loading. Please reload this page.
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。