Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
a245c342
Unverified
Commit
a245c342
authored
Nov 29, 2021
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
Nov 29, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5589 from dearblue/argerr
Align "wrong number of arguments" messages
parents
a0f38005
c4bca7cb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
5 additions
and
11 deletions
+5
-11
mrbgems/mruby-array-ext/mrblib/array.rb
mrbgems/mruby-array-ext/mrblib/array.rb
+1
-1
mrbgems/mruby-proc-ext/mrblib/proc.rb
mrbgems/mruby-proc-ext/mrblib/proc.rb
+1
-1
mrbgems/mruby-string-ext/mrblib/string.rb
mrbgems/mruby-string-ext/mrblib/string.rb
+1
-1
mrblib/string.rb
mrblib/string.rb
+1
-1
src/vm.c
src/vm.c
+1
-7
No files found.
mrbgems/mruby-array-ext/mrblib/array.rb
View file @
a245c342
...
...
@@ -382,7 +382,7 @@ class Array
def
fill
(
arg0
=
nil
,
arg1
=
nil
,
arg2
=
nil
,
&
block
)
if
arg0
.
nil?
&&
arg1
.
nil?
&&
arg2
.
nil?
&&
!
block
raise
ArgumentError
,
"wrong number of arguments (
0 for
1..3)"
raise
ArgumentError
,
"wrong number of arguments (
given 0, expected
1..3)"
end
beg
=
len
=
0
...
...
mrbgems/mruby-proc-ext/mrblib/proc.rb
View file @
a245c342
...
...
@@ -21,7 +21,7 @@ class Proc
self_arity
=
self
.
arity
if
(
self_arity
>=
0
&&
arity
!=
self_arity
)
||
(
self_arity
<
0
&&
abs
[
self_arity
]
>
arity
)
raise
ArgumentError
,
"wrong number of arguments (
#{
arity
}
for
#{
abs
[
self_arity
]
}
)"
raise
ArgumentError
,
"wrong number of arguments (
given
#{
arity
}
, expected
#{
abs
[
self_arity
]
}
)"
end
end
...
...
mrbgems/mruby-string-ext/mrblib/string.rb
View file @
a245c342
...
...
@@ -151,7 +151,7 @@ class String
#
def
slice!
(
arg1
,
arg2
=
nil
)
raise
FrozenError
,
"can't modify frozen String"
if
frozen?
raise
"wrong number of arguments (for
1..2)"
if
arg1
.
nil?
&&
arg2
.
nil?
raise
ArgumentError
,
"wrong number of arguments (expected
1..2)"
if
arg1
.
nil?
&&
arg2
.
nil?
if
!
arg1
.
nil?
&&
!
arg2
.
nil?
idx
=
arg1
...
...
mrblib/string.rb
View file @
a245c342
...
...
@@ -51,7 +51,7 @@ class String
# ISO 15.2.10.5.18
def
gsub
(
*
args
,
&
block
)
return
to_enum
(
:gsub
,
*
args
)
if
args
.
length
==
1
&&
!
block
raise
ArgumentError
,
"wrong number of arguments"
unless
(
1
..
2
).
include?
(
args
.
length
)
raise
ArgumentError
,
"wrong number of arguments
(given
#{
args
.
length
}
, expected 1..2)
"
unless
(
1
..
2
).
include?
(
args
.
length
)
pattern
,
replace
=
*
args
plen
=
pattern
.
length
...
...
src/vm.c
View file @
a245c342
...
...
@@ -963,13 +963,7 @@ argnum_error(mrb_state *mrb, mrb_int num)
if
(
argc
==
0
&&
mrb
->
c
->
ci
->
nk
!=
0
&&
!
mrb_hash_empty_p
(
mrb
,
mrb
->
c
->
ci
->
stack
[
1
]))
{
argc
++
;
}
if
(
mrb
->
c
->
ci
->
mid
)
{
str
=
mrb_format
(
mrb
,
"'%n': wrong number of arguments (%i for %i)"
,
mrb
->
c
->
ci
->
mid
,
argc
,
num
);
}
else
{
str
=
mrb_format
(
mrb
,
"wrong number of arguments (%i for %i)"
,
argc
,
num
);
}
str
=
mrb_format
(
mrb
,
"wrong number of arguments (given %i, expected %i)"
,
argc
,
num
);
exc
=
mrb_exc_new_str
(
mrb
,
E_ARGUMENT_ERROR
,
str
);
mrb_exc_set
(
mrb
,
exc
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment