Add static member variables
This commit is contained in:
parent
07dc6dc4db
commit
4732f76bd5
|
@ -309,6 +309,22 @@ Declaration* Parser::ParseStructDeclaration(uint64 flags, DecType dt, Declaratio
|
|||
break;
|
||||
}
|
||||
|
||||
if (mdec->mFlags & DTF_STATIC)
|
||||
{
|
||||
mdec->mFlags |= DTF_GLOBAL;
|
||||
mdec->mVarIndex = -1;
|
||||
mdec->mQualIdent = mScope->Mangle(mdec->mIdent);
|
||||
|
||||
Declaration * pdec = mCompilationUnits->mScope->Insert(mdec->mQualIdent, mdec);
|
||||
|
||||
if (pdec)
|
||||
mdec = pdec;
|
||||
|
||||
if (dec->mScope->Insert(mdec->mIdent, mdec))
|
||||
mErrors->Error(mdec->mLocation, EERR_DUPLICATE_DEFINITION, "Duplicate struct member declaration", mdec->mIdent);
|
||||
}
|
||||
else
|
||||
{
|
||||
mdec->mType = DT_ELEMENT;
|
||||
mdec->mOffset = offset;
|
||||
|
||||
|
@ -333,6 +349,8 @@ Declaration* Parser::ParseStructDeclaration(uint64 flags, DecType dt, Declaratio
|
|||
else
|
||||
dec->mParams = mdec;
|
||||
mlast = mdec;
|
||||
}
|
||||
|
||||
mdec = mdec->mNext;
|
||||
}
|
||||
|
||||
|
@ -3986,6 +4004,10 @@ Declaration* Parser::ParseDeclaration(Declaration * pdec, bool variable, bool ex
|
|||
else
|
||||
ndec->mVarIndex = mLocalIndex++;
|
||||
}
|
||||
else if (pthis)
|
||||
{
|
||||
ndec->mFlags |= storageFlags & DTF_STATIC;
|
||||
}
|
||||
|
||||
ndec->mOffset = 0;
|
||||
|
||||
|
@ -4863,6 +4885,13 @@ Expression* Parser::ParseQualify(Expression* exp)
|
|||
|
||||
exp = nexp->ConstantFold(mErrors);
|
||||
}
|
||||
else if (mdec->mType == DT_VARIABLE)
|
||||
{
|
||||
nexp = new Expression(mScanner->mLocation, EX_VARIABLE);
|
||||
nexp->mDecValue = mdec;
|
||||
nexp->mDecType = mdec->mBase;
|
||||
exp = nexp->ConstantFold(mErrors);
|
||||
}
|
||||
else if (mdec->mType == DT_CONST_FUNCTION)
|
||||
{
|
||||
ConsumeToken(TK_OPEN_PARENTHESIS);
|
||||
|
|
Loading…
Reference in New Issue