File src/misc.c changed (mode: 100644) (index 0a36d43..6cffeca) |
... |
... |
int canconvert(const struct typenode *ufrom, const struct typenode *uto) |
233 |
233 |
if (from == NULL || to == NULL) return 0; |
if (from == NULL || to == NULL) return 0; |
234 |
234 |
if (isDerivedFrom(from, to)) |
if (isDerivedFrom(from, to)) |
235 |
235 |
return 1; |
return 1; |
|
236 |
|
/* Blizzard bug: allows downcasting erroneously */ |
|
237 |
|
/* TODO: get Blizzard to fix this in Blizzard.j and the language */ |
|
238 |
|
if (isDerivedFrom(to, from)) |
|
239 |
|
return 1; |
236 |
240 |
if (from->typename == NULL || to->typename == NULL) return 0; |
if (from->typename == NULL || to->typename == NULL) return 0; |
237 |
241 |
from = getPrimitiveAncestor(from); |
from = getPrimitiveAncestor(from); |
238 |
242 |
to = getPrimitiveAncestor(to); |
to = getPrimitiveAncestor(to); |
|
... |
... |
int canconvert(const struct typenode *ufrom, const struct typenode *uto) |
241 |
245 |
if ((from == gInteger || from == gReal) && |
if ((from == gInteger || from == gReal) && |
242 |
246 |
(to == gInteger || to == gReal)) |
(to == gInteger || to == gReal)) |
243 |
247 |
return 1; |
return 1; |
244 |
|
/* Blizzard bug: allows downcasting erroneously */ |
|
245 |
|
/* TODO: get Blizzard to fix this in Blizzard.j and the language */ |
|
246 |
|
if (from == to) |
|
247 |
|
return 1; |
|
248 |
248 |
sprintf(ebuf, "Cannot convert %s to %s", ufrom->typename, uto->typename); |
sprintf(ebuf, "Cannot convert %s to %s", ufrom->typename, uto->typename); |
249 |
249 |
yyerror(ebuf); |
yyerror(ebuf); |
250 |
250 |
} |
} |