summaryrefslogtreecommitdiff
path: root/parse/specialize.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-02-06 16:17:15 -0800
committerOri Bernstein <ori@eigenstate.org>2016-02-06 16:17:15 -0800
commit2d46e781f5fe750468e4ff9300a7fe2c81c855f5 (patch)
tree50d0d29cea98cafe2293d972c37b5d463ff32c40 /parse/specialize.c
parent91ad7689b0645c5bf0b860412c96d10016d80293 (diff)
downloadmc-2d46e781f5fe750468e4ff9300a7fe2c81c855f5.tar.gz
Don't use a null pointer when printing error.
Diffstat (limited to 'parse/specialize.c')
-rw-r--r--parse/specialize.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/parse/specialize.c b/parse/specialize.c
index cfe44f7..33f48a4 100644
--- a/parse/specialize.c
+++ b/parse/specialize.c
@@ -570,17 +570,17 @@ Node *bestimpl(Node *n, Type *to)
* duplicate of it with type 'to'. It also generates
* a name for this specialized node, and returns it in '*name'.
*/
-Node *specializedcl(Node *g, Type *to, Node **name)
+Node *specializedcl(Node *gnode, Type *to, Node **name)
{
extern int stabstkoff;
Tysubst *tsmap;
- Node *d, *n;
+ Node *g, *d, *n;
Stab *st;
- assert(g->type == Ndecl);
- assert(g->decl.isgeneric);
+ assert(gnode->type == Ndecl);
+ assert(gnode->decl.isgeneric);
- n = genericname(g, to);
+ n = genericname(gnode, to);
*name = n;
if (n->name.ns)
st = getns(file, n->name.ns);
@@ -591,10 +591,12 @@ Node *specializedcl(Node *g, Type *to, Node **name)
d = getdcl(st, n);
if (d)
return d;
- if (g->decl.trait) {
- g = bestimpl(g, to);
+ if (gnode->decl.trait) {
+ g = bestimpl(gnode, to);
if (!g)
- fatal(g, "no trait implemented for for %s:%s", namestr(g->decl.name), tystr(to));
+ fatal(gnode, "no trait implemented for for %s:%s", namestr(gnode->decl.name), tystr(to));
+ } else {
+ g = gnode;
}
if (debugopt['S'])
printf("depth[%d] specializing [%d]%s => %s\n", stabstkoff, g->loc.line,