mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 19:48:20 +00:00
minor changes for more robust behavior in the face of errors
This commit is contained in:
parent
b7c9940221
commit
0742d2da29
1 changed files with 14 additions and 4 deletions
18
src/Expr.cc
18
src/Expr.cc
|
@ -573,10 +573,16 @@ void NameExpr::ExprDescribe(ODesc* d) const
|
||||||
ConstExpr::ConstExpr(ValPtr arg_val)
|
ConstExpr::ConstExpr(ValPtr arg_val)
|
||||||
: Expr(EXPR_CONST), val(std::move(arg_val))
|
: Expr(EXPR_CONST), val(std::move(arg_val))
|
||||||
{
|
{
|
||||||
if ( val->GetType()->Tag() == TYPE_LIST && val->AsListVal()->Length() == 1 )
|
if ( val )
|
||||||
val = val->AsListVal()->Idx(0);
|
{
|
||||||
|
if ( val->GetType()->Tag() == TYPE_LIST &&
|
||||||
|
val->AsListVal()->Length() == 1 )
|
||||||
|
val = val->AsListVal()->Idx(0);
|
||||||
|
|
||||||
SetType(val->GetType());
|
SetType(val->GetType());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
SetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConstExpr::ExprDescribe(ODesc* d) const
|
void ConstExpr::ExprDescribe(ODesc* d) const
|
||||||
|
@ -3785,7 +3791,11 @@ void FieldAssignExpr::ExprDescribe(ODesc* d) const
|
||||||
d->Add("$");
|
d->Add("$");
|
||||||
d->Add(FieldName());
|
d->Add(FieldName());
|
||||||
d->Add("=");
|
d->Add("=");
|
||||||
op->Describe(d);
|
|
||||||
|
if ( op )
|
||||||
|
op->Describe(d);
|
||||||
|
else
|
||||||
|
d->Add("<error>");
|
||||||
}
|
}
|
||||||
|
|
||||||
ArithCoerceExpr::ArithCoerceExpr(ExprPtr arg_op, TypeTag t)
|
ArithCoerceExpr::ArithCoerceExpr(ExprPtr arg_op, TypeTag t)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue