Merge remote-tracking branch 'origin/topic/vern/CPP-type-switch'

* origin/topic/vern/CPP-type-switch:
  support for compiling type-based switches to C++
  make encountering uncompilable "standalone" functions to be a hard error
  fix: ZAM could misinterpret a "type" switch that starts with a "default"
  fix: don't treat pseudo-identifiers in type cases as local variables
  removed development helper scripts now obsolete with --optimize-files=
This commit is contained in:
Tim Wojtulewicz 2022-01-11 15:02:37 -07:00
commit 2accf6dfbf
18 changed files with 130 additions and 139 deletions

View file

@ -410,12 +410,10 @@ const ZAMStmt ZAMCompiler::CompileSwitch(const SwitchStmt* sw)
// Need to track a new set of contexts for "break" statements.
PushBreaks();
auto& cases = *sw->Cases();
if ( cases.length() > 0 && cases[0]->TypeCases() )
return TypeSwitch(sw, n, c);
else
if ( sw->TypeMap()->empty() )
return ValueSwitch(sw, n, c);
else
return TypeSwitch(sw, n, c);
}
const ZAMStmt ZAMCompiler::ValueSwitch(const SwitchStmt* sw, const NameExpr* v, const ConstExpr* c)