private static bool AnyMembers(IIntermediateStructType @struct)
 {
     return(@struct.BinaryOperatorCoercions.ExclusivelyOnParent().Count() > 0 ||
            @struct.Constructors.ExclusivelyOnParent().Count() > 0 ||
            @struct.Events.ExclusivelyOnParent().Count() > 0 ||
            @struct.Fields.ExclusivelyOnParent().Count() > 0 ||
            @struct.Indexers.ExclusivelyOnParent().Count() > 0 ||
            @struct.Methods.ExclusivelyOnParent().Count() > 0 ||
            @struct.Properties.ExclusivelyOnParent().Count() > 0 ||
            @struct.TypeCoercions.ExclusivelyOnParent().Count() > 0 ||
            @struct.UnaryOperatorCoercions.ExclusivelyOnParent().Count() > 0 ||
            @struct.IsRoot && (@struct.Metadata.Count > 0 ||
                               @struct.SummaryText != null ||
                               @struct.RemarksText != null));
 }
 public string Visit(IIntermediateStructType @struct, DefaultAssemblyFilenameVisitorContext context)
 {
     VisitTypeParent(@struct, context);
     if (context.CurrentResult == null)
     {
         if (AnyMembers(@struct) || @struct.IsRoot)
         {
             context.CurrentResult = string.Format(@"{0}\{1}", ToBaselineNamespaceName(@struct.NamespaceName, context), @struct.FullName.Substring(@struct.NamespaceName.Length == 0 ? 0 : @struct.NamespaceName.Length + 1));
         }
     }
     else if (AnyMembers(@struct))
     {
         context.CurrentResult = context.CurrentResult.Replace(@struct.Name, string.Format("[{0}]", @struct.Name));
     }
     return(context.CurrentResult);
 }
コード例 #3
0
 public CSharpAssemblyFileInfo Visit(IIntermediateStructType @struct, CSharpAssemblyFileContext context)
 {
     VisitTypeParent(@struct, context);
     if (!context.CurrentResult.YieldsFile)
     {
         if (AnyMembers(@struct) || @struct.IsRoot)
         {
             context.CurrentResult.FileName = string.Format(@"{0}\{1}", ToBaselineNamespaceName(@struct.NamespaceName, context), @struct.FullName.Substring(@struct.NamespaceName.Length == 0 ? 0 : @struct.NamespaceName.Length + 1));
         }
     }
     else if (AnyMembers(@struct))
     {
         context.CurrentResult.FileName = context.CurrentResult.FileName.Replace(@struct.Name, string.Format("[{0}]", @struct.Name));
     }
     return(context.CurrentResult);
 }
コード例 #4
0
 public void ReferenceDeclaration(IIntermediateStructType declaration)
 {
 }
コード例 #5
0
 public void DefineDeclaration(IIntermediateStructType declaration)
 {
 }
コード例 #6
0
 public string Visit(IIntermediateStructType @struct, IntermediateNameRequestDetails context)
 {
     return(VisitIntermediateType(@struct, context));
 }
コード例 #7
0
 void IIntermediateTypeVisitor.Visit(IIntermediateStructType intermediateType)
 {
     this.Translate(intermediateType);
 }
コード例 #8
0
        public IIntermediateGenericType Add(string name, TypeKindGeneric kind, params GenericParameterData[] genParamData)
        {
            if (genParamData == null)
            {
                throw new ArgumentNullException("genParamData");
            }
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            IIntermediateGenericType rResult = null;
            var assembly = this.Parent.Assembly;

            switch (kind)
            {
            case TypeKindGeneric.Class:
            {
                IIntermediateClassType insertionElement = null;
                if (assembly != null)
                {
                    IIntermediateTypeCtorLanguageService <IIntermediateClassType> classService;
                    if (assembly.Provider.TryGetService(LanguageGuids.Services.ClassServices.ClassCreatorService, out classService))
                    {
                        insertionElement = classService.New(name, this.Parent);
                    }
                }
                if (insertionElement == null)
                {
                    insertionElement = new IntermediateClassType(name, this.Parent);
                }
                if (genParamData.Length > 0)
                {
                    insertionElement.TypeParameters.AddRange(genParamData);
                }
                rResult = insertionElement;
                this.Parent.Classes.Add(insertionElement);
            }
            break;

            case TypeKindGeneric.Delegate:
            {
                IIntermediateDelegateType insertionElement = null;
                if (assembly != null && assembly.Provider != null)
                {
                    IIntermediateTypeCtorLanguageService <IIntermediateDelegateType> delegateService;
                    if (assembly.Provider.TryGetService(LanguageGuids.Services.IntermediateDelegateCreatorService, out delegateService))
                    {
                        insertionElement = delegateService.New(name, this.Parent);
                    }
                }
                if (insertionElement == null)
                {
                    insertionElement = new IntermediateDelegateType(name, this.Parent);
                }
                if (genParamData.Length > 0)
                {
                    insertionElement.TypeParameters.AddRange(genParamData);
                }
                rResult = insertionElement;
                this.Parent.Delegates.Add(insertionElement);
            }
            break;

            case TypeKindGeneric.Interface:
            {
                IIntermediateInterfaceType insertionElement = null;
                if (assembly != null && assembly.Provider != null)
                {
                    IIntermediateTypeCtorLanguageService <IIntermediateInterfaceType> interfaceService;
                    if (assembly.Provider.TryGetService(LanguageGuids.Services.InterfaceServices.InterfaceCreatorService, out interfaceService))
                    {
                        insertionElement = interfaceService.New(name, this.Parent);
                    }
                }
                if (insertionElement == null)
                {
                    insertionElement = new IntermediateInterfaceType(name, this.Parent);
                }
                if (genParamData.Length > 0)
                {
                    insertionElement.TypeParameters.AddRange(genParamData);
                }
                rResult = insertionElement;
                this.Parent.Interfaces.Add(insertionElement);
            }
            break;

            case TypeKindGeneric.Struct:
            {
                IIntermediateStructType insertionElement = null;
                if (assembly != null && assembly.Provider != null)
                {
                    IIntermediateTypeCtorLanguageService <IIntermediateStructType> structService;
                    if (assembly.Provider.TryGetService(LanguageGuids.Services.StructServices.StructCreatorService, out structService))
                    {
                        insertionElement = structService.New(name, this.Parent);
                    }
                }
                if (insertionElement == null)
                {
                    insertionElement = new IntermediateStructType(name, this.Parent);
                }
                if (genParamData.Length > 0)
                {
                    insertionElement.TypeParameters.AddRange(genParamData);
                }
                rResult = insertionElement;
                this.Parent.Structs.Add(insertionElement);
            }
            break;

            default:
                throw new NotSupportedException();
            }
            return(rResult);
        }
コード例 #9
0
 /// <summary><para>Creates a C&#9839; compiler warning, relative
 /// to the abstract model, (level 3) &#35;282:</para>
 /// <para>There is no defined ordering between fields in multiple
 /// declarations of <paramref name="offendingStruct"/>. To specify an
 /// ordering, all instance fields must be in the same declaration.
 /// </para></summary>
 /// <param name="offendingStruct">The <see cref="IIntermediateStructType"/>
 /// which contains one or more partial instance which contains
 /// fields.</param>
 public static ICompilerModelWarning <IIntermediateStructType> WarningCS0282(IIntermediateStructType offendingStruct)
 {
     //ToDo: Add location information to structs.
     return(new CompilerModelWarning <IIntermediateStructType>(CS0282, offendingStruct, offendingStruct.UniqueIdentifier.ToString()));
 }
コード例 #10
0
 public TestLinkerResult Visit(IIntermediateStructType @struct, ICompilationContext context)
 {
     throw new NotImplementedException();
 }
コード例 #11
0
 public void DefineDeclaration(IIntermediateStructType declaration)
 {
     this.DefineDeclaration((IIntermediateType)declaration);
 }
コード例 #12
0
 public abstract void Translate(IIntermediateStructType intermediateType);
コード例 #13
0
 public void ReferenceDeclaration(IIntermediateStructType declaration)
 {
     this.Formatter.ReferenceDeclaration(declaration);
 }
コード例 #14
0
 public void DefineDeclaration(IIntermediateStructType declaration)
 {
     this.Formatter.DefineDeclaration(declaration);
 }
コード例 #15
0
 public TransformationKind Visit(IIntermediateStructType @struct, ITransformationContext context)
 {
     throw new NotImplementedException();
 }