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); }
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); }
public void ReferenceDeclaration(IIntermediateStructType declaration) { }
public void DefineDeclaration(IIntermediateStructType declaration) { }
public string Visit(IIntermediateStructType @struct, IntermediateNameRequestDetails context) { return(VisitIntermediateType(@struct, context)); }
void IIntermediateTypeVisitor.Visit(IIntermediateStructType intermediateType) { this.Translate(intermediateType); }
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); }
/// <summary><para>Creates a C♯ compiler warning, relative /// to the abstract model, (level 3) #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())); }
public TestLinkerResult Visit(IIntermediateStructType @struct, ICompilationContext context) { throw new NotImplementedException(); }
public void DefineDeclaration(IIntermediateStructType declaration) { this.DefineDeclaration((IIntermediateType)declaration); }
public abstract void Translate(IIntermediateStructType intermediateType);
public void ReferenceDeclaration(IIntermediateStructType declaration) { this.Formatter.ReferenceDeclaration(declaration); }
public void DefineDeclaration(IIntermediateStructType declaration) { this.Formatter.DefineDeclaration(declaration); }
public TransformationKind Visit(IIntermediateStructType @struct, ITransformationContext context) { throw new NotImplementedException(); }