Add a PSymbolConstString class
- Constants can be strings, but the existing PSymbolConst couldn't handle them. The old PSymbolConst is now PSymbolConstNumeric, and the new PSymbolConst is a now a baseclass for it and PSymbolConstString.
This commit is contained in:
parent
33e835b58d
commit
2ab3974752
4 changed files with 47 additions and 23 deletions
|
|
@ -202,15 +202,15 @@ static void ParseConstant (FScanner &sc, PSymbolTable *symt, PClassActor *cls)
|
|||
{
|
||||
ExpVal val = static_cast<FxConstant *>(expr)->GetValue();
|
||||
delete expr;
|
||||
PSymbolConst *sym = new PSymbolConst(symname);
|
||||
PSymbolConstNumeric *sym;
|
||||
if (type == TK_Int)
|
||||
{
|
||||
sym->ValueType = TypeSInt32;
|
||||
sym = new PSymbolConstNumeric(symname, TypeSInt32);
|
||||
sym->Value = val.GetInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
sym->ValueType = TypeFloat64;
|
||||
sym = new PSymbolConstNumeric(symname, TypeFloat64);
|
||||
sym->Float = val.GetFloat();
|
||||
}
|
||||
if (symt->AddSymbol (sym) == NULL)
|
||||
|
|
@ -260,8 +260,7 @@ static void ParseEnum (FScanner &sc, PSymbolTable *symt, PClassActor *cls)
|
|||
}
|
||||
delete expr;
|
||||
}
|
||||
PSymbolConst *sym = new PSymbolConst(symname);
|
||||
sym->ValueType = TypeSInt32;
|
||||
PSymbolConstNumeric *sym = new PSymbolConstNumeric(symname, TypeSInt32);
|
||||
sym->Value = currvalue;
|
||||
if (symt->AddSymbol (sym) == NULL)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue