mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-12 07:34:50 +00:00
Use PType for typing things in PSymbolConst.
This commit is contained in:
parent
251cdacf26
commit
6584819d01
3 changed files with 11 additions and 12 deletions
|
@ -38,7 +38,7 @@ class PSymbolConst : public PSymbol
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PSymbolConst, PSymbol);
|
DECLARE_CLASS(PSymbolConst, PSymbol);
|
||||||
public:
|
public:
|
||||||
int ValueType;
|
class PType *ValueType;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
int Value;
|
int Value;
|
||||||
|
|
|
@ -297,17 +297,16 @@ FxExpression *FxConstant::MakeConstant(PSymbol *sym, const FScriptPosition &pos)
|
||||||
PSymbolConst *csym = dyn_cast<PSymbolConst>(sym);
|
PSymbolConst *csym = dyn_cast<PSymbolConst>(sym);
|
||||||
if (csym != NULL)
|
if (csym != NULL)
|
||||||
{
|
{
|
||||||
switch(csym->ValueType)
|
if (csym->ValueType->IsA(RUNTIME_CLASS(PInt)))
|
||||||
{
|
{
|
||||||
case VAL_Int:
|
|
||||||
x = new FxConstant(csym->Value, pos);
|
x = new FxConstant(csym->Value, pos);
|
||||||
break;
|
}
|
||||||
|
else if (csym->ValueType->IsA(RUNTIME_CLASS(PFloat)))
|
||||||
case VAL_Float:
|
{
|
||||||
x = new FxConstant(csym->Float, pos);
|
x = new FxConstant(csym->Float, pos);
|
||||||
break;
|
}
|
||||||
|
else
|
||||||
default:
|
{
|
||||||
pos.Message(MSG_ERROR, "Invalid constant '%s'\n", csym->SymbolName.GetChars());
|
pos.Message(MSG_ERROR, "Invalid constant '%s'\n", csym->SymbolName.GetChars());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,12 +205,12 @@ static void ParseConstant (FScanner &sc, PSymbolTable *symt, PClassActor *cls)
|
||||||
PSymbolConst *sym = new PSymbolConst(symname);
|
PSymbolConst *sym = new PSymbolConst(symname);
|
||||||
if (type == TK_Int)
|
if (type == TK_Int)
|
||||||
{
|
{
|
||||||
sym->ValueType = VAL_Int;
|
sym->ValueType = TypeSInt32;
|
||||||
sym->Value = val.GetInt();
|
sym->Value = val.GetInt();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sym->ValueType = VAL_Float;
|
sym->ValueType = TypeFloat64;
|
||||||
sym->Float = val.GetFloat();
|
sym->Float = val.GetFloat();
|
||||||
}
|
}
|
||||||
if (symt->AddSymbol (sym) == NULL)
|
if (symt->AddSymbol (sym) == NULL)
|
||||||
|
@ -261,7 +261,7 @@ static void ParseEnum (FScanner &sc, PSymbolTable *symt, PClassActor *cls)
|
||||||
delete expr;
|
delete expr;
|
||||||
}
|
}
|
||||||
PSymbolConst *sym = new PSymbolConst(symname);
|
PSymbolConst *sym = new PSymbolConst(symname);
|
||||||
sym->ValueType = VAL_Int;
|
sym->ValueType = TypeSInt32;
|
||||||
sym->Value = currvalue;
|
sym->Value = currvalue;
|
||||||
if (symt->AddSymbol (sym) == NULL)
|
if (symt->AddSymbol (sym) == NULL)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue