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
cc636f33
Unverified
Commit
cc636f33
authored
Sep 17, 2019
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
Sep 17, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4715 from dearblue/need-block
Entrust "no block given" error to `mrb_get_args()`
parents
d45c94fe
099a4f39
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
8 additions
and
32 deletions
+8
-32
mrbgems/mruby-class-ext/src/class.c
mrbgems/mruby-class-ext/src/class.c
+1
-5
mrbgems/mruby-fiber/src/fiber.c
mrbgems/mruby-fiber/src/fiber.c
+1
-4
mrbgems/mruby-metaprog/src/metaprog.c
mrbgems/mruby-metaprog/src/metaprog.c
+1
-4
mrbgems/mruby-object-ext/src/object.c
mrbgems/mruby-object-ext/src/object.c
+1
-5
mrbgems/mruby-objectspace/src/mruby_objectspace.c
mrbgems/mruby-objectspace/src/mruby_objectspace.c
+1
-5
mrbgems/mruby-proc-ext/src/proc.c
mrbgems/mruby-proc-ext/src/proc.c
+1
-4
src/proc.c
src/proc.c
+2
-5
No files found.
mrbgems/mruby-class-ext/src/class.c
View file @
cc636f33
...
...
@@ -40,11 +40,7 @@ mrb_mod_module_exec(mrb_state *mrb, mrb_value self)
mrb_int
argc
;
mrb_value
blk
;
mrb_get_args
(
mrb
,
"*&"
,
&
argv
,
&
argc
,
&
blk
);
if
(
mrb_nil_p
(
blk
))
{
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"no block given"
);
}
mrb_get_args
(
mrb
,
"*&!"
,
&
argv
,
&
argc
,
&
blk
);
mrb
->
c
->
ci
->
target_class
=
mrb_class_ptr
(
self
);
return
mrb_yield_cont
(
mrb
,
blk
,
self
,
argc
,
argv
);
...
...
mrbgems/mruby-fiber/src/fiber.c
View file @
cc636f33
...
...
@@ -72,14 +72,11 @@ fiber_init(mrb_state *mrb, mrb_value self)
mrb_value
blk
;
size_t
slen
;
mrb_get_args
(
mrb
,
"&"
,
&
blk
);
mrb_get_args
(
mrb
,
"&
!
"
,
&
blk
);
if
(
f
->
cxt
)
{
mrb_raise
(
mrb
,
E_RUNTIME_ERROR
,
"cannot initialize twice"
);
}
if
(
mrb_nil_p
(
blk
))
{
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"tried to create Fiber object without a block"
);
}
p
=
mrb_proc_ptr
(
blk
);
if
(
MRB_PROC_CFUNC_P
(
p
))
{
mrb_raise
(
mrb
,
E_FIBER_ERROR
,
"tried to create Fiber from C defined method"
);
...
...
mrbgems/mruby-metaprog/src/metaprog.c
View file @
cc636f33
...
...
@@ -389,10 +389,7 @@ mod_define_singleton_method(mrb_state *mrb, mrb_value self)
mrb_sym
mid
;
mrb_value
blk
=
mrb_nil_value
();
mrb_get_args
(
mrb
,
"n&"
,
&
mid
,
&
blk
);
if
(
mrb_nil_p
(
blk
))
{
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"no block given"
);
}
mrb_get_args
(
mrb
,
"n&!"
,
&
mid
,
&
blk
);
p
=
(
struct
RProc
*
)
mrb_obj_alloc
(
mrb
,
MRB_TT_PROC
,
mrb
->
proc_class
);
mrb_proc_copy
(
p
,
mrb_proc_ptr
(
blk
));
p
->
flags
|=
MRB_PROC_STRICT
;
...
...
mrbgems/mruby-object-ext/src/object.c
View file @
cc636f33
...
...
@@ -100,11 +100,7 @@ mrb_obj_instance_exec(mrb_state *mrb, mrb_value self)
mrb_value
blk
;
struct
RClass
*
c
;
mrb_get_args
(
mrb
,
"*&"
,
&
argv
,
&
argc
,
&
blk
);
if
(
mrb_nil_p
(
blk
))
{
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"no block given"
);
}
mrb_get_args
(
mrb
,
"*&!"
,
&
argv
,
&
argc
,
&
blk
);
switch
(
mrb_type
(
self
))
{
case
MRB_TT_SYMBOL
:
...
...
mrbgems/mruby-objectspace/src/mruby_objectspace.c
View file @
cc636f33
...
...
@@ -161,11 +161,7 @@ os_each_object(mrb_state *mrb, mrb_value self)
{
mrb_value
cls
=
mrb_nil_value
();
struct
os_each_object_data
d
;
mrb_get_args
(
mrb
,
"&|C"
,
&
d
.
block
,
&
cls
);
if
(
mrb_nil_p
(
d
.
block
))
{
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"Expected block in ObjectSpace.each_object."
);
}
mrb_get_args
(
mrb
,
"&!|C"
,
&
d
.
block
,
&
cls
);
d
.
target_module
=
mrb_nil_p
(
cls
)
?
NULL
:
mrb_class_ptr
(
cls
);
d
.
count
=
0
;
...
...
mrbgems/mruby-proc-ext/src/proc.c
View file @
cc636f33
...
...
@@ -72,10 +72,7 @@ mrb_kernel_proc(mrb_state *mrb, mrb_value self)
{
mrb_value
blk
;
mrb_get_args
(
mrb
,
"&"
,
&
blk
);
if
(
mrb_nil_p
(
blk
))
{
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"tried to create Proc object without a block"
);
}
mrb_get_args
(
mrb
,
"&!"
,
&
blk
);
return
blk
;
}
...
...
src/proc.c
View file @
cc636f33
...
...
@@ -184,11 +184,8 @@ mrb_proc_s_new(mrb_state *mrb, mrb_value proc_class)
mrb_value
proc
;
struct
RProc
*
p
;
mrb_get_args
(
mrb
,
"&"
,
&
blk
);
if
(
mrb_nil_p
(
blk
))
{
/* Calling Proc.new without a block is not implemented yet */
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"tried to create Proc object without a block"
);
}
/* Calling Proc.new without a block is not implemented yet */
mrb_get_args
(
mrb
,
"&!"
,
&
blk
);
p
=
(
struct
RProc
*
)
mrb_obj_alloc
(
mrb
,
MRB_TT_PROC
,
mrb_class_ptr
(
proc_class
));
mrb_proc_copy
(
p
,
mrb_proc_ptr
(
blk
));
proc
=
mrb_obj_value
(
p
);
...
...
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