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
5a5799f6
Commit
5a5799f6
authored
Jan 18, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: more precise handling of import .
Fixes #455. R=ken2 CC=golang-dev
https://golang.org/cl/186212
parent
07fc1457
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
src/cmd/gc/dcl.c
src/cmd/gc/dcl.c
+8
-3
src/cmd/gc/lex.c
src/cmd/gc/lex.c
+3
-3
src/cmd/gc/subr.c
src/cmd/gc/subr.c
+1
-0
No files found.
src/cmd/gc/dcl.c
View file @
5a5799f6
...
...
@@ -149,6 +149,11 @@ testdclstack(void)
void
redeclare
(
Sym
*
s
,
char
*
where
)
{
if
(
s
->
lastlineno
==
0
)
yyerror
(
"%S redeclared %s
\n
"
"
\t
previous declaration during import"
,
s
,
where
);
else
yyerror
(
"%S redeclared %s
\n
"
"
\t
previous declaration at %L"
,
s
,
where
,
s
->
lastlineno
);
...
...
src/cmd/gc/lex.c
View file @
5a5799f6
...
...
@@ -1470,9 +1470,9 @@ mkpackage(char* pkg)
if
(
s
->
def
->
op
==
OPACK
)
{
// throw away top-level package name leftover
// from previous file.
//
TODO(rsc): remember that there was a package
//
name, so that the name cannot be redeclared
//
as a non-package in other files
.
//
leave s->block set to cause redeclaration
//
errors if a conflicting top-level name is
//
introduced by a different file
.
if
(
!
s
->
def
->
used
&&
!
nsyntaxerrors
)
yyerrorl
(
s
->
def
->
lineno
,
"imported and not used: %s"
,
s
->
def
->
sym
->
name
);
s
->
def
=
N
;
...
...
src/cmd/gc/subr.c
View file @
5a5799f6
...
...
@@ -353,6 +353,7 @@ importdot(Sym *opkg, Node *pack)
continue
;
}
s1
->
def
=
s
->
def
;
s1
->
block
=
s
->
block
;
s1
->
def
->
pack
=
pack
;
n
++
;
}
...
...
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