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
5a5799f6
Commit
5a5799f6
authored
Jan 19, 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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
dcl.c
src/cmd/gc/dcl.c
+8
-3
lex.c
src/cmd/gc/lex.c
+3
-3
subr.c
src/cmd/gc/subr.c
+1
-0
No files found.
src/cmd/gc/dcl.c
View file @
5a5799f6
...
...
@@ -149,9 +149,14 @@ testdclstack(void)
void
redeclare
(
Sym
*
s
,
char
*
where
)
{
yyerror
(
"%S redeclared %s
\n
"
"
\t
previous declaration at %L"
,
s
,
where
,
s
->
lastlineno
);
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