Add compound literals
This commit is contained in:
parent
ab9ae6bf0e
commit
72687b7581
|
@ -1601,11 +1601,30 @@ Expression* Parser::ParseSimpleExpression(void)
|
||||||
|
|
||||||
if (exp->mType == EX_TYPE)
|
if (exp->mType == EX_TYPE)
|
||||||
{
|
{
|
||||||
Expression* nexp = new Expression(mScanner->mLocation, EX_TYPECAST);
|
if (mScanner->mToken == TK_OPEN_BRACE)
|
||||||
nexp->mDecType = exp->mDecType;
|
{
|
||||||
nexp->mLeft = exp;
|
Declaration* vdec = new Declaration(mScanner->mLocation, DT_VARIABLE);
|
||||||
nexp->mRight = ParsePrefixExpression();
|
vdec->mBase = exp->mDecType;
|
||||||
exp = nexp->ConstantFold(mErrors);
|
vdec->mFlags |= DTF_CONST | DTF_STATIC | DTF_GLOBAL;
|
||||||
|
|
||||||
|
Expression* nexp = new Expression(mScanner->mLocation, EX_VARIABLE);
|
||||||
|
nexp->mDecValue = vdec;
|
||||||
|
nexp->mDecType = vdec->mBase;
|
||||||
|
|
||||||
|
vdec->mValue = ParseInitExpression(vdec->mBase);
|
||||||
|
vdec->mSection = mDataSection;
|
||||||
|
vdec->mSize = vdec->mBase->mSize;
|
||||||
|
|
||||||
|
exp = nexp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Expression* nexp = new Expression(mScanner->mLocation, EX_TYPECAST);
|
||||||
|
nexp->mDecType = exp->mDecType;
|
||||||
|
nexp->mLeft = exp;
|
||||||
|
nexp->mRight = ParsePrefixExpression();
|
||||||
|
exp = nexp->ConstantFold(mErrors);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TK_ASM:
|
case TK_ASM:
|
||||||
|
|
Loading…
Reference in New Issue