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
59dabb38
Unverified
Commit
59dabb38
authored
Mar 12, 2018
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
Mar 12, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3963 from dearblue/forced-block-arguments
Give me block by mrb_get_args() (forced block arguments)
parents
843053c9
a5ac49de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
include/mruby.h
include/mruby.h
+1
-1
src/class.c
src/class.c
+7
-1
No files found.
include/mruby.h
View file @
59dabb38
...
...
@@ -843,7 +843,7 @@ MRB_API struct RClass * mrb_define_module_under(mrb_state *mrb, struct RClass *o
* | `i` | {Integer} | {mrb_int} | |
* | `b` | boolean | {mrb_bool} | |
* | `n` | {Symbol} | {mrb_sym} | |
* | `&` | block | {mrb_value} |
|
* | `&` | block | {mrb_value} |
when &! gives raised exception if no block given.
|
* | `*` | rest arguments | {mrb_value} *, {mrb_int} | Receive the rest of arguments as an array. |
* | | | optional | | After this spec following specs would be optional. |
* | `?` | optional given | {mrb_bool} | `TRUE` if preceding argument is given. Used to check optional argument is given. |
...
...
src/class.c
View file @
59dabb38
...
...
@@ -593,7 +593,7 @@ mrb_get_argv(mrb_state *mrb)
n: Symbol [mrb_sym]
d: Data [void*,mrb_data_type const] 2nd argument will be used to check data type so it won't be modified
I: Inline struct [void*]
&: Block [mrb_value]
&: Block [mrb_value]
when &! gives raised exception if no block given
*: rest argument [mrb_value*,mrb_int] The rest of the arguments as an array; *! avoid copy of the stack
|: optional Following arguments are optional
?: optional given [mrb_bool] true if preceding argument (optional) is given
...
...
@@ -937,6 +937,12 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
else
{
bp
=
mrb
->
c
->
stack
+
mrb
->
c
->
ci
->
argc
+
1
;
}
if
(
*
format
==
'!'
)
{
format
++
;
if
(
mrb_nil_p
(
*
bp
))
{
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"no block given"
);
}
}
*
p
=
*
bp
;
}
break
;
...
...
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