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
49cf4776
Commit
49cf4776
authored
May 16, 2014
by
take_cheeze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #2259 .
parent
41b46ca1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
+15
-11
src/kernel.c
src/kernel.c
+7
-11
test/t/kernel.rb
test/t/kernel.rb
+8
-0
No files found.
src/kernel.c
View file @
49cf4776
...
@@ -984,16 +984,11 @@ basic_obj_respond_to(mrb_state *mrb, mrb_value obj, mrb_sym id, int pub)
...
@@ -984,16 +984,11 @@ basic_obj_respond_to(mrb_state *mrb, mrb_value obj, mrb_sym id, int pub)
static
mrb_value
static
mrb_value
obj_respond_to
(
mrb_state
*
mrb
,
mrb_value
self
)
obj_respond_to
(
mrb_state
*
mrb
,
mrb_value
self
)
{
{
mrb_value
*
argv
;
mrb_value
mid
;
mrb_int
argc
;
mrb_value
mid
,
priv
;
mrb_sym
id
,
rtm_id
;
mrb_sym
id
,
rtm_id
;
mrb_bool
respond_to_p
=
TRUE
;
mrb_bool
priv
=
FALSE
,
respond_to_p
=
TRUE
;
mrb_get_args
(
mrb
,
"*"
,
&
argv
,
&
argc
);
mrb_get_args
(
mrb
,
"o|b"
,
&
mid
,
&
priv
);
mid
=
argv
[
0
];
if
(
argc
>
1
)
priv
=
argv
[
1
];
else
priv
=
mrb_nil_value
();
if
(
mrb_symbol_p
(
mid
))
{
if
(
mrb_symbol_p
(
mid
))
{
id
=
mrb_symbol
(
mid
);
id
=
mrb_symbol
(
mid
);
...
@@ -1017,13 +1012,14 @@ obj_respond_to(mrb_state *mrb, mrb_value self)
...
@@ -1017,13 +1012,14 @@ obj_respond_to(mrb_state *mrb, mrb_value self)
}
}
if
(
respond_to_p
)
{
if
(
respond_to_p
)
{
respond_to_p
=
basic_obj_respond_to
(
mrb
,
self
,
id
,
!
mrb_test
(
priv
)
);
respond_to_p
=
basic_obj_respond_to
(
mrb
,
self
,
id
,
!
priv
);
}
}
if
(
!
respond_to_p
)
{
if
(
!
respond_to_p
)
{
rtm_id
=
mrb_intern_lit
(
mrb
,
"respond_to_missing?"
);
rtm_id
=
mrb_intern_lit
(
mrb
,
"respond_to_missing?"
);
if
(
basic_obj_respond_to
(
mrb
,
self
,
rtm_id
,
!
mrb_test
(
priv
)))
{
if
(
basic_obj_respond_to
(
mrb
,
self
,
rtm_id
,
!
priv
))
{
return
mrb_funcall_argv
(
mrb
,
self
,
rtm_id
,
argc
,
argv
);
mrb_value
args
[]
=
{
mid
,
mrb_bool_value
(
priv
)
};
return
mrb_funcall_argv
(
mrb
,
self
,
rtm_id
,
2
,
args
);
}
}
}
}
return
mrb_bool_value
(
respond_to_p
);
return
mrb_bool_value
(
respond_to_p
);
...
...
test/t/kernel.rb
View file @
49cf4776
...
@@ -451,6 +451,14 @@ assert('Kernel#respond_to?', '15.3.1.3.43') do
...
@@ -451,6 +451,14 @@ assert('Kernel#respond_to?', '15.3.1.3.43') do
Test4RespondTo
.
new
.
respond_to?
(
1
)
Test4RespondTo
.
new
.
respond_to?
(
1
)
end
end
assert_raise
ArgumentError
do
Test4RespondTo
.
new
.
respond_to?
end
assert_raise
ArgumentError
do
Test4RespondTo
.
new
.
respond_to?
:a
,
true
,
:aa
end
assert_true
respond_to?
(
:nil?
)
assert_true
respond_to?
(
:nil?
)
assert_true
Test4RespondTo
.
new
.
respond_to?
(
:valid_method
)
assert_true
Test4RespondTo
.
new
.
respond_to?
(
:valid_method
)
assert_true
Test4RespondTo
.
new
.
respond_to?
(
'valid_method'
)
assert_true
Test4RespondTo
.
new
.
respond_to?
(
'valid_method'
)
...
...
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