MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / reduceSuperCount

Function reduceSuperCount

src/ast/ast_lint.cpp:337–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335 // (fall-through + every early-exit). The function-level lint compares this to {1, 1}.
336 struct SuperCountReduced { int lo; int hi; };
337 SuperCountReduced reduceSuperCount ( const SuperCount & c ) {
338 if ( !c.fallsThrough && !c.hasExits ) return {0, 0}; // dead body (panic-only)
339 if ( c.fallsThrough && !c.hasExits ) return {c.fallLo, c.fallHi};
340 if ( !c.fallsThrough && c.hasExits ) return {c.exitLo, c.exitHi};
341 int lo = (c.fallLo < c.exitLo) ? c.fallLo : c.exitLo;
342 int hi = safeMax(c.fallHi, c.exitHi);
343 return {lo, hi};
344 }
345
346 bool needAvoidNullPtr ( const TypeDeclPtr & type, bool allowDim ) {
347 if ( !type ) {

Callers 1

visitMethod · 0.85

Calls 1

safeMaxFunction · 0.85

Tested by

no test coverage detected