Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/string/bytes.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Returns an array of the bytes in +self+:
'こんにちは'.bytes
# => [227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]

Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString].
Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non-String].
2 changes: 1 addition & 1 deletion doc/string/chars.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Returns an array of the characters in +self+:
'こんにちは'.chars # => ["こ", "ん", "に", "ち", "は"]
''.chars # => []

Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString].
Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non-String].
2 changes: 1 addition & 1 deletion doc/string/codepoints.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ each codepoint is the integer value for a character:
'こんにちは'.codepoints # => [12371, 12435, 12395, 12385, 12399]
''.codepoints # => []

Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString].
Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non-String].
2 changes: 1 addition & 1 deletion doc/string/getbyte.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ More examples:
s.bytes # => [227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]
s.getbyte(2) # => 147

Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString].
Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non-String].
2 changes: 1 addition & 1 deletion doc/string/grapheme_clusters.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ Details:
s.chars # => ["a", "̈"] # Two characters.
s.chars.map {|char| char.ord } # => [97, 776] # Their values.

Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString].
Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non-String].
2 changes: 1 addition & 1 deletion doc/string/inspect.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ A few, however, have special renderings:
13.chr.inspect # => "\"\\r\"" # CR
27.chr.inspect # => "\"\\e\"" # ESC

Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString].
Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non-String].
2 changes: 1 addition & 1 deletion doc/string/intern.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ creating it if it did not already exist:
'foo'.intern # => :foo
'こんにちは'.intern # => :こんにちは

Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString].
Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non-String].

2 changes: 1 addition & 1 deletion doc/string/ord.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Returns the integer ordinal of the first character of +self+:
'hello'.ord # => 104
'こんにちは'.ord # => 12371

Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString].
Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non-String].
2 changes: 1 addition & 1 deletion doc/string/partition.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ then performs the equivalent of <tt>self.index(pattern)</tt>
'hello'.partition('x') # => ["hello", "", ""]
'こんにちは'.partition('に') # => ["こん", "に", "ちは"]

Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString].
Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non-String].
2 changes: 1 addition & 1 deletion doc/string/rpartition.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ then searches for the last matching substring
'hello'.rpartition('') # => ["hello", "", ""]
'こんにちは'.rpartition('に') # => ["こん", "に", "ちは"]

Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString].
Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non-String].
2 changes: 1 addition & 1 deletion doc/string/scan.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ With a block given, calls the block with each result; returns +self+:
# => ["w", "o"]
# => ["r", "l"]

Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString].
Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non-String].
2 changes: 1 addition & 1 deletion doc/string/split.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ But the latter:
- Has poorer performance because it creates an intermediate array.
- Returns an array (instead of +self+).

Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString].
Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non-String].
6 changes: 3 additions & 3 deletions doc/stringio/stringio.md
Original file line number Diff line number Diff line change
Expand Up @@ -690,11 +690,11 @@ Reading:

[basic reading]: rdoc-ref:StringIO@Basic+Reading
[basic writing]: rdoc-ref:StringIO@Basic+Writing
[bom (byte order mark)]: rdoc-ref:StringIO@BOM+-28Byte+Order+Mark-29
[bom (byte order mark)]: rdoc-ref:StringIO@BOM+Byte+Order+Mark
[data mode]: rdoc-ref:StringIO@Data+Mode
[encodings]: rdoc-ref:StringIO@Encodings
[end-of-stream]: rdoc-ref:StringIO@End-of-Stream
[line number]: rdoc-ref:StringIO@Line+Number
[open/closed streams]: rdoc-ref:StringIO@Open-2FClosed+Streams
[open/closed streams]: rdoc-ref:StringIO@OpenClosed+Streams
[position]: rdoc-ref:StringIO@Position
[read/write mode]: rdoc-ref:StringIO@Read-2FWrite+Mode
[read/write mode]: rdoc-ref:StringIO@ReadWrite+Mode
2 changes: 1 addition & 1 deletion doc/strscan/link_refs.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[1]: rdoc-ref:StringScanner@Stored+String
[2]: rdoc-ref:StringScanner@Byte+Position+-28Position-29
[2]: rdoc-ref:StringScanner@Byte+Position+Position
[3]: rdoc-ref:StringScanner@Target+Substring
[4]: rdoc-ref:StringScanner@Setting+the+Target+Substring
[5]: rdoc-ref:StringScanner@Traversing+the+Target+Substring
Expand Down
39 changes: 22 additions & 17 deletions gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3633,9 +3633,11 @@ rb_gc_register_address(VALUE *addr)
VALUE obj = *addr;

struct global_object_list *tmp = ALLOC(struct global_object_list);
tmp->next = vm->global_object_list;
tmp->varptr = addr;
vm->global_object_list = tmp;
RB_VM_LOCKING() {
tmp->next = vm->global_object_list;
tmp->varptr = addr;
vm->global_object_list = tmp;
}

/*
* Because some C extensions have assignment-then-register bugs,
Expand All @@ -3653,22 +3655,25 @@ void
rb_gc_unregister_address(VALUE *addr)
{
rb_vm_t *vm = GET_VM();
struct global_object_list *tmp = vm->global_object_list;

if (tmp->varptr == addr) {
vm->global_object_list = tmp->next;
SIZED_FREE(tmp);
return;
}
while (tmp->next) {
if (tmp->next->varptr == addr) {
struct global_object_list *t = tmp->next;
struct global_object_list *tmp;
RB_VM_LOCKING() {
tmp = vm->global_object_list;
if (tmp->varptr == addr) {
vm->global_object_list = tmp->next;
SIZED_FREE(tmp);
}
else {
while (tmp->next) {
if (tmp->next->varptr == addr) {
struct global_object_list *t = tmp->next;

tmp->next = tmp->next->next;
SIZED_FREE(t);
break;
tmp->next = tmp->next->next;
SIZED_FREE(t);
break;
}
tmp = tmp->next;
}
}
tmp = tmp->next;
}
}

Expand Down
1 change: 0 additions & 1 deletion internal/imemo.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ struct vm_svar {
/*! THROW_DATA */
struct vm_throw_data {
VALUE flags;
VALUE reserved;
const VALUE throw_obj;
const struct rb_control_frame_struct *catch_frame;
int throw_state;
Expand Down
2 changes: 1 addition & 1 deletion lib/error_highlight/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module ErrorHighlight
# Currently, ErrorHighlight.spot only supports a single-line code fragment.
# Therefore, if the return value is not nil, first_lineno and last_lineno will have
# the same value. If the relevant code fragment spans multiple lines
# (e.g., Array#[] of +ary[(newline)expr(newline)]+), the method will return nil.
# (e.g., Array#[] of <tt>ary[(newline)expr(newline)]</tt>), the method will return nil.
# This restriction may be removed in the future.
def self.spot(obj, **opts)
case obj
Expand Down
8 changes: 4 additions & 4 deletions lib/net/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class HTTPHeaderSyntaxError < StandardError; end
# For information about \HTTP, see:
#
# - {Hypertext Transfer Protocol}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol].
# - {Technical overview}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Technical_overview].
# - {Technology}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Technology].
#
# == About the Examples
#
Expand Down Expand Up @@ -72,7 +72,7 @@ class HTTPHeaderSyntaxError < StandardError; end
#
# - If performance is important, consider using sessions, which lower request overhead.
# This {session}[rdoc-ref:Net::HTTP@Sessions] has multiple requests for
# {HTTP methods}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods]
# {HTTP methods}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Method]
# and {WebDAV methods}[https://en.wikipedia.org/wiki/WebDAV#Implementation]:
#
# Net::HTTP.start(hostname) do |http|
Expand Down Expand Up @@ -198,7 +198,7 @@ class HTTPHeaderSyntaxError < StandardError; end
# In the block, you can use these instance methods,
# each of which that sends a single request:
#
# - {HTTP methods}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods]:
# - {HTTP methods}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Method]:
#
# - #get, #request_get: GET.
# - #head, #request_head: HEAD.
Expand Down Expand Up @@ -447,7 +447,7 @@ class HTTPHeaderSyntaxError < StandardError; end
# if the response has header <tt>'Content-Range'</tt>.
#
# Otherwise decompression (or not) depends on the value of header
# {Content-Encoding}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-encoding-response-header]:
# {Content-Encoding}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Content-Encoding_2]:
#
# - <tt>'deflate'</tt>, <tt>'gzip'</tt>, or <tt>'x-gzip'</tt>:
# decompresses the body and deletes the header.
Expand Down
8 changes: 4 additions & 4 deletions lib/prism.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@ def initialize(version)
end

# :call-seq:
# Prism::lex_compat(source, **options) -> LexCompat::Result
# lex_compat(source, **options) -> LexCompat::Result
#
# Returns a parse result whose value is an array of tokens that closely
# resembles the return value of Ripper::lex.
# resembles the return value of Ripper.lex.
#
# For supported options, see Prism::parse.
# For supported options, see Prism.parse.
def self.lex_compat(source, **options)
LexCompat.new(source, **options).result # steep:ignore
end

# :call-seq:
# Prism::load(source, serialized, freeze) -> ParseResult
# load(source, serialized, freeze) -> ParseResult
#
# Load the serialized AST using the source as a reference into a tree.
def self.load(source, serialized, freeze = false)
Expand Down
60 changes: 30 additions & 30 deletions lib/prism/desugar_compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,137 +254,137 @@ def desugar # :nodoc:
# DesugarCompiler is a compiler that desugars Ruby code into a more primitive
# form. This is useful for consumers that want to deal with fewer node types.
class DesugarCompiler < MutationCompiler
# @@foo &&= bar
# `@@foo &&= bar`
#
# becomes
#
# @@foo && @@foo = bar
# `@@foo && @@foo = bar`
def visit_class_variable_and_write_node(node)
node.desugar
end

# @@foo ||= bar
# `@@foo ||= bar`
#
# becomes
#
# defined?(@@foo) ? @@foo : @@foo = bar
# `defined?(@@foo) ? @@foo : @@foo = bar`
def visit_class_variable_or_write_node(node)
node.desugar
end

# @@foo += bar
# `@@foo += bar`
#
# becomes
#
# @@foo = @@foo + bar
# `@@foo = @@foo + bar`
def visit_class_variable_operator_write_node(node)
node.desugar
end

# Foo &&= bar
# `Foo &&= bar`
#
# becomes
#
# Foo && Foo = bar
# `Foo && Foo = bar`
def visit_constant_and_write_node(node)
node.desugar
end

# Foo ||= bar
# `Foo ||= bar`
#
# becomes
#
# defined?(Foo) ? Foo : Foo = bar
# `defined?(Foo) ? Foo : Foo = bar`
def visit_constant_or_write_node(node)
node.desugar
end

# Foo += bar
# `Foo += bar`
#
# becomes
#
# Foo = Foo + bar
# `Foo = Foo + bar`
def visit_constant_operator_write_node(node)
node.desugar
end

# $foo &&= bar
# `$foo &&= bar`
#
# becomes
#
# $foo && $foo = bar
# `$foo && $foo = bar`
def visit_global_variable_and_write_node(node)
node.desugar
end

# $foo ||= bar
# `$foo ||= bar`
#
# becomes
#
# defined?($foo) ? $foo : $foo = bar
# `defined?($foo) ? $foo : $foo = bar`
def visit_global_variable_or_write_node(node)
node.desugar
end

# $foo += bar
# `$foo += bar`
#
# becomes
#
# $foo = $foo + bar
# `$foo = $foo + bar`
def visit_global_variable_operator_write_node(node)
node.desugar
end

# @foo &&= bar
# `@foo &&= bar`
#
# becomes
#
# @foo && @foo = bar
# `@foo && @foo = bar`
def visit_instance_variable_and_write_node(node)
node.desugar
end

# @foo ||= bar
# `@foo ||= bar`
#
# becomes
#
# @foo || @foo = bar
# `@foo || @foo = bar`
def visit_instance_variable_or_write_node(node)
node.desugar
end

# @foo += bar
# `@foo += bar`
#
# becomes
#
# @foo = @foo + bar
# `@foo = @foo + bar`
def visit_instance_variable_operator_write_node(node)
node.desugar
end

# foo &&= bar
# `foo &&= bar`
#
# becomes
#
# foo && foo = bar
# `foo && foo = bar`
def visit_local_variable_and_write_node(node)
node.desugar
end

# foo ||= bar
# `foo ||= bar`
#
# becomes
#
# foo || foo = bar
# `foo || foo = bar`
def visit_local_variable_or_write_node(node)
node.desugar
end

# foo += bar
# `foo += bar`
#
# becomes
#
# foo = foo + bar
# `foo = foo + bar`
def visit_local_variable_operator_write_node(node)
node.desugar
end
Expand Down
Loading