Implements basic virtprop parsing.
This commit is contained in:
@@ -54,6 +54,12 @@ namespace MalachScript::Parser {
|
||||
for (size_t i = 0; i < body.size(); i++)
|
||||
_body[i] = std::unique_ptr<const ParsedStatement>(body[i]);
|
||||
}
|
||||
|
||||
[[nodiscard]] const Identifier& GetIdentifier() const noexcept { return _identifier; }
|
||||
[[nodiscard]] const std::vector<Identifier>& GetInherits() const noexcept { return _inherits; }
|
||||
[[nodiscard]] const std::vector<std::unique_ptr<const ParsedStatement>>& GetBody() const noexcept {
|
||||
return _body;
|
||||
}
|
||||
};
|
||||
|
||||
class ParsedTypeDefStatement : public ParsedStatementImpl<ParsedStatementKind::TypeDef> {
|
||||
@@ -192,6 +198,48 @@ namespace MalachScript::Parser {
|
||||
return _statBlock;
|
||||
}
|
||||
};
|
||||
|
||||
class ParsedVirtPropStatement : public ParsedStatementImpl<ParsedStatementKind::VirtProp> {
|
||||
public:
|
||||
ParsedVirtPropStatement(const TextSpan& span, AccessModifier access, const ParsedStatement* returnType,
|
||||
bool isReturnTypeRef, Identifier identifier, bool hasGet, bool getConst,
|
||||
FuncAttr getAttr, const ParsedStatement* getStatement, bool hasSet, bool setConst,
|
||||
FuncAttr setAttr, const ParsedStatement* setStatement)
|
||||
: ParsedStatementImpl(span), _access(access), _returnType(returnType), _isReturnTypeRef(isReturnTypeRef),
|
||||
_identifier(identifier), _hasGet(hasGet), _getConst(getConst), _getAttr(getAttr),
|
||||
_getStatement(getStatement), _hasSet(hasSet), _setConst(setConst), _setAttr(setAttr),
|
||||
_setStatement(setStatement) {}
|
||||
|
||||
[[nodiscard]] inline AccessModifier GetAccess() const noexcept { return _access; }
|
||||
[[nodiscard]] inline 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 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; }
|
||||
|
||||
private:
|
||||
AccessModifier _access;
|
||||
const ParsedStatement* _returnType;
|
||||
bool _isReturnTypeRef;
|
||||
Identifier _identifier;
|
||||
|
||||
bool _hasGet = false;
|
||||
bool _getConst = false;
|
||||
FuncAttr _getAttr = FuncAttr::None;
|
||||
const ParsedStatement* _getStatement;
|
||||
bool _hasSet = false;
|
||||
bool _setConst = false;
|
||||
FuncAttr _setAttr = FuncAttr::None;
|
||||
const ParsedStatement* _setStatement;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // MALACHSCRIPT_PARSEDSTATEMENT_HPP
|
||||
|
||||
Reference in New Issue
Block a user