Fixes memory leaks in ParsedVirtPropStatement.
This commit is contained in:
parent
823b00777e
commit
6e0aa65625
|
@ -211,34 +211,40 @@ namespace MalachScript::Parser {
|
|||
_setStatement(setStatement) {}
|
||||
|
||||
[[nodiscard]] inline AccessModifier GetAccess() const noexcept { return _access; }
|
||||
[[nodiscard]] inline const ParsedStatement* GetReturnType() const noexcept { return _returnType; }
|
||||
[[nodiscard]] inline const std::unique_ptr<const ParsedStatement>& GetReturnType() const noexcept {
|
||||
return _returnType;
|
||||
}
|
||||
[[nodiscard]] inline bool IsReturnTypeRef() const noexcept { return _isReturnTypeRef; }
|
||||
[[nodiscard]] inline const Identifier& GetIdentifier() const noexcept { return _identifier; }
|
||||
|
||||
[[nodiscard]] inline bool HasGet() const noexcept { return _hasGet; }
|
||||
[[nodiscard]] inline bool IsGetConst() const noexcept { return _getConst; }
|
||||
[[nodiscard]] inline FuncAttr GetGetFuncAttr() const noexcept { return _getAttr; }
|
||||
[[nodiscard]] inline const ParsedStatement* GetGetStatement() const noexcept { return _getStatement; }
|
||||
[[nodiscard]] inline const std::unique_ptr<const ParsedStatement>& GetGetStatement() const noexcept {
|
||||
return _getStatement;
|
||||
}
|
||||
|
||||
[[nodiscard]] inline bool HasSet() const noexcept { return _hasSet; }
|
||||
[[nodiscard]] inline bool IsSetConst() const noexcept { return _setConst; }
|
||||
[[nodiscard]] inline FuncAttr GetSetFuncAttr() const noexcept { return _setAttr; }
|
||||
[[nodiscard]] inline const ParsedStatement* GetSetStatement() const noexcept { return _setStatement; }
|
||||
[[nodiscard]] inline const std::unique_ptr<const ParsedStatement>& GetSetStatement() const noexcept {
|
||||
return _setStatement;
|
||||
}
|
||||
|
||||
private:
|
||||
AccessModifier _access;
|
||||
const ParsedStatement* _returnType;
|
||||
std::unique_ptr<const ParsedStatement> _returnType;
|
||||
bool _isReturnTypeRef;
|
||||
Identifier _identifier;
|
||||
|
||||
bool _hasGet = false;
|
||||
bool _getConst = false;
|
||||
FuncAttr _getAttr = FuncAttr::None;
|
||||
const ParsedStatement* _getStatement;
|
||||
std::unique_ptr<const ParsedStatement> _getStatement;
|
||||
bool _hasSet = false;
|
||||
bool _setConst = false;
|
||||
FuncAttr _setAttr = FuncAttr::None;
|
||||
const ParsedStatement* _setStatement;
|
||||
std::unique_ptr<const ParsedStatement> _setStatement;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -43,4 +43,8 @@ PARSE_TEST("Parse class with virtprop", "class foobar { private bool foo { get;
|
|||
auto virtPropStatement = dynamic_cast<const MalachScript::Parser::ParsedVirtPropStatement*>(firstClassStatement);
|
||||
REQUIRE(virtPropStatement->GetAccess() == MalachScript::AccessModifier::Private);
|
||||
REQUIRE(virtPropStatement->GetIdentifier().GetString() == u8"foo");
|
||||
REQUIRE(virtPropStatement->HasGet());
|
||||
REQUIRE(virtPropStatement->HasSet());
|
||||
REQUIRE(virtPropStatement->GetGetStatement() == nullptr);
|
||||
REQUIRE(virtPropStatement->GetSetStatement() == nullptr);
|
||||
})
|
Loading…
Reference in New Issue