pub fn analyze(root: &SyntaxNode) -> AnalysisResultExpand description
Build scope from the tree and run validation. Returns diagnostics and the scope store.
Pass order: (1) ScopeBuilder runs first and builds the scope store and scope ID sequence.
(2) Validator and (3) TypeChecker then use that store so resolution and type checking see the same scopes.