Re-implement check using strongly typed AST with AstNode.