public void Visit(IdNode node) { if (!scope.IsDefined(node.text, out node.staticType)) { errors.Add(ErrorSemantic.NotDeclaredVariable(node)); } }
public void Visit(AssignNode node) { node.exprBody.Accept(this); if (!scope.IsDefined(node.Id.text, out TypeInfo type)) { errors.Add(ErrorSemantic.NotDeclaredVariable(node.Id)); } if (!(node.exprBody.staticType <= type)) { errors.Add(ErrorSemantic.CannotConvert(node, node.exprBody.staticType, type)); } node.staticType = node.exprBody.staticType; }