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
30f37872
Commit
30f37872
authored
Sep 16, 2019
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise `ArgumentError` by `aspec` check; ref #4688
This is partial `aspec` check that only checks `MRB_ARGS_NONE()`.
parent
2764fdf9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
0 deletions
+13
-0
include/mruby/proc.h
include/mruby/proc.h
+5
-0
src/class.c
src/class.c
+3
-0
src/vm.c
src/vm.c
+5
-0
No files found.
include/mruby/proc.h
View file @
30f37872
...
...
@@ -98,9 +98,12 @@ MRB_API mrb_value mrb_proc_cfunc_env_get(mrb_state *mrb, mrb_int idx);
#define mrb_cfunc_env_get(mrb, idx) mrb_proc_cfunc_env_get(mrb, idx)
#define MRB_METHOD_FUNC_FL 1
#define MRB_METHOD_NOARG_FL 2
#ifdef MRB_METHOD_TABLE_INLINE
#define MRB_METHOD_FUNC_P(m) (((uintptr_t)(m))&MRB_METHOD_FUNC_FL)
#define MRB_METHOD_NOARG_P(m) (((uintptr_t)(m))&MRB_METHOD_NOARG_FL)
#define MRB_METHOD_NOARG_SET(m) ((m)=(mrb_method_t)(((uintptr_t)(m))|MRB_METHOD_NOARG_FL))
#define MRB_METHOD_FUNC(m) ((mrb_func_t)((uintptr_t)(m)>>2))
#define MRB_METHOD_FROM_FUNC(m,fn) ((m)=(mrb_method_t)((((uintptr_t)(fn))<<2)|MRB_METHOD_FUNC_FL))
#define MRB_METHOD_FROM_PROC(m,pr) ((m)=(mrb_method_t)(pr))
...
...
@@ -111,7 +114,9 @@ MRB_API mrb_value mrb_proc_cfunc_env_get(mrb_state *mrb, mrb_int idx);
#else
#define MRB_METHOD_FUNC_P(m) ((m).flags&MRB_METHOD_FUNC_FL)
#define MRB_METHOD_NOARG_P(m) ((m).flags&MRB_METHOD_NOARG_FL)
#define MRB_METHOD_FUNC(m) ((m).func)
#define MRB_METHOD_NOARG_SET(m) do{(m).flags|=MRB_METHOD_NOARG_FL;}while(0)
#define MRB_METHOD_FROM_FUNC(m,fn) do{(m).flags=MRB_METHOD_FUNC_FL;(m).func=(fn);}while(0)
#define MRB_METHOD_FROM_PROC(m,pr) do{(m).flags=0;(m).proc=(pr);}while(0)
#define MRB_METHOD_PROC_P(m) (!MRB_METHOD_FUNC_P(m))
...
...
src/class.c
View file @
30f37872
...
...
@@ -470,6 +470,9 @@ mrb_define_method_id(mrb_state *mrb, struct RClass *c, mrb_sym mid, mrb_func_t f
int
ai
=
mrb_gc_arena_save
(
mrb
);
MRB_METHOD_FROM_FUNC
(
m
,
func
);
if
(
aspec
==
MRB_ARGS_NONE
())
{
MRB_METHOD_NOARG_SET
(
m
);
}
mrb_define_method_raw
(
mrb
,
c
,
mid
,
m
);
mrb_gc_arena_restore
(
mrb
,
ai
);
}
...
...
src/vm.c
View file @
30f37872
...
...
@@ -1435,6 +1435,11 @@ RETRY_TRY_BLOCK:
ci
->
proc
=
p
;
recv
=
p
->
body
.
func
(
mrb
,
recv
);
}
else
if
(
MRB_METHOD_NOARG_P
(
m
)
&&
(
argc
>
0
||
(
argc
==
-
1
&&
RARRAY_LEN
(
regs
[
1
])
!=
0
)))
{
argnum_error
(
mrb
,
0
);
goto
L_RAISE
;
}
else
{
recv
=
MRB_METHOD_FUNC
(
m
)(
mrb
,
recv
);
}
...
...
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