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
3e8b19b0
Unverified
Commit
3e8b19b0
authored
May 19, 2019
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
May 19, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4453 from shuujii/move-Kernel-instance_eval-to-BasicObject
Move `Kernel#instance_eval` to `BasicObject`
parents
aafaf79f
9c79c286
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
mrbgems/mruby-eval/src/eval.c
mrbgems/mruby-eval/src/eval.c
+1
-1
mrbgems/mruby-eval/test/eval.rb
mrbgems/mruby-eval/test/eval.rb
+2
-2
No files found.
mrbgems/mruby-eval/src/eval.c
View file @
3e8b19b0
...
@@ -387,7 +387,7 @@ void
...
@@ -387,7 +387,7 @@ void
mrb_mruby_eval_gem_init
(
mrb_state
*
mrb
)
mrb_mruby_eval_gem_init
(
mrb_state
*
mrb
)
{
{
mrb_define_module_function
(
mrb
,
mrb
->
kernel_module
,
"eval"
,
f_eval
,
MRB_ARGS_ARG
(
1
,
3
));
mrb_define_module_function
(
mrb
,
mrb
->
kernel_module
,
"eval"
,
f_eval
,
MRB_ARGS_ARG
(
1
,
3
));
mrb_define_method
(
mrb
,
mrb
->
kernel_module
,
"instance_eval"
,
f_instance_eval
,
MRB_ARGS_ARG
(
1
,
2
));
mrb_define_method
(
mrb
,
mrb
_class_get
(
mrb
,
"BasicObject"
)
,
"instance_eval"
,
f_instance_eval
,
MRB_ARGS_ARG
(
1
,
2
));
}
}
void
void
...
...
mrbgems/mruby-eval/test/eval.rb
View file @
3e8b19b0
...
@@ -80,7 +80,7 @@ assert('Kernel.#eval(string) context') do
...
@@ -80,7 +80,7 @@ assert('Kernel.#eval(string) context') do
assert_equal
(
'class'
)
{
obj
.
const_string
}
assert_equal
(
'class'
)
{
obj
.
const_string
}
end
end
assert
(
'Object#instance_eval with begin-rescue-ensure execution order'
)
do
assert
(
'
Basic
Object#instance_eval with begin-rescue-ensure execution order'
)
do
class
HellRaiser
class
HellRaiser
def
raise_hell
def
raise_hell
order
=
[
:enter_raise_hell
]
order
=
[
:enter_raise_hell
]
...
@@ -100,7 +100,7 @@ assert('Object#instance_eval with begin-rescue-ensure execution order') do
...
@@ -100,7 +100,7 @@ assert('Object#instance_eval with begin-rescue-ensure execution order') do
assert_equal
([
:enter_raise_hell
,
:begin
,
:rescue
,
:ensure
],
hell_raiser
.
raise_hell
)
assert_equal
([
:enter_raise_hell
,
:begin
,
:rescue
,
:ensure
],
hell_raiser
.
raise_hell
)
end
end
assert
(
'
Kernel#instance_eval()
to define singleton methods Issue #3141'
)
do
assert
(
'
BasicObject#instance_eval
to define singleton methods Issue #3141'
)
do
foo_class
=
Class
.
new
do
foo_class
=
Class
.
new
do
def
bar
(
x
)
def
bar
(
x
)
instance_eval
"def baz;
#{
x
}
; end"
instance_eval
"def baz;
#{
x
}
; end"
...
...
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