private Imports( LanguageCompilation compilation, ImmutableDictionary <string, AliasAndUsingDirective> usingAliases, ImmutableArray <NamespaceOrTypeAndUsingDirective> usings, ImmutableArray <AliasAndExternAliasDirective> externs, DiagnosticBag diagnostics) { Debug.Assert(usingAliases != null); Debug.Assert(!usings.IsDefault); Debug.Assert(!externs.IsDefault); _compilation = compilation; this.UsingAliases = usingAliases; this.Usings = usings; _diagnostics = diagnostics; this.ExternAliases = externs; if (_compilation != null) { _state = SymbolCompletionState.Create(_compilation.Language); } else { _state = null; } }
public void TestNextCompletionPart() { SymbolCompletionState state = new SymbolCompletionState(); Action reader = () => { while (state.IncompleteParts != 0) { Assert.True(SymbolCompletionState.HasAtMostOneBitSet((int)state.NextIncompletePart)); } }; Action writers = () => { Parallel.For(0, Math.Max(1, Environment.ProcessorCount - 1), t => { Random r = new Random(t); while (state.IncompleteParts != 0) { CompletionPart part = (CompletionPart)(1 << r.Next(8 * sizeof(CompletionPart))); state.NotePartComplete(part); } }); }; for (int i = 0; i < 1000; i++) { Parallel.Invoke(reader, writers); } }
private AliasSymbol(Binder binder, NamespaceOrTypeSymbol target, string aliasName, ImmutableArray <Location> locations) { _aliasName = aliasName; _locations = locations; _aliasTarget = target; _binder = binder; _state = SymbolCompletionState.Create(binder.Language); _state.NotePartComplete(CompletionPart.AliasTarget); }
public Members(DeclaredSymbol symbol, SymbolCompletionState state, ImmutableArray <Symbol> nonTypeMembers, ImmutableArray <NamedTypeSymbol> typeMembers) { Debug.Assert(!nonTypeMembers.IsDefault); Debug.Assert(!typeMembers.IsDefault); Debug.Assert(!nonTypeMembers.Any(s => s is ITypeSymbol)); Debug.Assert(!typeMembers.Any(s => !(s is ITypeSymbol))); _symbol = symbol; _state = state; this.NamedNonTypeMembers = nonTypeMembers.WhereAsArray(m => m.Name != null); this.NamedTypeMembers = typeMembers.WhereAsArray(m => m.Name != null); this.AnonymousNonTypeMembers = nonTypeMembers.WhereAsArray(m => m.Name == null); this.AnonymousTypeMembers = typeMembers.WhereAsArray(m => m.Name == null); }
internal SourceModuleSymbol( SourceAssemblySymbol assemblySymbol, MutableModel modelBuilder, DeclarationTable declarations, string moduleName) { Debug.Assert((object)assemblySymbol != null); _assemblySymbol = assemblySymbol; _modelBuilder = modelBuilder; _sources = declarations; _name = moduleName; _csharpSymbolMap = new CSharpSymbolMap(this); _state = SymbolCompletionState.Create(assemblySymbol.Language); }
public SourceMemberContainerTypeSymbol( DeclaredSymbol containingSymbol, MergedDeclaration declaration, DiagnosticBag diagnostics) { _containingSymbol = containingSymbol; _declaration = declaration; if (declaration.Kind != null) { _modelObject = declaration.GetModelObject(containingSymbol?.ModelObject as MutableObjectBase, containingSymbol.ModelBuilder, diagnostics); Debug.Assert(_modelObject != null); } foreach (var singleDeclaration in declaration.Declarations) { diagnostics.AddRange(singleDeclaration.Diagnostics); } _state = SymbolCompletionState.Create(containingSymbol.Language); }
public SourceNamespaceSymbol( SourceModuleSymbol module, Symbol container, MergedDeclaration declaration, DiagnosticBag diagnostics) { Debug.Assert(declaration != null); _module = module; _container = container; _declaration = declaration; if (declaration.Kind != null) { _modelObject = declaration.GetModelObject(container?.ModelObject as MutableObjectBase, module.ModelBuilder, diagnostics); Debug.Assert(_modelObject != null); } foreach (var singleDeclaration in declaration.Declarations) { diagnostics.AddRange(singleDeclaration.Diagnostics); } _state = SymbolCompletionState.Create(module.Language); }
public MembersBuilder(DeclaredSymbol symbol, SymbolCompletionState state) { _symbol = symbol; _state = state; }
public SourceDeclaration(DeclaredSymbol symbol, MergedDeclaration declaration, SymbolCompletionState state) { _symbol = symbol; _state = state; _declaration = declaration; }