mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
fix for return's inside of hook's
This commit is contained in:
parent
b405708994
commit
c96dd5d5b3
1 changed files with 7 additions and 1 deletions
|
@ -831,7 +831,7 @@ const ZAMStmt ZAMCompiler::LoopOverTable(const ForStmt* f, const NameExpr* val)
|
||||||
// Need a separate instance of aux so the CFT info doesn't get shared with
|
// Need a separate instance of aux so the CFT info doesn't get shared with
|
||||||
// the loop init. We populate it with the loop_vars (only) because the
|
// the loop init. We populate it with the loop_vars (only) because the
|
||||||
// optimizer needs access to those for (1) tracking their lifetime, and
|
// optimizer needs access to those for (1) tracking their lifetime, and
|
||||||
// (2) remapping them (not strictly needed, see the comment in ReMapFrame().
|
// (2) remapping them (not strictly needed, see the comment in ReMapFrame()).
|
||||||
zn.aux = new ZInstAux(0);
|
zn.aux = new ZInstAux(0);
|
||||||
zn.aux->loop_vars = aux->loop_vars;
|
zn.aux->loop_vars = aux->loop_vars;
|
||||||
AddCFT(&zn, CFT_LOOP);
|
AddCFT(&zn, CFT_LOOP);
|
||||||
|
@ -977,6 +977,12 @@ const ZAMStmt ZAMCompiler::CompileReturn(const ReturnStmt* r) {
|
||||||
|
|
||||||
if ( retvars.empty() ) { // a "true" return
|
if ( retvars.empty() ) { // a "true" return
|
||||||
if ( e ) {
|
if ( e ) {
|
||||||
|
if ( pf->ProfiledFunc()->Flavor() == FUNC_FLAVOR_HOOK ) {
|
||||||
|
ASSERT(e->GetType()->Tag() == TYPE_BOOL);
|
||||||
|
auto true_c = make_intrusive<ConstExpr>(val_mgr->True());
|
||||||
|
return ReturnC(true_c.get());
|
||||||
|
}
|
||||||
|
|
||||||
if ( e->Tag() == EXPR_NAME )
|
if ( e->Tag() == EXPR_NAME )
|
||||||
return ReturnV(e->AsNameExpr());
|
return ReturnV(e->AsNameExpr());
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue