mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 07:08:19 +00:00
script_opt/CPP: errors, recursive type fixes, fix embedded comments
better (than nothing) run-time errors for compiled scripts fixes for dealing with recursive types in compiled scripts fix for values in compiled scripts containing embedded comment markers
This commit is contained in:
parent
b7f7d32bf7
commit
c0dd2b4e81
27 changed files with 181 additions and 65 deletions
|
@ -271,6 +271,9 @@ void CPP_TypeInits::PreInit(InitsManager* im, int offset, ValElemVec& init_vals)
|
|||
inits_vec[offset] = get_record_type__CPP(nullptr);
|
||||
}
|
||||
|
||||
else if ( tag == TYPE_TABLE )
|
||||
inits_vec[offset] = make_intrusive<TableType>(nullptr, nullptr);
|
||||
|
||||
// else no pre-initialization needed
|
||||
}
|
||||
|
||||
|
@ -320,7 +323,7 @@ void CPP_TypeInits::Generate(InitsManager* im, vector<TypePtr>& ivec, int offset
|
|||
break;
|
||||
|
||||
case TYPE_TABLE:
|
||||
t = BuildTableType(im, init_vals);
|
||||
t = BuildTableType(im, init_vals, offset);
|
||||
break;
|
||||
|
||||
case TYPE_FUNC:
|
||||
|
@ -394,13 +397,18 @@ TypePtr CPP_TypeInits::BuildTypeList(InitsManager* im, ValElemVec& init_vals, in
|
|||
return tl;
|
||||
}
|
||||
|
||||
TypePtr CPP_TypeInits::BuildTableType(InitsManager* im, ValElemVec& init_vals) const
|
||||
TypePtr CPP_TypeInits::BuildTableType(InitsManager* im, ValElemVec& init_vals, int offset) const
|
||||
{
|
||||
auto t = cast_intrusive<TableType>(inits_vec[offset]);
|
||||
ASSERT(t);
|
||||
|
||||
auto index = cast_intrusive<TypeList>(im->Types(init_vals[1]));
|
||||
auto yield_i = init_vals[2];
|
||||
auto yield = yield_i >= 0 ? im->Types(yield_i) : nullptr;
|
||||
|
||||
return make_intrusive<TableType>(index, yield);
|
||||
t->SetIndexAndYield(index, yield);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
TypePtr CPP_TypeInits::BuildFuncType(InitsManager* im, ValElemVec& init_vals) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue