Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
39a4b142
Commit
39a4b142
authored
Sep 20, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug103 - but the fix caused other
things to break. hopefully all fixed now. R=r OCL=15597 CL=15597
parent
934a19fa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
14 deletions
+39
-14
obj.c
src/cmd/6g/obj.c
+2
-2
go.h
src/cmd/gc/go.h
+1
-0
subr.c
src/cmd/gc/subr.c
+14
-0
walk.c
src/cmd/gc/walk.c
+22
-12
No files found.
src/cmd/6g/obj.c
View file @
39a4b142
...
...
@@ -478,7 +478,7 @@ dumpsignatures(void)
continue
;
et
=
t
->
etype
;
if
(
et
!=
TSTRUC
T
&&
et
!=
TINTER
)
if
(
t
->
method
==
T
&&
et
!=
TINTER
)
continue
;
s
=
d
->
dsym
;
...
...
@@ -549,7 +549,7 @@ dumpsignatures(void)
t
=
d
->
dtype
;
et
=
t
->
etype
;
if
(
et
!=
TSTRUC
T
&&
et
!=
TINTER
)
if
(
t
->
method
==
T
&&
et
!=
TINTER
)
continue
;
s
=
d
->
dsym
;
...
...
src/cmd/gc/go.h
View file @
39a4b142
...
...
@@ -563,6 +563,7 @@ int isptrto(Type*, int);
int
isptrarray
(
Type
*
);
int
isptrdarray
(
Type
*
);
int
isinter
(
Type
*
);
int
ismethod
(
Type
*
);
int
bytearraysz
(
Type
*
);
int
eqtype
(
Type
*
,
Type
*
,
int
);
void
argtype
(
Node
*
,
Type
*
);
...
...
src/cmd/gc/subr.c
View file @
39a4b142
...
...
@@ -1224,6 +1224,20 @@ isinter(Type *t)
return
0
;
}
int
ismethod
(
Type
*
t
)
{
// OLD WAY
if
(
isptrto
(
t
,
TSTRUCT
))
return
1
;
return
0
;
// NEW WAY - but doesnt work yet
if
(
t
!=
T
&&
t
->
method
!=
T
)
return
1
;
return
0
;
}
int
bytearraysz
(
Type
*
t
)
{
...
...
src/cmd/gc/walk.c
View file @
39a4b142
...
...
@@ -330,8 +330,18 @@ loop:
}
n
->
type
=
*
getoutarg
(
t
);
if
(
t
->
outtuple
==
1
)
switch
(
t
->
outtuple
)
{
case
0
:
if
(
top
==
Erv
)
{
yyerror
(
"function requires a return type"
);
n
->
type
=
types
[
TINT32
];
}
break
;
case
1
:
n
->
type
=
n
->
type
->
type
->
type
;
break
;
}
walktype
(
n
->
right
,
Erv
);
...
...
@@ -1381,7 +1391,7 @@ lookdot(Node *n, Type *f)
if
(
f
->
sym
!=
s
)
continue
;
if
(
r
!=
T
)
{
yyerror
(
"ambiguous DOT reference %
s"
,
s
->
name
);
yyerror
(
"ambiguous DOT reference %
S"
,
s
);
break
;
}
r
=
f
;
...
...
@@ -1432,7 +1442,7 @@ walkdot(Node *n)
f
=
lookdot
(
n
->
right
,
t
->
method
);
if
(
f
==
T
)
{
yyerror
(
"undefined DOT %
s"
,
n
->
right
->
sym
->
name
);
yyerror
(
"undefined DOT %
S"
,
n
->
right
->
sym
);
return
;
}
...
...
@@ -1579,11 +1589,11 @@ ascompat(Type *t1, Type *t2)
// return 1;
if
(
isinter
(
t1
))
if
(
is
ptrto
(
t2
,
TSTRUCT
)
||
isinter
(
t2
))
if
(
is
method
(
t2
)
||
isinter
(
t2
))
return
1
;
if
(
isinter
(
t2
))
if
(
is
ptrto
(
t1
,
TSTRUCT
))
if
(
is
method
(
t1
))
return
1
;
if
(
isptrdarray
(
t1
))
...
...
@@ -1608,7 +1618,7 @@ prcompat(Node *n)
loop:
if
(
l
==
N
)
{
walktype
(
r
,
E
rv
);
walktype
(
r
,
E
top
);
return
r
;
}
...
...
@@ -1673,7 +1683,7 @@ nodpanic(int32 lineno)
on
=
syslook
(
"panicl"
,
0
);
n
=
nodintconst
(
lineno
);
n
=
nod
(
OCALL
,
on
,
n
);
walktype
(
n
,
E
rv
);
walktype
(
n
,
E
top
);
return
n
;
}
...
...
@@ -2027,7 +2037,7 @@ mapop(Node *n, int top)
argtype
(
on
,
t
->
type
);
// any-4
r
=
nod
(
OCALL
,
on
,
r
);
walktype
(
r
,
E
rv
);
walktype
(
r
,
E
top
);
break
;
assign2:
...
...
@@ -2056,7 +2066,7 @@ mapop(Node *n, int top)
argtype
(
on
,
t
->
type
);
// any-4
r
=
nod
(
OCALL
,
on
,
r
);
walktype
(
r
,
E
rv
);
walktype
(
r
,
E
top
);
break
;
access2:
...
...
@@ -2446,7 +2456,7 @@ diagnamed(Type *t)
if
(
isinter
(
t
))
if
(
t
->
sym
==
S
)
yyerror
(
"interface type must be named"
);
if
(
is
ptrto
(
t
,
TSTRUCT
))
if
(
is
method
(
t
))
if
(
t
->
type
==
T
||
t
->
type
->
sym
==
S
)
yyerror
(
"structure type must be named"
);
}
...
...
@@ -2460,7 +2470,7 @@ isandss(Type *lt, Node *r)
rt
=
r
->
type
;
if
(
isinter
(
lt
))
{
if
(
is
ptrto
(
rt
,
TSTRUCT
))
{
if
(
is
method
(
rt
))
{
o
=
OS2I
;
goto
ret
;
}
...
...
@@ -2470,7 +2480,7 @@ isandss(Type *lt, Node *r)
}
}
if
(
is
ptrto
(
lt
,
TSTRUCT
))
{
if
(
is
method
(
lt
))
{
if
(
isinter
(
rt
))
{
o
=
OI2S
;
goto
ret
;
...
...
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