Example #1
0
        ///////////////////////////////////////////////////////////////////////

        private void AfterNameChange(
            string oldName,
            bool global
            )
        {
            //
            // HACK: The qualified name of the global namespace cannot be
            //       changed; however, we let the local name be changed.
            //
            if (!global)
            {
                ResetQualifiedName();

                //
                // NOTE: For the rest of the steps in here, we want to make
                //       sure that the name is actually different now.
                //
                if (!NamespaceOps.IsSame(oldName, name))
                {
                    //
                    // HACK: Next, force all child namespaces to recompute
                    //       their qualified names as well.
                    //
                    ResetChildNames(null, true);

                    //
                    // HACK: Finally, "notify" the parent namespace that our
                    //       name has been changed (i.e. so it can update its
                    //       list of children).
                    //
                    if (parent != null)
                    {
                        ReturnCode renameCode;
                        Result     renameError = null;

                        renameCode = parent.RenameChild(
                            oldName, name, ref renameError);

                        if (renameCode != ReturnCode.Ok)
                        {
                            DebugOps.Complain(
                                interpreter, renameCode, renameError);
                        }
                    }
                }
            }
        }