mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 15:18:20 +00:00
option for internal use to mark a function type as allowing non-expression returns
This commit is contained in:
parent
6cb5ea6835
commit
e22d279fdf
1 changed files with 16 additions and 0 deletions
16
src/Type.h
16
src/Type.h
|
@ -515,6 +515,20 @@ public:
|
|||
*/
|
||||
const std::optional<CaptureList>& GetCaptures() const { return captures; }
|
||||
|
||||
/**
|
||||
* Returns whether it's acceptable for a "return" inside the function
|
||||
* to not have an expression (even though the function has a return
|
||||
* type). Used internally for lambdas built for "when" statements.
|
||||
*/
|
||||
bool ExpressionlessReturnOkay() const { return expressionless_return_okay; }
|
||||
|
||||
/**
|
||||
* Sets whether it's acceptable for a "return" inside the function
|
||||
* to not have an expression (even though the function has a return
|
||||
* type). Used internally for lambdas built for "when" statements.
|
||||
*/
|
||||
void SetExpressionlessReturnOkay(bool is_ok) { expressionless_return_okay = is_ok; }
|
||||
|
||||
protected:
|
||||
friend FuncTypePtr make_intrusive<FuncType>();
|
||||
|
||||
|
@ -526,6 +540,8 @@ protected:
|
|||
std::vector<Prototype> prototypes;
|
||||
|
||||
std::optional<CaptureList> captures; // if nil then no captures specified
|
||||
// Used for internal lambdas built for "when" statements:
|
||||
bool expressionless_return_okay = false;
|
||||
};
|
||||
|
||||
class TypeType final : public Type
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue