The goal is to start getting percy ready for passing our static analyzer rules
Makes patch-switching logic more static-analyzer friendly
Ditched a look-up table of callbacks for a series of if statements
Disables one of the rendering functions from type-checking due to the nature of the complex type conversions
Here's a rough guide to how this was accomplished:
Most complex fixes are handled with cast() statements. These are performed savely as the necessary checks to narrow the type are too complex for the static analyzer
Some types can be narrowed with TypeGuards, although this is limited. Perhaps in the future we can remove some cast() calls by sub-classing our Node structure instead of using is_<attribute>() functions. As best as I can tell, we can't currently use TypeGuards() in those check functions
Very few statements use assert for type narrowing. These are done ONLY when the line above clearly indicates the type that has been set (but the static analyzer can't pick up on that knowledge)
percy
ready for passing our static analyzer rulesHere's a rough guide to how this was accomplished:
cast()
statements. These are performed savely as the necessary checks to narrow the type are too complex for the static analyzerTypeGuards
, although this is limited. Perhaps in the future we can remove somecast()
calls by sub-classing ourNode
structure instead of usingis_<attribute>()
functions. As best as I can tell, we can't currently useTypeGuards()
in those check functionsassert
for type narrowing. These are done ONLY when the line above clearly indicates the type that has been set (but the static analyzer can't pick up on that knowledge)