mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 09:08:20 +00:00
fix: ZAM could misinterpret a "type" switch that starts with a "default"
This commit is contained in:
parent
a09c5e6bde
commit
7a66b4fea4
1 changed files with 3 additions and 5 deletions
|
@ -410,12 +410,10 @@ const ZAMStmt ZAMCompiler::CompileSwitch(const SwitchStmt* sw)
|
||||||
// Need to track a new set of contexts for "break" statements.
|
// Need to track a new set of contexts for "break" statements.
|
||||||
PushBreaks();
|
PushBreaks();
|
||||||
|
|
||||||
auto& cases = *sw->Cases();
|
if ( sw->TypeMap()->empty() )
|
||||||
|
|
||||||
if ( cases.length() > 0 && cases[0]->TypeCases() )
|
|
||||||
return TypeSwitch(sw, n, c);
|
|
||||||
else
|
|
||||||
return ValueSwitch(sw, n, c);
|
return ValueSwitch(sw, n, c);
|
||||||
|
else
|
||||||
|
return TypeSwitch(sw, n, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ZAMStmt ZAMCompiler::ValueSwitch(const SwitchStmt* sw, const NameExpr* v, const ConstExpr* c)
|
const ZAMStmt ZAMCompiler::ValueSwitch(const SwitchStmt* sw, const NameExpr* v, const ConstExpr* c)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue