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
d85cce95
Commit
d85cce95
authored
Sep 30, 2014
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2598 from SatoshiOdawara/fix_lv_scope_eval
fixed. closures scope in eval(string)
parents
b090f432
2551d14f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
mrbgems/mruby-eval/src/eval.c
mrbgems/mruby-eval/src/eval.c
+13
-4
mrbgems/mruby-eval/test/eval.rb
mrbgems/mruby-eval/test/eval.rb
+5
-0
No files found.
mrbgems/mruby-eval/src/eval.c
View file @
d85cce95
...
...
@@ -53,13 +53,22 @@ patch_irep(mrb_state *mrb, mrb_irep *irep, int bnest)
size_t
i
;
mrb_code
c
;
for
(
i
=
0
;
i
<
irep
->
rlen
;
i
++
)
{
patch_irep
(
mrb
,
irep
->
reps
[
i
],
bnest
+
1
);
}
for
(
i
=
0
;
i
<
irep
->
ilen
;
i
++
)
{
c
=
irep
->
iseq
[
i
];
switch
(
GET_OPCODE
(
c
)){
case
OP_EPUSH
:
patch_irep
(
mrb
,
irep
->
reps
[
GETARG_Bx
(
c
)],
bnest
+
1
);
break
;
case
OP_LAMBDA
:
{
int
arg_c
=
GETARG_c
(
c
);
if
(
arg_c
&
OP_L_CAPTURE
)
{
patch_irep
(
mrb
,
irep
->
reps
[
GETARG_b
(
c
)],
bnest
+
1
);
}
}
break
;
case
OP_SEND
:
if
(
GETARG_C
(
c
)
!=
0
)
{
break
;
...
...
mrbgems/mruby-eval/test/eval.rb
View file @
d85cce95
...
...
@@ -32,6 +32,11 @@ assert('Kernel.eval', '15.3.1.2.3') do
}.
call
c
}
assert_equal
(
2
)
{
a
=
10
Kernel
.
eval
'def f(a); b=a.send(:+, 1); end'
f
(
1
)
}
end
assert
(
'Kernel#eval'
,
'15.3.1.3.12'
)
do
...
...
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