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
258cb209
Commit
258cb209
authored
Jan 07, 2016
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mruby-eval: fixed receiver value in eval context; close #3072
parent
f7afe1d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
mrbgems/mruby-eval/src/eval.c
mrbgems/mruby-eval/src/eval.c
+14
-6
No files found.
mrbgems/mruby-eval/src/eval.c
View file @
258cb209
...
...
@@ -130,8 +130,10 @@ patch_irep(mrb_state *mrb, mrb_irep *irep, int bnest)
}
}
void
mrb_codedump_all
(
mrb_state
*
,
struct
RProc
*
);
static
struct
RProc
*
create_proc_from_string
(
mrb_state
*
mrb
,
char
*
s
,
int
len
,
mrb_value
binding
,
char
*
file
,
mrb_int
line
)
create_proc_from_string
(
mrb_state
*
mrb
,
char
*
s
,
int
len
,
mrb_value
binding
,
char
*
file
,
mrb_int
line
,
mrb_bool
nest
)
{
mrbc_context
*
cxt
;
struct
mrb_parser_state
*
p
;
...
...
@@ -150,7 +152,6 @@ create_proc_from_string(mrb_state *mrb, char *s, int len, mrb_value binding, cha
}
cxt
->
capture_errors
=
TRUE
;
cxt
->
no_optimize
=
TRUE
;
// cxt->dump_result = TRUE;
p
=
mrb_parse_nstring
(
mrb
,
s
,
len
,
cxt
);
...
...
@@ -184,7 +185,12 @@ create_proc_from_string(mrb_state *mrb, char *s, int len, mrb_value binding, cha
e
=
(
struct
REnv
*
)
mrb_obj_alloc
(
mrb
,
MRB_TT_ENV
,
(
struct
RClass
*
)
e
);
e
->
mid
=
c
->
ci
[
-
1
].
mid
;
e
->
cioff
=
c
->
ci
-
c
->
cibase
-
1
;
e
->
stack
=
c
->
ci
->
stackent
;
if
(
nest
)
{
e
->
stack
=
c
->
stack
;
}
else
{
e
->
stack
=
c
->
ci
->
stackent
;
}
MRB_SET_ENV_STACK_LEN
(
e
,
c
->
ci
[
-
1
].
proc
->
body
.
irep
->
nlocals
);
c
->
ci
->
env
=
e
;
proc
->
env
=
e
;
...
...
@@ -209,8 +215,8 @@ f_eval(mrb_state *mrb, mrb_value self)
mrb_get_args
(
mrb
,
"s|ozi"
,
&
s
,
&
len
,
&
binding
,
&
file
,
&
line
);
proc
=
create_proc_from_string
(
mrb
,
s
,
len
,
binding
,
file
,
line
);
ret
=
mrb_top
level_run
(
mrb
,
proc
);
proc
=
create_proc_from_string
(
mrb
,
s
,
len
,
binding
,
file
,
line
,
FALSE
);
ret
=
mrb_top
_run
(
mrb
,
proc
,
mrb
->
c
->
stack
[
0
],
0
);
if
(
mrb
->
exc
)
{
mrb_exc_raise
(
mrb
,
mrb_obj_value
(
mrb
->
exc
));
}
...
...
@@ -237,12 +243,14 @@ f_instance_eval(mrb_state *mrb, mrb_value self)
char
*
file
=
NULL
;
mrb_int
line
=
1
;
mrb_value
cv
;
struct
RProc
*
proc
;
mrb_get_args
(
mrb
,
"s|zi"
,
&
s
,
&
len
,
&
file
,
&
line
);
c
->
ci
->
acc
=
CI_ACC_SKIP
;
cv
=
mrb_singleton_class
(
mrb
,
self
);
c
->
ci
->
target_class
=
mrb_class_ptr
(
cv
);
return
mrb_run
(
mrb
,
create_proc_from_string
(
mrb
,
s
,
len
,
mrb_nil_value
(),
file
,
line
),
self
);
proc
=
create_proc_from_string
(
mrb
,
s
,
len
,
mrb_nil_value
(),
file
,
line
,
TRUE
);
return
mrb_run
(
mrb
,
proc
,
self
);
}
else
{
mrb_get_args
(
mrb
,
"&"
,
&
b
);
...
...
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