private static void RemoveSyntaxTreeFromDeclarationMapAndTable( SyntaxTree tree, ref ImmutableDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> declMap, ref DeclarationTable declTable, ref bool referenceDirectivesChanged) { Lazy<RootSingleNamespaceDeclaration> lazyRoot; if (!declMap.TryGetValue(tree, out lazyRoot)) { throw new ArgumentException(string.Format(CSharpResources.SyntaxTreeNotFoundTo, tree), "trees"); } declTable = declTable.RemoveRootDeclaration(lazyRoot); declMap = declMap.Remove(tree); referenceDirectivesChanged = referenceDirectivesChanged || tree.HasReferenceDirectives(); }
private static void AddSyntaxTreeToDeclarationMapAndTable( SyntaxTree tree, CSharpCompilationOptions options, bool isSubmission, ref ImmutableDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> declMap, ref DeclarationTable declTable, ref bool referenceDirectivesChanged) { var lazyRoot = new Lazy<RootSingleNamespaceDeclaration>(() => DeclarationTreeBuilder.ForTree(tree, options.ScriptClassName ?? "", isSubmission)); declMap = declMap.SetItem(tree, lazyRoot); declTable = declTable.AddRootDeclaration(lazyRoot); referenceDirectivesChanged = referenceDirectivesChanged || tree.HasReferenceDirectives(); }