Commit graph

12164 commits

Author SHA1 Message Date
tompng
8e53f09baa [ruby/reline] Add constant MINIMUM_SCROLLBAR_HEIGHT for scrollbar rendering when dialog content is very long
d4c95f89ec
2023-01-18 14:49:29 +00:00
tompng
a712f2a2a0 [ruby/reline] Fix dialog scrollbar rendering position and disappearing bug
e21b69ade4
2023-01-18 14:49:28 +00:00
Stan Lo
cb9b885e78 [ruby/irb] Store context in RubyLex
Some background for this refactor:

1. Through a RubyLex instance's lifetime, the context passed to its methods
   should be the same.
   Given that `Context` is only initialised in `Irb#initialize`,
   this should be true.

2. When `RubyLex` is initialised, the context object should be accessible.
   This is also true in all 3 of `RubyLex.new`'s invocations.

With the above observations, we should be able to store the context in `RubyLex`
as an instance variable. And doing so will make `RubyLex`'s instance methods
easier to use and maintain.

5c8d3df2df
2023-01-14 09:19:09 +00:00
Yusuke Endoh
94d6d6d93f [ruby/error_highlight] Identify which node in Foo::Bar::Baz causes a NameError
In Ruby 3.2 or later, a nested constant access like `Foo::Bar::Baz` is
compiled to one instruction by the optimization https://github.com/ruby/ruby/pull/6187

We try to spot which sub-node caues a NameError in question based on the
constant name. We will give up if the same constant name is accessed in
a nested access (`Foo::Foo`).

Fixes https://github.com/ruby/error_highlight/pull/31

0a4db7da0a
2023-01-13 08:25:09 +00:00
Stan Lo
207f8d0027 [ruby/irb] Avoid calling private methods on the main object
(https://github.com/ruby/irb/pull/498)

When the main object is frozen, `IRB` wraps a `SimpleDelegator` around it.
But because `SimpleDelegator` doesn't delegate private methods, methods like
`require_relative` or `const_get` would cause error, which are needed for
lazily loading commands.

This commit works around this limitation by avoiding those private method calls
when setting up command execution.
2023-01-12 11:49:16 +00:00
Stan Lo
019c65828b [ruby/irb] Remove redundant argument defaults from some RubyLex
methods
(https://github.com/ruby/irb/pull/502)

* Remove unnecessary parameter defaults

These methods are always called with tokens specified. So their default
`@tokens` value is never used and is misleading.

* Remove unnecessary context default

* Require tokens for `RubyLex#check_state`
2023-01-12 10:30:17 +00:00
elfham
aa66595876 [ruby/reline] Update to Unicode 15.0.0
(https://github.com/ruby/reline/pull/437)

* Update to Unicode 14.0.0

* Update to Unicode 15.0.0
2023-01-12 09:40:34 +00:00
Jean Boussier
a8537eae2a [ruby/mutex_m] Avoid anonymous eval
It makes it hard to locate code when profiling etc.

8760ab19ec
2023-01-12 05:41:59 +00:00
Hiroshi SHIBATA
0e21c9f57e [ruby/mutex_m] Drop to support Ruby 2.4
9245b9a63a
2023-01-12 05:38:31 +00:00
tomoya ishida
0abb4b6348 [ruby/reline] Pass unmodifined lines(that does not include escape
sequence) to check_multiline_prompt
(https://github.com/ruby/reline/pull/458)

* pass unmodified lines to check_multiline_prompt

* Add test to check that output modified by output_modifier_proc is not passed to prompt_proc
2023-01-12 00:14:53 +00:00
Hiroshi SHIBATA
048751dd73
Generate parser-text.rb with bcdc058e50 2023-01-12 07:54:39 +09:00
Jean Boussier
bcdc058e50 [ruby/racc] Get rid of anonymous eval calls
Things declared in anonymous eval are always annoying to locate.
(profilers, etc)

f304205256
2023-01-12 07:52:29 +09:00
Masataka Pocke Kuwabara
11e15b4d48 [ruby/racc] Make racc Ractor compatible
1948de9d1d
2023-01-12 07:52:25 +09:00
Hiroshi SHIBATA
7e283c585e [ruby/irb] Formatting to header styles
cef125850d
2023-01-11 22:29:10 +00:00
Hiroshi SHIBATA
128398e7cd [ruby/irb] After Ruby 2.0, coding is always utf-8
7a94bc4135
2023-01-11 22:29:10 +00:00
Hiroshi SHIBATA
c7bb8d67b7 [ruby/irb] Removed Release Version and Revisions for old VCS software
07fae94862
2023-01-11 22:29:09 +00:00
Stan Lo
c693dfd7ef [ruby/irb] Drop unused arguments in RubyLex
(https://github.com/ruby/irb/pull/504)

* Simplify `RubyLex#set_prompt`

It's optional argument is never used by any caller.

* Remove the optional `p` argument from `RubyLex#set_input`

The argument is only used in a test case, which can be easily replaced by
a block argument.
2023-01-11 21:26:18 +00:00
Jean Boussier
e85ef212de [ruby/set] Avoid the block or return pattern to save Proc allocations
Using the block param in a boolean context like this cause it to be
allocated.

Using it with an `if` or `unless` was optimized in 3.2
(https://github.com/ruby/ruby/pull/6286) but using it with `or`
or `and` wasn't.

```ruby
def foo(&block)
  block or return 1
end

puts RubyVM::InstructionSequence.of(method(:foo)).disasm
== disasm: #<ISeq:foo@(irb):11 (11,0)-(13,3)> (catch: false)
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: 0, kw: -1@-1, kwrest: -1])
[ 1] block@0<Block>
0000 getblockparam                          block@0, 0                (  12)[LiCa]
0003 dup
0004 branchif                               10
0006 pop
0007 putobject_INT2FIX_1_
0008 leave                                  [Re]
0009 putnil
0010 leave
```

versus

```
def foo(&block)
  return 1 if block
end

puts RubyVM::InstructionSequence.of(method(:foo)).disasm
== disasm: #<ISeq:foo@(irb):15 (15,0)-(17,3)> (catch: false)
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: 0, kw: -1@-1, kwrest: -1])
[ 1] block@0<Block>
0000 getblockparamproxy                     block@0, 0                (  16)[LiCa]
0003 branchunless                           7
0005 putobject_INT2FIX_1_
0006 leave                                                            (  17)[Re]
0007 putnil                                                           (  16)
0008 leave
```

e89da977d4
2023-01-11 09:26:08 +00:00
Phillip Hellewell
97f8f2c470 [ruby/reline] Add key binding for Delete
603eacee22
2023-01-10 12:18:14 +00:00
Hiroshi SHIBATA
a43f1d90c2 Merge RubyGems and Bundler master
from 0635c1423d
2023-01-10 15:53:07 +09:00
Hiroshi SHIBATA
f2fc7519b7
Removed vendored LICENSE file. 2023-01-10 13:13:06 +09:00
David Rodríguez
2e0159c5f2 [rubygems/rubygems] Fix resolver edge case
Let it deal with legacy gems with equivalent version and different
dependencies.

b430babe97
2023-01-10 12:58:28 +09:00
Nobuyoshi Nakada
29dc9378d9 mkmf.rb: Refine message from pkg_config 2023-01-09 21:44:15 +09:00
Nobuyoshi Nakada
0d7bbfc941 mkmf.rb: Prefer caller_locations over parsing caller 2023-01-09 21:44:15 +09:00
Burdette Lamar
41a947e72a [ruby/uri] [DOC] Enhanced RDoc for URI
(https://github.com/ruby/uri/pull/55)

89ab4f1407
2023-01-08 23:14:50 +00:00
Burdette Lamar
20b691d664 [ruby/uri] [DOC] Enhanced RDoc for URI.decode_www_form
(https://github.com/ruby/uri/pull/53)

ce379e6125
2023-01-08 17:11:12 +00:00
Nobuyoshi Nakada
89546dce21 [rubygems/rubygems] [DOC] Remove internal document about Kernel monkey patch
https://bugs.ruby-lang.org/issues/19285

1e22219ed4
2023-01-08 08:09:34 +00:00
Nobuyoshi Nakada
55aa1a206c [rubygems/rubygems] LoadError#path on the caught exception does not need to protect
a31f5d1a18
2023-01-08 08:09:34 +00:00
Nobuyoshi Nakada
1a1b653c9c [rubygems/rubygems] Let RDoc parse the doc of Kernel#require
Since RDoc does not parse string literals as documents, `eval` the
entire file instead of embedding in a here-document.
On the contrary, as `gem_original_require` alias is an implementation
detail but not for users, it should not be documented.

cad4cf16cf
2023-01-08 08:09:33 +00:00
Burdette Lamar
fd98169e00 [ruby/uri] [DOC] Common rdoc (https://github.com/ruby/uri/pull/52)
be8047028f
2023-01-07 19:22:36 +00:00
Yuki Nishijima
651a098ea1 [ruby/did_you_mean] Keep the deprecated API for another year in case this could break 'bundle install'
0f4b0806b7
2023-01-07 08:47:05 +00:00
Burdette Lamar
ddbf7be94d [ruby/uri] [DOC] Enhanced RDoc for common methods
(https://github.com/ruby/uri/pull/50)

7ff4fb372b
2023-01-06 14:20:38 +00:00
Nobuyoshi Nakada
b94656147b mkmf.rb: Refactor splitting configure_args and remove duplicate code 2023-01-06 20:00:53 +09:00
Burdette Lamar
f7243d1afb [ruby/uri] [DOC] Common methods rdoc
(https://github.com/ruby/uri/pull/49)

02dfc79366
2023-01-04 19:59:05 +00:00
yoka
799d805e21 [rubygems/rubygems] Raise invalid option when bundle open --path is called without a value
c242311158
2023-01-04 13:13:19 +00:00
yoka
87c17a141d [rubygems/rubygems] Enhance bundle open with --path option
3bf8e59304
2023-01-04 13:13:19 +00:00
Stan Lo
3d6500ee6e [ruby/irb] workspace.rb cleanup
(https://github.com/ruby/irb/pull/489)

* Remove unnecessary Binding#source_location check

`Binding#source_location` was added in 2.6, which is the minimum supported
version now. So this check is no longer necessary.

* Remove unused IRB.delete_caller

This method was added in the earliest version of IRB:

f47808999d

But it's not currently referenced by anything. We can verify this with a
org-wide search result:

https://github.com/search?q=org%3Aruby+delete_caller&type=code
2023-01-04 09:35:57 +00:00
Joel Anderson
e25c173c97 [ruby/reline] correct Win32API capitalization for JRuby
JRuby 9.4.0.0 introduced a change in case sensitivity in require statements,
meaning that an inclusion of `win32api` loaded Win32API.rb. With this change,
the require statement needs to be updated to the correct capitalization of the
filename to avoid reline failures in newer versions of JRuby.

d6e7c9e1d9
2023-01-04 06:32:46 +00:00
Burdette Lamar
59cf9ebf4d [ruby/uri] [DOC] Enhanced RDoc for common methods
(https://github.com/ruby/uri/pull/48)

2bfd848c26
2023-01-03 15:33:45 +00:00
Takashi Kokubun
2bbf63dd86 Remove lib/mjit/instruction.rb
This was accidentally re-introduced in f6620037ba.

[Bug #19298]
2023-01-02 13:13:01 -08:00
tomoya ishida
34f8ca1714 [ruby/irb] Fix prompt and code mismatch
(https://github.com/ruby/irb/pull/386)

* fix prompt and code mismatch

* Add test for prompt and code mismatch bug

a5765d8177

Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-01-02 19:25:11 +00:00
Mark Doliner
a4e9606da4 [rubygems/rubygems] Remove stray word in bundle config man page.
There was an extra word ("with") in this sentence.

ad3de5126c
2023-01-01 15:04:43 +00:00
BurdetteLamar
44b7fd8d4f [ruby/net-http] Enhanced RDoc for HTTPHeader
6a282eccdd
2023-01-01 15:02:14 +00:00
Mau Magnaguagno
ec7e082906 [ruby/irb] Refactor RubyLex#process_literal_type
(https://github.com/ruby/irb/pull/350)

Simplify part of regex ``[_a-zA-Z0-9]`` with equivalent shorthand ``\w``.
Replace case-when with match ``$1`` or default value ``?"``, making intention more clear.
2022-12-27 17:05:32 +00:00
Hiroshi SHIBATA
c09f342d04 [ruby/irb] Fix wrong conf path with XDG_CONFIG_HOME. It should be under the HOME directory, not current directory
33a5e55ffd
2022-12-27 00:09:12 +00:00
BurdetteLamar
8f678d61a5 [ruby/net-http] Adding links to references
1c8151aaf3
2022-12-26 22:17:18 +00:00
tompng
953d4c22ed [ruby/irb] fix indent depth calculation after heredoc and embdoc
b7973dd2d2
2022-12-26 13:03:07 -08:00
tompng
f20aac5c59 [ruby/irb] fix auto-indent after multiline string
f65ec49684
2022-12-26 13:03:07 -08:00
Gustavo Ribeiro
f5a035daf9 [rubygems/rubygems] deprecate gem build -C flag
fac241d4ef
2022-12-26 19:08:55 +00:00
Gustavo Ribeiro
08f6196bda [rubygems/rubygems] add global flag (-C) to change execution directory
312fc36711
2022-12-26 19:08:55 +00:00