Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
056940d8
Commit
056940d8
authored
Jul 29, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert walkexpr to take Node**; drop indir
R=ken OCL=32421 CL=32421
parent
8f694f66
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
225 additions
and
215 deletions
+225
-215
src/cmd/gc/dcl.c
src/cmd/gc/dcl.c
+13
-13
src/cmd/gc/go.h
src/cmd/gc/go.h
+5
-4
src/cmd/gc/go.y
src/cmd/gc/go.y
+3
-3
src/cmd/gc/sinit.c
src/cmd/gc/sinit.c
+1
-1
src/cmd/gc/subr.c
src/cmd/gc/subr.c
+5
-5
src/cmd/gc/swt.c
src/cmd/gc/swt.c
+3
-3
src/cmd/gc/walk.c
src/cmd/gc/walk.c
+195
-186
No files found.
src/cmd/gc/dcl.c
View file @
056940d8
...
...
@@ -528,7 +528,7 @@ funclit0(Node *t)
autodcl
=
dcl
();
autodcl
->
back
=
autodcl
;
walkexpr
(
t
,
Etype
,
&
t
->
ninit
);
walkexpr
(
&
t
,
Etype
,
&
t
->
ninit
);
funcargs
(
t
->
type
);
return
t
;
}
...
...
@@ -703,7 +703,7 @@ stotype(NodeList *l, int et, Type **t)
if
(
n
->
op
!=
ODCLFIELD
)
fatal
(
"stotype: oops %N
\n
"
,
n
);
if
(
n
->
right
!=
N
)
{
walkexpr
(
n
->
right
,
Etype
,
&
init
);
walkexpr
(
&
n
->
right
,
Etype
,
&
init
);
n
->
type
=
n
->
right
->
type
;
n
->
right
=
N
;
if
(
n
->
embedded
&&
n
->
type
!=
T
)
{
...
...
@@ -1298,7 +1298,7 @@ xanondcl(Node *nt)
Node
*
n
;
Type
*
t
;
walkexpr
(
nt
,
Etype
,
&
nt
->
ninit
);
walkexpr
(
&
nt
,
Etype
,
&
nt
->
ninit
);
t
=
nt
->
type
;
if
(
nt
->
op
!=
OTYPE
)
{
yyerror
(
"%S is not a type"
,
nt
->
sym
);
...
...
@@ -1318,7 +1318,7 @@ namedcl(Node *nn, Node *nt)
if
(
nn
->
op
==
OKEY
)
nn
=
nn
->
left
;
if
(
nn
->
sym
==
S
)
{
walkexpr
(
nn
,
Etype
,
&
nn
->
ninit
);
walkexpr
(
&
nn
,
Etype
,
&
nn
->
ninit
);
yyerror
(
"cannot mix anonymous %T with named arguments"
,
nn
->
type
);
return
xanondcl
(
nn
);
}
...
...
@@ -1326,7 +1326,7 @@ namedcl(Node *nn, Node *nt)
if
(
nt
==
N
)
yyerror
(
"missing type for argument %S"
,
nn
->
sym
);
else
{
walkexpr
(
nt
,
Etype
,
&
nt
->
ninit
);
walkexpr
(
&
nt
,
Etype
,
&
nt
->
ninit
);
if
(
nt
->
op
!=
OTYPE
)
yyerror
(
"%S is not a type"
,
nt
->
sym
);
else
...
...
@@ -1650,7 +1650,7 @@ variter(NodeList *vl, Node *nt, NodeList *el)
t
=
T
;
if
(
nt
)
{
walkexpr
(
nt
,
Etype
,
&
nt
->
ninit
);
walkexpr
(
&
nt
,
Etype
,
&
nt
->
ninit
);
t
=
nt
->
type
;
}
...
...
@@ -1668,15 +1668,15 @@ variter(NodeList *vl, Node *nt, NodeList *el)
e
=
N
;
v
=
vl
->
n
;
a
=
N
;
if
(
e
!=
N
||
funcdepth
>
0
)
a
=
nod
(
OAS
,
v
,
e
);
tv
=
t
;
if
(
t
==
T
)
{
gettype
(
e
,
&
r
);
gettype
(
&
e
,
&
r
);
defaultlit
(
&
e
,
T
);
tv
=
e
->
type
;
}
a
=
N
;
if
(
e
!=
N
||
funcdepth
>
0
)
a
=
nod
(
OAS
,
v
,
e
);
dodclvar
(
v
,
tv
,
&
r
);
if
(
a
!=
N
)
r
=
list
(
r
,
a
);
...
...
@@ -1763,7 +1763,7 @@ unsafenmagic(Node *fn, NodeList *args)
n
=
nod
(
OLITERAL
,
N
,
N
);
if
(
strcmp
(
s
->
name
,
"Sizeof"
)
==
0
)
{
walkexpr
(
r
,
Erv
,
&
n
->
ninit
);
walkexpr
(
&
r
,
Erv
,
&
n
->
ninit
);
tr
=
r
->
type
;
if
(
r
->
op
==
OLITERAL
&&
r
->
val
.
ctype
==
CTSTR
)
tr
=
types
[
TSTRING
];
...
...
@@ -1775,12 +1775,12 @@ unsafenmagic(Node *fn, NodeList *args)
if
(
strcmp
(
s
->
name
,
"Offsetof"
)
==
0
)
{
if
(
r
->
op
!=
ODOT
&&
r
->
op
!=
ODOTPTR
)
goto
no
;
walkexpr
(
r
,
Erv
,
&
n
->
ninit
);
walkexpr
(
&
r
,
Erv
,
&
n
->
ninit
);
v
=
r
->
xoffset
;
goto
yes
;
}
if
(
strcmp
(
s
->
name
,
"Alignof"
)
==
0
)
{
walkexpr
(
r
,
Erv
,
&
n
->
ninit
);
walkexpr
(
&
r
,
Erv
,
&
n
->
ninit
);
tr
=
r
->
type
;
if
(
r
->
op
==
OLITERAL
&&
r
->
val
.
ctype
==
CTSTR
)
tr
=
types
[
TSTRING
];
...
...
src/cmd/gc/go.h
View file @
056940d8
...
...
@@ -194,6 +194,7 @@ struct Node
uchar
noescape
;
// ONAME never move to heap
uchar
funcdepth
;
uchar
builtin
;
// built-in name, like len or close
uchar
walkdef
;
// most nodes
Node
*
left
;
...
...
@@ -926,13 +927,13 @@ Type* pkgtype(Sym*);
/*
* walk.c
*/
void
gettype
(
Node
*
,
NodeList
**
);
void
gettype
(
Node
*
*
,
NodeList
**
);
void
walk
(
Node
*
);
void
walkstmt
(
Node
*
);
void
walkstmt
(
Node
*
*
);
void
walkstmtlist
(
NodeList
*
);
void
walkexpr
(
Node
*
,
int
,
NodeList
**
);
void
walkexpr
(
Node
*
*
,
int
,
NodeList
**
);
void
walkexprlist
(
NodeList
*
,
int
,
NodeList
**
);
void
walkconv
(
Node
*
,
NodeList
**
);
void
walkconv
(
Node
*
*
,
NodeList
**
);
void
walkdottype
(
Node
*
,
NodeList
**
);
void
walkas
(
Node
*
);
void
walkbool
(
Node
**
);
...
...
src/cmd/gc/go.y
View file @
056940d8
...
...
@@ -400,7 +400,7 @@ typedclname:
typedcl:
typedclname ntype
{
walkexpr($2, Etype, &$2->ninit);
walkexpr(
&
$2, Etype, &$2->ninit);
updatetype($1, $2->type);
resumecheckwidth();
}
...
...
@@ -484,7 +484,7 @@ case:
// TODO: move
e = nerrors;
walkexpr(n, Etype | Erv, &$$->ninit);
walkexpr(
&
n, Etype | Erv, &$$->ninit);
if(n->op == OTYPE) {
n = old2new(typeswvar->right, n->type, &$$->ninit);
$$->list = list1(nod(OTYPESW, n, N));
...
...
@@ -1143,7 +1143,7 @@ fndcl:
n = nod(OTFUNC, N, N);
n->list = $3;
n->rlist = $5;
walkexpr(n, Etype, &n->ninit);
walkexpr(
&
n, Etype, &n->ninit);
$$->type = n->type;
funchdr($$);
}
...
...
src/cmd/gc/sinit.c
View file @
056940d8
...
...
@@ -238,7 +238,7 @@ mapindex(Node *n)
b
=
nod
(
OAS
,
b
,
val
);
r
=
liststmt
(
list
(
list1
(
a
),
b
));
walkstmt
(
r
);
walkstmt
(
&
r
);
return
r
;
}
...
...
src/cmd/gc/subr.c
View file @
056940d8
...
...
@@ -461,7 +461,7 @@ aindex(Node *b, Type *t)
bound
=
-
1
;
// open bound
init
=
nil
;
walkexpr
(
b
,
Erv
,
&
init
);
walkexpr
(
&
b
,
Erv
,
&
init
);
if
(
b
!=
nil
)
{
switch
(
consttype
(
b
))
{
default:
...
...
@@ -2391,7 +2391,7 @@ saferef(Node *n, NodeList **init)
r
=
nod
(
OXXX
,
N
,
N
);
*
r
=
*
n
;
r
->
left
=
l
;
walkexpr
(
r
,
Elv
,
init
);
walkexpr
(
&
r
,
Elv
,
init
);
return
r
;
case
OINDEX
:
...
...
@@ -2400,10 +2400,10 @@ saferef(Node *n, NodeList **init)
l
=
nod
(
OXXX
,
N
,
N
);
tempname
(
l
,
ptrto
(
n
->
type
));
a
=
nod
(
OAS
,
l
,
nod
(
OADDR
,
n
,
N
));
walkexpr
(
a
,
Etop
,
init
);
walkexpr
(
&
a
,
Etop
,
init
);
*
init
=
list
(
*
init
,
a
);
r
=
nod
(
OIND
,
l
,
N
);
walkexpr
(
r
,
Elv
,
init
);
walkexpr
(
&
r
,
Elv
,
init
);
return
r
;
}
fatal
(
"saferef %N"
,
n
);
...
...
@@ -2563,7 +2563,7 @@ adddot(Node *n)
int
c
,
d
;
init
=
nil
;
walkexpr
(
n
->
left
,
Erv
,
&
init
);
walkexpr
(
&
n
->
left
,
Erv
,
&
init
);
t
=
n
->
left
->
type
;
if
(
t
==
T
)
goto
ret
;
...
...
src/cmd/gc/swt.c
View file @
056940d8
...
...
@@ -250,7 +250,7 @@ sw0(Node **cp, Type *place, int arg)
yyerror
(
"inappropriate case for a type switch"
);
return
T
;
}
walkexpr
(
c
,
Erv
,
nil
);
walkexpr
(
c
p
,
Erv
,
nil
);
break
;
case
OTYPESW
:
if
(
arg
!=
Stype
)
...
...
@@ -592,7 +592,7 @@ exprswitch(Node *sw)
if
(
sw
->
ntest
->
val
.
u
.
bval
==
0
)
arg
=
Sfalse
;
}
walkexpr
(
sw
->
ntest
,
Erv
,
&
sw
->
ninit
);
walkexpr
(
&
sw
->
ntest
,
Erv
,
&
sw
->
ninit
);
/*
* pass 0,1,2,3
...
...
@@ -771,7 +771,7 @@ typeswitch(Node *sw)
yyerror
(
"type switch must have an assignment"
);
return
;
}
walkexpr
(
sw
->
ntest
->
right
,
Erv
,
&
sw
->
ninit
);
walkexpr
(
&
sw
->
ntest
->
right
,
Erv
,
&
sw
->
ninit
);
if
(
!
istype
(
sw
->
ntest
->
right
->
type
,
TINTER
))
{
yyerror
(
"type switch must be on an interface"
);
return
;
...
...
src/cmd/gc/walk.c
View file @
056940d8
This diff is collapsed.
Click to expand it.
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