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
91318da3
Commit
91318da3
authored
Aug 02, 2012
by
Yukihiro Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrong return value from empty block/lambda
parent
90323f54
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
src/codegen.c
src/codegen.c
+10
-3
src/vm.c
src/vm.c
+1
-2
No files found.
src/codegen.c
View file @
91318da3
...
...
@@ -308,7 +308,8 @@ push_(codegen_scope *s)
}
#define push() push_(s)
#define pop() (s->sp--)
#define pop_(s) ((s)->sp--)
#define pop() pop_(s)
#define pop_n(n) (s->sp-=(n))
#define cursp() (s->sp)
...
...
@@ -508,6 +509,9 @@ lambda_body(codegen_scope *s, node *tree, int blk)
pop
();
c
=
s
->
iseq
[
s
->
pc
-
1
];
if
(
GET_OPCODE
(
c
)
!=
OP_RETURN
||
GETARG_B
(
c
)
!=
OP_R_NORMAL
||
s
->
pc
==
s
->
lastlabel
)
{
if
(
s
->
nregs
==
0
)
{
genop
(
s
,
MKOP_A
(
OP_LOADNIL
,
cursp
()));
}
genop
(
s
,
MKOP_AB
(
OP_RETURN
,
cursp
(),
OP_R_NORMAL
));
}
if
(
blk
)
{
...
...
@@ -524,12 +528,15 @@ scope_body(codegen_scope *s, node *tree)
codegen_scope
*
scope
=
scope_new
(
s
->
mrb
,
s
,
tree
->
car
);
int
idx
=
scope
->
idx
;
codegen
(
scope
,
tree
->
cdr
,
VAL
);
if
(
!
s
->
iseq
)
{
codegen
(
scope
,
tree
->
cdr
,
VAL
);
genop
(
scope
,
MKOP_A
(
OP_STOP
,
0
));
}
else
{
codegen
(
scope
,
tree
->
cdr
,
VAL
);
pop_
(
scope
);
if
(
scope
->
nregs
==
0
)
{
genop
(
scope
,
MKOP_A
(
OP_LOADNIL
,
scope
->
sp
));
}
genop
(
scope
,
MKOP_AB
(
OP_RETURN
,
scope
->
sp
,
OP_R_NORMAL
));
}
scope_finish
(
scope
,
idx
);
...
...
src/vm.c
View file @
91318da3
...
...
@@ -1563,12 +1563,11 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
mrb
->
arena_idx
=
ai
;
if
(
mrb
->
exc
)
goto
L_RAISE
;
/* pop stackpos */
regs
=
mrb
->
stack
=
mrb
->
stbase
+
ci
->
stackidx
;
mrb
->
stack
=
mrb
->
stbase
+
ci
->
stackidx
;
cipop
(
mrb
);
NEXT
;
}
else
{
/* setup environment for calling method */
irep
=
p
->
body
.
irep
;
pool
=
irep
->
pool
;
syms
=
irep
->
syms
;
...
...
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