| Age | Commit message (Collapse) | Author |
|
The previous example code was too complex and includes extra logics
that's not relevant to its main usage: `bind`.
The new example code focuses on `bind_call` so that readers can
understand how it works more easily.
|
|
|
|
|
|
* This reverts commit 065c48cdf11a1c4cece84db44ed8624d294f8fd5.
* This functionality is very valuable and has already taken 14 years
to agree on the API.
* Let's just document it's byte columns (in the next commit).
* See https://bugs.ruby-lang.org/issues/21783#note-9
|
|
|
|
|
|
|
|
RDoc does not parse the documentation for the Method#call aliases, so we
should combine the aliases into one documentation.
|
|
|
|
|
|
|
|
|
|
|
|
Fix a `-Wint-in-bool-context` warning.
```
proc.c:688:33: warning: '?:' using integer constants in boolean context [-Wint-in-bool-context]
688 | if (RBOOL(get_local_variable_ptr(&env, idItImplicit, FALSE))) {
```
|
|
|
|
and columns"
This reverts commit 073c4e1cc712064e626914fa4a5a8061f903a637.
https://bugs.ruby-lang.org/issues/6012#note-31
> we will cancel this feature in 4.0 because of design ambiguities
> such as whether to return column positions in bytes or characters as
> in [#21783].
[#21783]: https://bugs.ruby-lang.org/issues/21783
|
|
is passed (#15530)
|
|
|
|
[Bug #21049]
|
|
This changeset introduces:
* `Binding#implicit_parameters`
* `Binding#implicit_parameter_get`
* `Binding#implicit_parameter_defined?`
[Bug #21049]
|
|
[Bug #21776]
|
|
[Bug #21776]
|
|
with `RUBY_TYPED_FROZEN_SHAREABLE_NO_REC`,
if the receiver object is shareable on Method objects.
|
|
|
|
to fix inconsistent and wrong current namespace detections.
This includes:
* Moving load_path and related things from rb_vm_t to rb_namespace_t to simplify
accessing those values via namespace (instead of accessing either vm or ns)
* Initializing root_namespace earlier and consolidate builtin_namespace into root_namespace
* Adding VM_FRAME_FLAG_NS_REQUIRE for checkpoints to detect a namespace to load/require files
* Removing implicit refinements in the root namespace which was used to determine
the namespace to be loaded (replaced by VM_FRAME_FLAG_NS_REQUIRE)
* Removing namespaces from rb_proc_t because its namespace can be identified by lexical context
* Starting to use ep[VM_ENV_DATA_INDEX_SPECVAL] to store the current namespace when
the frame type is MAGIC_TOP or MAGIC_CLASS (block handlers don't exist in this case)
|
|
For parameters without names, accessing the name in array index 1 would
be an out-of-bounds read.
|
|
Previously, ruby2_keywords could be used on a method or proc with
post arguments, but I don't think the behavior is desired:
```ruby
def a(*c, **kw) [c, kw] end
def b(*a, b) a(*a, b) end
ruby2_keywords(:b)
b({foo: 1}, bar: 1)
```
This changes ruby2_keywords to emit a warning and not set the
flag on a method/proc with post arguments.
While here, fix the ruby2_keywords specs for warnings, since they
weren't testing what they should be testing. They all warned
because the method didn't accept a rest argument, not because it
accepted a keyword or keyword rest argument.
|
|
Because TypedData_Make_Struct both allocates an object and after
xmallocs memory, all added references must always be writebarrier
protected.
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/13634
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/13541
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/13395
|
|
There is no need to store the symbol and the proc given the
proc has a reference to the symbol.
This makes the cache half as small, now fitting in an object
slot, but also make it easier to allow that cache to be
used by ractors, assuming we'd make `Symbol#to_proc`
return a shareable proc.
Notes:
Merged: https://github.com/ruby/ruby/pull/13390
|
|
In non-main ractors, don't use `sym_proc_cache`. It is not thread-safe
to add to this array without a lock and also it leaks procs from one
ractor to another. Instead, we create a new proc each time. If this
results in poor performance we can come up with a solution later.
Fixes [Bug #21354]
Notes:
Merged: https://github.com/ruby/ruby/pull/13380
|
|
Proc#source_location, Method#source_location and
UnboundMethod#source_location carry more information since
073c4e1cc712064e626914fa4a5a8061f903a637.
https://bugs.ruby-lang.org/issues/6012
https://github.com/ruby/ruby/pull/12539
Notes:
Merged: https://github.com/ruby/ruby/pull/13370
|
|
```
/github/workspace/src/proc.c:2023:65: error: format specifies type 'void *' but the argument has type 'const rb_namespace_t *' (aka 'const struct rb_namespace_struct *') [-Werror,-Wformat-pedantic]
2023 | rb_bug("Unexpected namespace on the method definition: %p", ns);
| ~~ ^~
```
|
|
|
|
IMEMO_NEW takes just one memo value, min/max argc are assigned
directly and packed argc is not used.
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/12941
|
|
This reverts commit 6d75599a1aade9f8081d0691a9da1e62a5428e95.
Updating env was actually needed in local_variable_set.
Alan Wu pointed this out to me.
Notes:
Merged: https://github.com/ruby/ruby/pull/12783
|
|
Also, Binding#local_variable_get and #local_variable_set rejects an
access to numbered parameters.
[Bug #20965] [Bug #21049]
Notes:
Merged: https://github.com/ruby/ruby/pull/12746
|
|
... instead of "rb_env_t **" because no one uses the updated env.
Notes:
Merged: https://github.com/ruby/ruby/pull/12746
|
|
Forwarding argument is optimized not to packed when no other arguments
and an internal object refers values before it. This size is decided
at called time, calculate the local variable index from the fixed end
point.
Notes:
Merged: https://github.com/ruby/ruby/pull/12686
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/12566
|
|
Have this for lead parameters as well as parameters after rest ("post").
[Bug #20974]
Notes:
Merged: https://github.com/ruby/ruby/pull/12547
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/12539
|
|
Fix https://bugs.ruby-lang.org/issues/20977
Notes:
Merged: https://github.com/ruby/ruby/pull/12424
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/12496
|
|
Notes:
Merged-By: zverok <zverok.offline@gmail.com>
|
|
[Bug #20950]
ifunc proc has the ep allocated in the cfunc_proc_t which is the data of
the TypedData object. If an ifunc proc is duplicated, the ep points to
the ep of the source object. If the source object is freed, then the ep
of the duplicated object now points to a freed memory region. If we try
to use the ep we could crash.
For example, the following script crashes:
p = { a: 1 }.to_proc
100.times do
p = p.dup
GC.start
p.call
rescue ArgumentError
end
This commit changes ifunc proc to also duplicate the ep when it is duplicated.
Notes:
Merged: https://github.com/ruby/ruby/pull/12319
|