}
void
-convlit(Node *n, Type *t)
+convlit1(Node *n, Type *t, int conv)
{
int et, wt;
defaultlit(n);
return;
}
- if(isptrto(t, TSTRING)) {
- Rune rune;
- int l;
- String *s;
-
- rune = mpgetfix(n->val.u.xval);
- l = runelen(rune);
- s = mal(sizeof(*s)+l);
- s->len = l;
- runetochar((char*)(s->s), &rune);
-
- n->val.u.sval = s;
- n->val.ctype = CTSTR;
- break;
- }
if(isint[et]) {
// int to int
if(mpcmpfixfix(n->val.u.xval, minintval[et]) < 0)
truncfltlit(fv, t);
break;
}
+ if(!conv)
+ goto bad1;
+
+ // only done as string(CONST)
+ if(isptrto(t, TSTRING)) {
+ Rune rune;
+ int l;
+ String *s;
+
+ rune = mpgetfix(n->val.u.xval);
+ l = runelen(rune);
+ s = mal(sizeof(*s)+l);
+ s->len = l;
+ runetochar((char*)(s->s), &rune);
+
+ n->val.u.sval = s;
+ n->val.ctype = CTSTR;
+ break;
+ }
goto bad1;
case Wlitfloat:
return;
}
+void
+convlit(Node *n, Type *t)
+{
+ convlit1(n, t, 0);
+}
+
void
evconst(Node *n)
{
/*
* const.c
*/
+void convlit1(Node*, Type*, int);
void convlit(Node*, Type*);
void evconst(Node*);
int cmpslit(Node *l, Node *r);