Exemplo n.º 1
0
        public void BuildName(ECMAStore store)
        {
            DisplayName = ItemType == ItemType.Constructor ? Parent.Name : Name;
            if (DisplayName.StartsWith("op_"))
            {
                DisplayName = DisplayName.Substring("op_".Length);
            }
            var displayNameWithoutEII = DisplayName;

            if (IsEII)
            {
                var typeStr   = DisplayName.Substring(0, DisplayName.LastIndexOf('.'));
                var memberStr = DisplayName.Substring(DisplayName.LastIndexOf('.') + 1);
                DisplayName = typeStr.ToDisplayName() + '.' + memberStr;
            }

            string paramPart = null;

            if (Parameters?.Count > 0)
            {
                if (Name == "op_Explicit" || Name == "op_Implicit")
                {
                    var rtype = ReturnValueType.VersionedTypes.First().Value.ToDisplayName();

                    paramPart = string.Format("({0} to {1})", Parameters.First().Type.ToDisplayName(), rtype);
                }
                else if (IsIndexer)
                {
                    paramPart = string.Format("[{0}]", string.Join(", ", Parameters.Select(p => p.Type.ToDisplayName())));
                }
                else
                {
                    paramPart = string.Format("({0})", string.Join(", ", Parameters.Select(p => p.Type.ToDisplayName())));
                }
            }
            else if (ItemType == ItemType.Method || ItemType == ItemType.Constructor)
            {
                paramPart = "()";
            }
            DisplayName    += paramPart;
            FullDisplayName = ((Type)Parent).FullName + "." + displayNameWithoutEII + paramPart;
        }