mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
Allow named record constructors. Addresses #983.
This commit is contained in:
parent
d67123d0c3
commit
a0ad87b4c2
6 changed files with 105 additions and 7 deletions
17
src/Expr.h
17
src/Expr.h
|
@ -57,6 +57,7 @@ extern const char* expr_name(BroExprTag t);
|
|||
class Stmt;
|
||||
class Frame;
|
||||
class ListExpr;
|
||||
class NameExpr;
|
||||
class CallExpr;
|
||||
class EventExpr;
|
||||
|
||||
|
@ -165,6 +166,17 @@ public:
|
|||
return (ListExpr*) this;
|
||||
}
|
||||
|
||||
const NameExpr* AsNameExpr() const
|
||||
{
|
||||
CHECK_TAG(tag, EXPR_NAME, "ExprVal::AsNameExpr", expr_name)
|
||||
return (const NameExpr*) this;
|
||||
}
|
||||
NameExpr* AsNameExpr()
|
||||
{
|
||||
CHECK_TAG(tag, EXPR_NAME, "ExprVal::AsNameExpr", expr_name)
|
||||
return (NameExpr*) this;
|
||||
}
|
||||
|
||||
void Describe(ODesc* d) const;
|
||||
|
||||
bool Serialize(SerialInfo* info) const;
|
||||
|
@ -729,7 +741,8 @@ protected:
|
|||
|
||||
class RecordConstructorExpr : public UnaryExpr {
|
||||
public:
|
||||
RecordConstructorExpr(ListExpr* constructor_list);
|
||||
RecordConstructorExpr(ListExpr* constructor_list, BroType* arg_type = 0);
|
||||
~RecordConstructorExpr();
|
||||
|
||||
protected:
|
||||
friend class Expr;
|
||||
|
@ -741,6 +754,8 @@ protected:
|
|||
void ExprDescribe(ODesc* d) const;
|
||||
|
||||
DECLARE_SERIAL(RecordConstructorExpr);
|
||||
|
||||
RecordType* ctor_type; // type inferred from the ctor expression list args
|
||||
};
|
||||
|
||||
class TableConstructorExpr : public UnaryExpr {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue