resharper/resharper-unity/src/Unity/CSharp/Feature/Services/Generate/Dots/GenerateBakerAndAuthoringActionBuilder.cs [288:331]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - componentCreationExpression.FormatNode(CodeFormatProfile.STRICT); } } private static IClassLikeDeclaration[] CreateBakerClassDeclaration(BakerGenerationInfo generationInfo) { // get parent class 'bakerTypeWithSubstitution' : Baker var bakerGenericBaseClass = TypeFactory.CreateTypeByCLRName(KnownTypes.Baker, NullableAnnotation.NotAnnotated, generationInfo.Module); var bakerTypeElement = bakerGenericBaseClass.GetTypeElement().NotNull(); var substitution = EmptySubstitution.INSTANCE.Extend(bakerTypeElement.TypeParameters[0], generationInfo.DeclaredAuthoringType); var bakerTypeWithSubstitution = TypeFactory.CreateType(bakerTypeElement, substitution, NullableAnnotation.NotAnnotated); //Create class 'ComponentDataBaker : Baker' var (existingBakerTypeElement, _) = TypeFactory.CreateTypeByCLRName(generationInfo.BakerFullName, generationInfo.Module); IClassLikeDeclaration[] bakerClassDeclarations; //Must be derived from bakerTypeWithSubstitution if (existingBakerTypeElement != null && existingBakerTypeElement.IsDescendantOf(bakerTypeWithSubstitution.GetTypeElement())) { bakerClassDeclarations = existingBakerTypeElement.GetDeclarations().OfType().ToArray(); Assertion.Require(bakerClassDeclarations.Length > 0); return bakerClassDeclarations ; } bakerClassDeclarations = new IClassLikeDeclaration[] { (IClassDeclaration)generationInfo.Factory .CreateTypeMemberDeclaration("public class $0 : $1 { }", generationInfo.BakerUniqueClassName, bakerTypeWithSubstitution) }; using (WriteLockCookie.Create()) { var bakerClassDeclaration = bakerClassDeclarations[0]; bakerClassDeclaration = generationInfo.InsertionHelper.Insert(bakerClassDeclaration); bakerClassDeclaration.FormatNode(CodeFormatProfile.COMPACT); bakerClassDeclarations[0] = bakerClassDeclaration; } return bakerClassDeclarations; } private static IMethodDeclaration GetOrCreateBakeMethodExpression(IClassLikeDeclaration[] bakerClassDeclarations, - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - resharper/resharper-unity/src/Unity/CSharp/Feature/Services/Generate/Dots/GenerateBakerAndComponentActionBuilder.cs [232:274]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - componentCreationExpression.FormatNode(CodeFormatProfile.STRICT); } private static IClassLikeDeclaration[] CreateBakerClassDeclaration(BakerGenerationInfo generationInfo) { // get parent class 'bakerTypeWithSubstitution' : Baker var bakerGenericBaseClass = TypeFactory.CreateTypeByCLRName(KnownTypes.Baker, NullableAnnotation.NotAnnotated, generationInfo.Module); var bakerTypeElement = bakerGenericBaseClass.GetTypeElement().NotNull(); var substitution = EmptySubstitution.INSTANCE.Extend(bakerTypeElement.TypeParameters[0], generationInfo.DeclaredAuthoringType); var bakerTypeWithSubstitution = TypeFactory.CreateType(bakerTypeElement, substitution, NullableAnnotation.NotAnnotated); //Create class 'ComponentDataBaker : Baker' var (existingBakerTypeElement, _) = TypeFactory.CreateTypeByCLRName(generationInfo.BakerFullName, generationInfo.Module); IClassLikeDeclaration[] bakerClassDeclarations; //Must be derived from bakerTypeWithSubstitution if (existingBakerTypeElement != null && existingBakerTypeElement.IsDescendantOf(bakerTypeWithSubstitution.GetTypeElement())) { bakerClassDeclarations = existingBakerTypeElement.GetDeclarations().OfType().ToArray(); Assertion.Require(bakerClassDeclarations.Length > 0); return bakerClassDeclarations ; } bakerClassDeclarations = new IClassLikeDeclaration[] { (IClassDeclaration)generationInfo.Factory .CreateTypeMemberDeclaration("public class $0 : $1 { }", generationInfo.BakerUniqueClassName, bakerTypeWithSubstitution) }; using (WriteLockCookie.Create()) { var bakerClassDeclaration = bakerClassDeclarations[0]; bakerClassDeclaration = generationInfo.InsertionHelper.Insert(bakerClassDeclaration); bakerClassDeclaration.FormatNode(CodeFormatProfile.COMPACT); bakerClassDeclarations[0] = bakerClassDeclaration; } return bakerClassDeclarations; } private static IMethodDeclaration GetOrCreateBakeMethodExpression(IClassLikeDeclaration[] bakerClassDeclarations, - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -