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
ed8491cd
Commit
ed8491cd
authored
Dec 25, 2019
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Numbered parameters: usually linked list uses `cdr` for links.
parent
7e635597
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
mrbgems/mruby-compiler/core/parse.y
mrbgems/mruby-compiler/core/parse.y
+11
-11
No files found.
mrbgems/mruby-compiler/core/parse.y
View file @
ed8491cd
...
...
@@ -318,19 +318,19 @@ locals_node(parser_state *p)
static void
nvars_nest(parser_state *p)
{
p->nvars = cons(
p->nvars, nint(0)
);
p->nvars = cons(
nint(0), p->nvars
);
}
static void
nvars_block(parser_state *p)
{
p->nvars = cons(
p->nvars, nint(-2)
);
p->nvars = cons(
nint(-2), p->nvars
);
}
static void
nvars_unnest(parser_state *p)
{
p->nvars = p->nvars->c
a
r;
p->nvars = p->nvars->c
d
r;
}
/* (:scope (vars..) (prog...)) */
...
...
@@ -671,11 +671,11 @@ new_cvar(parser_state *p, mrb_sym sym)
static node*
new_nvar(parser_state *p, int num)
{
if (!p->nvars || intn(p->nvars->c
d
r) < -1) {
if (!p->nvars || intn(p->nvars->c
a
r) < -1) {
yyerror(p, "numbered parameter outside block");
} else {
int nvars = intn(p->nvars->c
d
r);
p->nvars->c
d
r = nint(nvars > num ? nvars : num);
int nvars = intn(p->nvars->c
a
r);
p->nvars->c
a
r = nint(nvars > num ? nvars : num);
}
return cons((node*)NODE_NVAR, nint(num));
}
...
...
@@ -840,7 +840,7 @@ new_block_arg(parser_state *p, node *a)
static node*
setup_numparams(parser_state *p, node *a)
{
int nvars = intn(p->nvars->c
d
r);
int nvars = intn(p->nvars->c
a
r);
if (nvars > 0) {
int i;
mrb_sym sym;
...
...
@@ -5964,15 +5964,15 @@ parser_yylex(parser_state *p)
int n = tok(p)[1] - '0';
if (n > 0) {
node *nvars = p->nvars->c
a
r;
node *nvars = p->nvars->c
d
r;
while (nvars) {
if (intn(nvars->c
d
r) > 0) {
if (intn(nvars->c
a
r) > 0) {
yywarning(p, "numbered parameter in nested block");
break;
}
nvars->c
d
r = nint(-1);
nvars = nvars->c
a
r;
nvars->c
a
r = nint(-1);
nvars = nvars->c
d
r;
}
pylval.num = n;
p->lstate = EXPR_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