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
2aafad25
Commit
2aafad25
authored
Feb 11, 2012
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: print detail for typechecking loop error
R=ken2 CC=golang-dev
https://golang.org/cl/5654060
parent
2f3d695a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
11 deletions
+48
-11
src/cmd/gc/typecheck.c
src/cmd/gc/typecheck.c
+48
-11
No files found.
src/cmd/gc/typecheck.c
View file @
2aafad25
...
...
@@ -111,16 +111,15 @@ typekind(Type *t)
* replaces *np with a new pointer in some cases.
* returns the final value of *np as a convenience.
*/
static
void
typecheck1
(
Node
**
,
int
);
Node
*
typecheck
(
Node
**
np
,
int
top
)
{
int
et
,
aop
,
op
,
ptr
;
Node
*
n
,
*
l
,
*
r
;
NodeList
*
args
;
int
lno
,
ok
,
ntop
;
Type
*
t
,
*
tp
,
*
ft
,
*
missing
,
*
have
,
*
badtype
;
Val
v
;
char
*
why
;
Node
*
n
;
int
lno
;
Fmt
fmt
;
NodeList
*
l
;
static
NodeList
*
tcstack
,
*
tcfree
;
// cannot type check until all the source has been parsed
if
(
!
typecheckok
)
...
...
@@ -157,11 +156,52 @@ typecheck(Node **np, int top)
}
if
(
n
->
typecheck
==
2
)
{
yyerror
(
"typechecking loop involving %N"
,
n
);
if
(
nsavederrors
+
nerrors
==
0
)
{
fmtstrinit
(
&
fmt
);
for
(
l
=
tcstack
;
l
;
l
=
l
->
next
)
fmtprint
(
&
fmt
,
"
\n\t
%L %N"
,
l
->
n
->
lineno
,
l
->
n
);
yyerror
(
"typechecking loop involving %N%s"
,
n
,
fmtstrflush
(
&
fmt
));
}
lineno
=
lno
;
return
n
;
}
n
->
typecheck
=
2
;
if
(
tcfree
!=
nil
)
{
l
=
tcfree
;
tcfree
=
l
->
next
;
}
else
l
=
mal
(
sizeof
*
l
);
l
->
next
=
tcstack
;
l
->
n
=
n
;
tcstack
=
l
;
typecheck1
(
&
n
,
top
);
*
np
=
n
;
n
->
typecheck
=
1
;
if
(
tcstack
!=
l
)
fatal
(
"typecheck stack out of sync"
);
tcstack
=
l
->
next
;
l
->
next
=
tcfree
;
tcfree
=
l
;
lineno
=
lno
;
return
n
;
}
static
void
typecheck1
(
Node
**
np
,
int
top
)
{
int
et
,
aop
,
op
,
ptr
;
Node
*
n
,
*
l
,
*
r
;
NodeList
*
args
;
int
ok
,
ntop
;
Type
*
t
,
*
tp
,
*
ft
,
*
missing
,
*
have
,
*
badtype
;
Val
v
;
char
*
why
;
n
=
*
np
;
if
(
n
->
sym
)
{
if
(
n
->
op
==
ONAME
&&
n
->
etype
!=
0
&&
!
(
top
&
Ecall
))
{
...
...
@@ -1484,10 +1524,7 @@ error:
n
->
type
=
T
;
out:
lineno
=
lno
;
n
->
typecheck
=
1
;
*
np
=
n
;
return
n
;
}
static
void
...
...
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