public PEDeltaAssemblyBuilder( SourceAssemblySymbol sourceAssembly, string outputName, OutputKind outputKind, ModulePropertiesForSerialization serializationProperties, IEnumerable<ResourceDescription> manifestResources, Func<AssemblySymbol, AssemblyIdentity> assemblySymbolMapper, EmitBaseline previousGeneration, IEnumerable<SemanticEdit> edits) : base(sourceAssembly, outputName, outputKind, serializationProperties, manifestResources, assemblySymbolMapper, additionalTypes: ImmutableArray<NamedTypeSymbol>.Empty, metadataOnly:false) { var context = new EmitContext(this, null, new DiagnosticBag()); var module = previousGeneration.OriginalMetadata; var compilation = sourceAssembly.DeclaringCompilation; var metadataAssembly = compilation.GetBoundReferenceManager().CreatePEAssemblyForAssemblyMetadata(AssemblyMetadata.Create(module), MetadataImportOptions.All); var metadataDecoder = new Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE.MetadataDecoder(metadataAssembly.PrimaryModule); previousGeneration = EnsureInitialized(previousGeneration, metadataDecoder); var matchToMetadata = new SymbolMatcher(previousGeneration.AnonymousTypeMap, sourceAssembly, context, metadataAssembly); SymbolMatcher matchToPrevious = null; if (previousGeneration.Ordinal > 0) { var previousAssembly = ((CSharpCompilation)previousGeneration.Compilation).SourceAssembly; var previousContext = new EmitContext((PEModuleBuilder)previousGeneration.PEModuleBuilder, null, new DiagnosticBag()); matchToPrevious = new SymbolMatcher(previousGeneration.AnonymousTypeMap, sourceAssembly, context, previousAssembly, previousContext); } this.previousDefinitions = new CSharpDefinitionMap(previousGeneration.OriginalMetadata.Module, edits, metadataDecoder, matchToMetadata, matchToPrevious); this.previousGeneration = previousGeneration; this.changes = new SymbolChanges(this.previousDefinitions, edits); }
public PEDeltaAssemblyBuilder( SourceAssemblySymbol sourceAssembly, string outputName, OutputKind outputKind, ModulePropertiesForSerialization serializationProperties, IEnumerable <ResourceDescription> manifestResources, Func <AssemblySymbol, AssemblyIdentity> assemblySymbolMapper, EmitBaseline previousGeneration, IEnumerable <SemanticEdit> edits) : base(sourceAssembly, outputName, outputKind, serializationProperties, manifestResources, assemblySymbolMapper, additionalTypes: ImmutableArray <NamedTypeSymbol> .Empty, metadataOnly: false) { var context = new EmitContext(this, null, new DiagnosticBag()); var module = previousGeneration.OriginalMetadata; var compilation = sourceAssembly.DeclaringCompilation; var metadataAssembly = compilation.GetBoundReferenceManager().CreatePEAssemblyForAssemblyMetadata(AssemblyMetadata.Create(module), MetadataImportOptions.All); var metadataDecoder = new Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE.MetadataDecoder(metadataAssembly.PrimaryModule); previousGeneration = EnsureInitialized(previousGeneration, metadataDecoder); var matchToMetadata = new CSharpSymbolMatcher(previousGeneration.AnonymousTypeMap, sourceAssembly, context, metadataAssembly); CSharpSymbolMatcher matchToPrevious = null; if (previousGeneration.Ordinal > 0) { var previousAssembly = ((CSharpCompilation)previousGeneration.Compilation).SourceAssembly; var previousContext = new EmitContext((PEModuleBuilder)previousGeneration.PEModuleBuilder, null, new DiagnosticBag()); matchToPrevious = new CSharpSymbolMatcher(previousGeneration.AnonymousTypeMap, sourceAssembly, context, previousAssembly, previousContext); } this.previousDefinitions = new CSharpDefinitionMap(previousGeneration.OriginalMetadata.Module, edits, metadataDecoder, matchToMetadata, matchToPrevious); this.previousGeneration = previousGeneration; this.changes = new SymbolChanges(this.previousDefinitions, edits); }
private static EmitBaseline EnsureInitialized( EmitBaseline previousGeneration, Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE.MetadataDecoder metadataDecoder) { if (previousGeneration.AnonymousTypeMap != null) { return(previousGeneration); } var anonymousTypeMap = GetAnonymousTypeMap(previousGeneration.MetadataReader, metadataDecoder); return(previousGeneration.With( previousGeneration.Compilation, previousGeneration.PEModuleBuilder, previousGeneration.Ordinal, previousGeneration.EncId, previousGeneration.TypesAdded, previousGeneration.EventsAdded, previousGeneration.FieldsAdded, previousGeneration.MethodsAdded, previousGeneration.PropertiesAdded, eventMapAdded: previousGeneration.EventMapAdded, propertyMapAdded: previousGeneration.PropertyMapAdded, methodImplsAdded: previousGeneration.MethodImplsAdded, tableEntriesAdded: previousGeneration.TableEntriesAdded, blobStreamLengthAdded: previousGeneration.BlobStreamLengthAdded, stringStreamLengthAdded: previousGeneration.StringStreamLengthAdded, userStringStreamLengthAdded: previousGeneration.UserStringStreamLengthAdded, guidStreamLengthAdded: previousGeneration.GuidStreamLengthAdded, anonymousTypeMap: anonymousTypeMap, localsForMethodsAddedOrChanged: previousGeneration.LocalsForMethodsAddedOrChanged, localNames: previousGeneration.LocalNames)); }
private static EmitBaseline EnsureInitialized( EmitBaseline previousGeneration, Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE.MetadataDecoder metadataDecoder) { if (previousGeneration.AnonymousTypeMap != null) { return(previousGeneration); } var anonymousTypeMap = GetAnonymousTypeMapFromMetadata(previousGeneration.MetadataReader, metadataDecoder); return(previousGeneration.WithAnonymousTypeMap(anonymousTypeMap)); }