Translator: make replaceChildNode() a little more type-safe If we know the type the child node should be, instead of static_cast<>ing to the expected type, use getAs{ExpectedType}() and crash if nullptr. This would have saved me when the ReplaceVariables() AST transformaton replaced a TIntermSymbol in a TIntermGlobalQualifierDeclaration with a TIntermTyped that was not a TIntermSymbol. But TIntermGlobalQualifierDeclaration can only have a TIntermSymbol as a child, so this caused confusing crashes. Other node types have similar expectations of the types of their children. This doesn't enforce any type safety on TIntermAggregate children as those are a little more flexible and complicated. This CL also doesn't enforce non-nullptr children when the parent can't handle nullptr children. Bug: angleproject:42267100 Change-Id: Ic7fb41039705aa4f6daec052940d9bfc4974d955 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5800264 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Matthew Denton <mpdenton@chromium.org>