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
9c7b0640
Commit
9c7b0640
authored
Nov 14, 2008
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs in package locals
R=ken OCL=19299 CL=19299
parent
7dee51f4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
8 deletions
+13
-8
src/cmd/gc/export.c
src/cmd/gc/export.c
+11
-7
src/cmd/gc/go.h
src/cmd/gc/go.h
+1
-0
src/cmd/gc/subr.c
src/cmd/gc/subr.c
+1
-1
No files found.
src/cmd/gc/export.c
View file @
9c7b0640
...
...
@@ -270,7 +270,7 @@ pkgsym(char *name, char *pkg, int lexical)
* return the sym for ss, which should match lexical
*/
Sym
*
importsym
(
Node
*
ss
,
int
lexical
)
importsym
(
int
export
,
Node
*
ss
,
int
lexical
)
{
Sym
*
s
;
...
...
@@ -282,7 +282,12 @@ importsym(Node *ss, int lexical)
s
=
pkgsym
(
ss
->
sym
->
name
,
ss
->
psym
->
name
,
lexical
);
/* TODO botch - need some diagnostic checking for the following assignment */
s
->
opackage
=
ss
->
osym
->
name
;
s
->
export
=
1
;
if
(
export
)
{
if
(
s
->
export
!=
export
&&
s
->
export
!=
0
)
yyerror
(
"export/package mismatch: %S"
,
s
);
s
->
export
=
export
;
}
s
->
imported
=
1
;
return
s
;
}
...
...
@@ -303,7 +308,7 @@ pkgtype(char *name, char *pkg)
n
->
psym
=
lookup
(
pkg
);
n
->
osym
=
n
->
psym
;
renamepkg
(
n
);
s
=
importsym
(
n
,
LATYPE
);
s
=
importsym
(
0
,
n
,
LATYPE
);
if
(
s
->
otype
==
T
)
{
t
=
typ
(
TFORW
);
...
...
@@ -332,14 +337,13 @@ importconst(int export, Node *ss, Type *t, Val *v)
n
->
val
=
*
v
;
n
->
type
=
t
;
s
=
importsym
(
ss
,
LNAME
);
s
=
importsym
(
export
,
ss
,
LNAME
);
if
(
s
->
oconst
!=
N
)
{
// TODO: check if already the same.
return
;
}
dodclconst
(
newname
(
s
),
n
);
s
->
export
=
export
;
if
(
debug
[
'e'
])
print
(
"import const %S
\n
"
,
s
);
...
...
@@ -353,7 +357,7 @@ importvar(int export, Node *ss, Type *t)
if
(
export
==
2
&&
!
mypackage
(
ss
))
return
;
s
=
importsym
(
ss
,
LNAME
);
s
=
importsym
(
export
,
ss
,
LNAME
);
if
(
s
->
oname
!=
N
)
{
if
(
eqtype
(
t
,
s
->
oname
->
type
,
0
))
return
;
...
...
@@ -373,7 +377,7 @@ importtype(int export, Node *ss, Type *t)
{
Sym
*
s
;
s
=
importsym
(
ss
,
LATYPE
);
s
=
importsym
(
export
,
ss
,
LATYPE
);
if
(
s
->
otype
!=
T
)
{
if
(
eqtype
(
t
,
s
->
otype
,
0
))
return
;
...
...
src/cmd/gc/go.h
View file @
9c7b0640
...
...
@@ -209,6 +209,7 @@ struct Sym
uchar
undef
;
// a diagnostic has been generated
uchar
export
;
// marked as export
uchar
exported
;
// exported
uchar
imported
;
// imported
uchar
sym
;
// huffman encoding in object file
uchar
local
;
// created in this file
uchar
uniq
;
// imbedded field name first found
...
...
src/cmd/gc/subr.c
View file @
9c7b0640
...
...
@@ -982,7 +982,7 @@ Tpretty(Fmt *fp, Type *t)
else
fmtprint
(
fp
,
"%lS"
,
s
);
if
(
strcmp
(
s
->
opackage
,
package
)
==
0
)
if
(
s
->
otype
!=
t
||
!
s
->
export
)
{
if
(
s
->
otype
!=
t
||
(
!
s
->
export
&&
!
s
->
imported
)
)
{
fmtprint
(
fp
,
"·%s"
,
filename
);
if
(
t
->
vargen
)
fmtprint
(
fp
,
"·%d"
,
t
->
vargen
);
...
...
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