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
41b46ca1
Commit
41b46ca1
authored
May 16, 2014
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
register<nlocals may not have a local variable name (e.g. a block arg); fix #2258
parent
60051de4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
mrbgems/mruby-proc-ext/src/proc.c
mrbgems/mruby-proc-ext/src/proc.c
+6
-2
src/codegen.c
src/codegen.c
+6
-1
No files found.
mrbgems/mruby-proc-ext/src/proc.c
View file @
41b46ca1
...
...
@@ -142,8 +142,10 @@ mrb_local_variables(mrb_state *mrb, mrb_value self)
}
ret
=
mrb_ary_new_capa
(
mrb
,
irep
->
nlocals
-
1
);
for
(
i
=
0
;
i
+
1
<
irep
->
nlocals
;
++
i
)
{
if
(
irep
->
lv
[
i
].
name
)
{
mrb_ary_push
(
mrb
,
ret
,
mrb_symbol_value
(
irep
->
lv
[
i
].
name
));
}
}
if
(
proc
->
env
)
{
struct
REnv
*
e
=
proc
->
env
;
...
...
@@ -152,10 +154,12 @@ mrb_local_variables(mrb_state *mrb, mrb_value self)
irep
=
mrb
->
c
->
cibase
[
e
->
cioff
].
proc
->
body
.
irep
;
if
(
irep
->
lv
)
{
for
(
i
=
0
;
i
+
1
<
irep
->
nlocals
;
++
i
)
{
if
(
irep
->
lv
[
i
].
name
)
{
mrb_ary_push
(
mrb
,
ret
,
mrb_symbol_value
(
irep
->
lv
[
i
].
name
));
}
}
}
}
e
=
(
struct
REnv
*
)
e
->
c
;
}
}
...
...
src/codegen.c
View file @
41b46ca1
...
...
@@ -2503,8 +2503,13 @@ scope_new(mrb_state *mrb, codegen_scope *prev, node *lv)
p
->
irep
->
lv
=
(
struct
mrb_locals
*
)
mrb_malloc
(
mrb
,
sizeof
(
struct
mrb_locals
)
*
(
p
->
nlocals
-
1
));
for
(
i
=
0
,
n
=
lv
;
n
;
i
++
,
n
=
n
->
cdr
)
{
p
->
irep
->
lv
[
i
].
name
=
lv_name
(
n
);
if
(
lv_name
(
n
))
{
p
->
irep
->
lv
[
i
].
r
=
lv_idx
(
p
,
lv_name
(
n
));
}
else
{
p
->
irep
->
lv
[
i
].
r
=
0
;
}
}
mrb_assert
(
i
+
1
==
p
->
nlocals
);
}
p
->
ai
=
mrb_gc_arena_save
(
mrb
);
...
...
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