Add destructor
This commit is contained in:
parent
cfc174757e
commit
9bb3f73482
|
@ -157,8 +157,27 @@ public:
|
||||||
}
|
}
|
||||||
ProgramValue toValue(Program* program) const
|
ProgramValue toValue(Program* program) const
|
||||||
{
|
{
|
||||||
// todo
|
ProgramValue out;
|
||||||
return ProgramValue(0);
|
switch (type) {
|
||||||
|
case ArrayElementType::INT:
|
||||||
|
out.opcode = VALUE_TYPE_INT;
|
||||||
|
out.integerValue = integerValue;
|
||||||
|
return out;
|
||||||
|
case ArrayElementType::FLOAT:
|
||||||
|
out.opcode = VALUE_TYPE_FLOAT;
|
||||||
|
out.floatValue = floatValue;
|
||||||
|
return out;
|
||||||
|
case ArrayElementType::POINTER:
|
||||||
|
out.opcode = VALUE_TYPE_PTR;
|
||||||
|
out.pointerValue = pointerValue;
|
||||||
|
return out;
|
||||||
|
case ArrayElementType::STRING:
|
||||||
|
out.opcode = VALUE_TYPE_DYNAMIC_STRING;
|
||||||
|
out.integerValue = programPushString(program, stringValue);
|
||||||
|
return out;
|
||||||
|
default:
|
||||||
|
throw(std::exception());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator<(ArrayElement const& other) const
|
bool operator<(ArrayElement const& other) const
|
||||||
|
@ -197,6 +216,12 @@ public:
|
||||||
throw(std::exception());
|
throw(std::exception());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~ArrayElement(){
|
||||||
|
if (type == ArrayElementType::STRING) {
|
||||||
|
free(stringValue);
|
||||||
|
};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class SFallArray {
|
class SFallArray {
|
||||||
|
|
Loading…
Reference in New Issue