예제 #1
0
        internal override CodeElement BuildElement(CodeElement parent)
        {
            CodePhysicalFile file = new CodePhysicalFile(this.Name.ToLowerInvariant());
            foreach (var child in Children)
            {
                var childElement = child.BuildElement(file);
                file.AddChild(childElement);
            }

            return file;
        }
        internal override CodeElement BuildElement(CodeElement parent)
        {
            CodePhysicalFile file = new CodePhysicalFile(this.Name.ToLowerInvariant());

            foreach (var child in Children)
            {
                var childElement = child.BuildElement(file);
                file.AddChild(childElement);
            }

            return(file);
        }
예제 #3
0
        protected virtual string GetFullName(CodeElement parent)
        {
            // full name of the enclosing element if any, otherwise the package name
            string nameQualifier = string.Empty;

            /* '+' if this is a nested type, otherwise '.' if the qualifier is a
             * package or this is a member
             */
            string nameSeparator = string.Empty;

            string name = Name;

            // java doesn't use a type arguments suffix (such as "`n" in .NET) so this will stay empty
            string typeArgumentsSuffix = string.Empty;

            CodePhysicalFile file = parent as CodePhysicalFile;

            if (file != null)
            {
                var packageStatement = file.Children.OfType <CodePackageStatement>().FirstOrDefault();
                if (packageStatement != null)
                {
                    nameQualifier = packageStatement.FullName;
                    if (!string.IsNullOrEmpty(nameQualifier))
                    {
                        nameSeparator = ".";
                    }
                }
            }
            else
            {
                nameQualifier = parent.FullName;
                if (!string.IsNullOrEmpty(nameQualifier))
                {
                    nameSeparator = NestedNameSeparator;
                }
            }

            string fullName = nameQualifier + nameSeparator + name + typeArgumentsSuffix;

            return(fullName);
        }