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
88236893
Commit
88236893
authored
Nov 29, 2011
by
Luuk van Dijk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: move typedcl2 into export.c
R=rsc CC=golang-dev
https://golang.org/cl/5447043
parent
4aab0417
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
38 deletions
+25
-38
src/cmd/gc/dcl.c
src/cmd/gc/dcl.c
+0
-35
src/cmd/gc/export.c
src/cmd/gc/export.c
+25
-2
src/cmd/gc/go.h
src/cmd/gc/go.h
+0
-1
No files found.
src/cmd/gc/dcl.c
View file @
88236893
...
...
@@ -673,41 +673,6 @@ typedcl1(Node *n, Node *t, int local)
return
nod
(
ODCLTYPE
,
n
,
N
);
}
/*
* typedcl1 but during imports
*/
void
typedcl2
(
Type
*
pt
,
Type
*
t
)
{
Node
*
n
;
// override declaration in unsafe.go for Pointer.
// there is no way in Go code to define unsafe.Pointer
// so we have to supply it.
if
(
incannedimport
&&
strcmp
(
importpkg
->
name
,
"unsafe"
)
==
0
&&
strcmp
(
pt
->
nod
->
sym
->
name
,
"Pointer"
)
==
0
)
{
t
=
types
[
TUNSAFEPTR
];
}
if
(
pt
->
etype
==
TFORW
)
goto
ok
;
if
(
!
eqtype
(
pt
->
orig
,
t
))
yyerror
(
"inconsistent definition for type %S during import
\n\t
%lT
\n\t
%lT"
,
pt
->
sym
,
pt
->
orig
,
t
);
return
;
ok:
n
=
pt
->
nod
;
copytype
(
pt
->
nod
,
t
);
// unzero nod
pt
->
nod
=
n
;
pt
->
sym
->
lastlineno
=
parserline
();
declare
(
n
,
PEXTERN
);
checkwidth
(
pt
);
}
/*
* structs, functions, and methods.
* they don't belong here, but where do they belong?
...
...
src/cmd/gc/export.c
View file @
88236893
...
...
@@ -349,8 +349,31 @@ importvar(Sym *s, Type *t, int ctxt)
void
importtype
(
Type
*
pt
,
Type
*
t
)
{
if
(
pt
!=
T
&&
t
!=
T
)
typedcl2
(
pt
,
t
);
Node
*
n
;
if
(
pt
!=
T
&&
t
!=
T
)
{
// override declaration in unsafe.go for Pointer.
// there is no way in Go code to define unsafe.Pointer
// so we have to supply it.
if
(
incannedimport
&&
strcmp
(
importpkg
->
name
,
"unsafe"
)
==
0
&&
strcmp
(
pt
->
nod
->
sym
->
name
,
"Pointer"
)
==
0
)
{
t
=
types
[
TUNSAFEPTR
];
}
if
(
pt
->
etype
==
TFORW
)
{
n
=
pt
->
nod
;
copytype
(
pt
->
nod
,
t
);
// unzero nod
pt
->
nod
=
n
;
pt
->
sym
->
lastlineno
=
parserline
();
declare
(
n
,
PEXTERN
);
checkwidth
(
pt
);
}
else
if
(
!
eqtype
(
pt
->
orig
,
t
))
yyerror
(
"inconsistent definition for type %S during import
\n\t
%lT
\n\t
%lT"
,
pt
->
sym
,
pt
->
orig
,
t
);
}
if
(
debug
[
'E'
])
print
(
"import type %T %lT
\n
"
,
pt
,
t
);
...
...
src/cmd/gc/go.h
View file @
88236893
...
...
@@ -964,7 +964,6 @@ Type* tointerface(NodeList *l);
Type
*
tostruct
(
NodeList
*
l
);
Node
*
typedcl0
(
Sym
*
s
);
Node
*
typedcl1
(
Node
*
n
,
Node
*
t
,
int
local
);
void
typedcl2
(
Type
*
pt
,
Type
*
t
);
Node
*
typenod
(
Type
*
t
);
NodeList
*
variter
(
NodeList
*
vl
,
Node
*
t
,
NodeList
*
el
);
...
...
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