/// <summary>
        /// Applied to all nodes of the tree
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="visitSubNodes"></param>
        public override void visit(Generated.Namable obj, bool visitSubNodes)
        {
            Namable namable = (Namable)obj;

            if (obj is Types.ITypedElement)
            {
                Types.ITypedElement typedElement = obj as Types.ITypedElement;

                Types.Type type = typedElement.Type;
                if (type == null)
                {
                    namable.AddError("Cannot find type " + typedElement.TypeName);
                }
                else if (!(typedElement is Parameter) && !(type is Types.StateMachine))
                {
                    Types.ITypedElement enclosingTypedElement = Utils.EnclosingFinder <Types.ITypedElement> .find(typedElement);

                    while (enclosingTypedElement != null)
                    {
                        if (enclosingTypedElement.Type == type)
                        {
                            namable.AddError("Recursive types are not allowed for " + type.Name);
                            enclosingTypedElement = null;
                        }
                        else
                        {
                            enclosingTypedElement = Utils.EnclosingFinder <Types.ITypedElement> .find(enclosingTypedElement);
                        }
                    }
                }
            }

            base.visit(obj, visitSubNodes);
        }