mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
Fix init of local sets/vectors via curly brace initializer lists.
This commit is contained in:
parent
a2556642e6
commit
c88babf6ef
3 changed files with 98 additions and 5 deletions
21
src/Expr.cc
21
src/Expr.cc
|
@ -2507,15 +2507,26 @@ bool AssignExpr::TypeCheck(attr_list* attrs)
|
|||
attr_copy->append((*attrs)[i]);
|
||||
}
|
||||
|
||||
op2 = new TableConstructorExpr(op2->AsListExpr(), attr_copy);
|
||||
if ( op1->Type()->IsSet() )
|
||||
op2 = new SetConstructorExpr(op2->AsListExpr(), attr_copy);
|
||||
else
|
||||
op2 = new TableConstructorExpr(op2->AsListExpr(), attr_copy);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( bt1 == TYPE_VECTOR && bt2 == bt1 &&
|
||||
op2->Type()->AsVectorType()->IsUnspecifiedVector() )
|
||||
if ( bt1 == TYPE_VECTOR )
|
||||
{
|
||||
op2 = new VectorCoerceExpr(op2, op1->Type()->AsVectorType());
|
||||
return true;
|
||||
if ( bt2 == bt1 && op2->Type()->AsVectorType()->IsUnspecifiedVector() )
|
||||
{
|
||||
op2 = new VectorCoerceExpr(op2, op1->Type()->AsVectorType());
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( op2->Tag() == EXPR_LIST )
|
||||
{
|
||||
op2 = new VectorConstructorExpr(op2->AsListExpr());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( op1->Type()->Tag() == TYPE_RECORD &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue