public void RegisterUnresolvedFile(IProject project, IUnresolvedFile unresolvedFile) { if (project == null) { throw new ArgumentNullException("project"); } if (unresolvedFile == null) { throw new ArgumentNullException("unresolvedFile"); } FreezableHelper.Freeze(unresolvedFile); var newParseInfo = new ParseInformation(unresolvedFile, null, false); rwLock.EnterWriteLock(); try { int index = FindIndexForProject(project); if (index >= 0) { currentVersion = null; var args = new ParseInformationEventArgs(project, entries[index].UnresolvedFile, newParseInfo); entries[index] = new ProjectEntry(project, unresolvedFile, null); project.OnParseInformationUpdated(args); parserService.RaiseParseInformationUpdated(args); } } finally { rwLock.ExitWriteLock(); } }
/// <summary> /// Overwrites the properties in this HighlightingColor with those from the given color; /// but maintains the current values where the properties of the given color return <c>null</c>. /// </summary> public void MergeWith(HighlightingColor color) { FreezableHelper.ThrowIfFrozen(this); if (color.fontWeight != null) { this.fontWeight = color.fontWeight; } if (color.fontStyle != null) { this.fontStyle = color.fontStyle; } if (color.foreground != null) { this.foreground = color.foreground; } if (color.background != null) { this.background = color.background; } if (color.underline != null) { this.underline = color.underline; } if (color.fontFamily != null) { this.fontFamily = color.fontFamily; } if (color.fontSize != null) { this.fontSize = color.fontSize; } }
protected override void FreezeInternal() { base.FreezeInternal(); FreezableHelper.Freeze(addAccessor); FreezableHelper.Freeze(removeAccessor); FreezableHelper.Freeze(invokeAccessor); }
protected override void FreezeInternal() { parameters = FreezableHelper.FreezeListAndElements(parameters); FreezableHelper.Freeze(getter); FreezableHelper.Freeze(setter); base.FreezeInternal(); }
protected override void FreezeInternal() { conditionalSymbols = FreezableHelper.FreezeList(conditionalSymbols); specificWarningsAsErrors = FreezableHelper.FreezeList(specificWarningsAsErrors); disabledWarnings = FreezableHelper.FreezeList(disabledWarnings); base.FreezeInternal(); }
protected override void FreezeInternal() { returnTypeAttributes = FreezableHelper.FreezeListAndElements(returnTypeAttributes); typeParameters = FreezableHelper.FreezeListAndElements(typeParameters); parameters = FreezableHelper.FreezeListAndElements(parameters); base.FreezeInternal(); }
protected override void FreezeInternal() { base.FreezeInternal(); baseTypes = FreezableHelper.FreezeList(baseTypes); typeParameters = FreezableHelper.FreezeListAndElements(typeParameters); nestedTypes = FreezableHelper.FreezeListAndElements(nestedTypes); members = FreezableHelper.FreezeListAndElements(members); }
protected virtual void FreezeInternal() { attributes = FreezableHelper.FreezeListAndElements(attributes); if (rareFields != null) { rareFields.FreezeInternal(); } }
public void AddDocumentation(IUnresolvedEntity entity, string xmlDocumentation) { FreezableHelper.ThrowIfFrozen(this); if (documentation == null) { documentation = new Dictionary <IUnresolvedEntity, string>(); } documentation.Add(entity, xmlDocumentation); }
protected override void FreezeInternal() { base.FreezeInternal(); rootUsingScope.Freeze(); topLevelTypeDefinitions = FreezableHelper.FreezeListAndElements(topLevelTypeDefinitions); assemblyAttributes = FreezableHelper.FreezeListAndElements(assemblyAttributes); moduleAttributes = FreezableHelper.FreezeListAndElements(moduleAttributes); usingScopes = FreezableHelper.FreezeListAndElements(usingScopes); }
void SetFlag(byte flag, bool value) { FreezableHelper.ThrowIfFrozen(this); if (value) { this.flags |= flag; } else { this.flags &= unchecked ((byte)~flag); } }
protected override void FreezeInternal() { usings = FreezableHelper.FreezeList(usings); usingAliases = FreezableHelper.FreezeList(usingAliases); externAliases = FreezableHelper.FreezeList(externAliases); // In current model (no child scopes), it makes sense to freeze the parent as well // to ensure the whole lookup chain is immutable. if (parent != null) { parent.Freeze(); } base.FreezeInternal(); }
ProjectEntry DoParse(ITextSource fileContent, IProject parentProject, bool fullParseInformationRequested, CancellationToken cancellationToken) { if (parser == null) { return(default(ProjectEntry)); } if (fileContent == null) { // No file content was specified. Because the callers of this method already check for currently open files, // we can assume that the file isn't open and simply read it from disk. try { fileContent = SD.FileService.GetFileContentFromDisk(fileName, cancellationToken); } catch (IOException) { // It is possible that the file gets deleted/becomes inaccessible while a background parse // operation is enqueued, so we have to handle IO exceptions. return(default(ProjectEntry)); } catch (UnauthorizedAccessException) { return(default(ProjectEntry)); } } ProjectEntry result; rwLock.EnterUpgradeableReadLock(); try { int index = FindIndexForProject(parentProject); int versionComparison = CompareVersions(fileContent.Version); if (versionComparison > 0 || index < 0) { // We're going backwards in time, or are requesting a project that is not an owner // for this entry. var parseInfo = ParseWithExceptionHandling(fileContent, fullParseInformationRequested, parentProject, cancellationToken); FreezableHelper.Freeze(parseInfo.UnresolvedFile); return(new ProjectEntry(parentProject, parseInfo.UnresolvedFile, parseInfo)); } else { if (versionComparison == 0 && index >= 0) { // Ensure we have parse info for the specified project (entry.UnresolvedFile is null for newly registered projects) // If full parse info is requested, ensure we have full parse info. if (entries[index].UnresolvedFile != null && !(fullParseInformationRequested && entries[index].CachedParseInformation == null)) { // We already have the requested version parsed, just return it: return(entries[index]); } } } ParseInformationEventArgs[] results = new ParseInformationEventArgs[entries.Count]; for (int i = 0; i < entries.Count; i++) { var parseInfo = ParseWithExceptionHandling(fileContent, fullParseInformationRequested, entries[i].Project, cancellationToken); if (parseInfo == null) { throw new NullReferenceException(parser.GetType().Name + ".Parse() returned null"); } if (fullParseInformationRequested && !parseInfo.IsFullParseInformation) { throw new InvalidOperationException(parser.GetType().Name + ".Parse() did not return full parse info as requested."); } OnDiskTextSourceVersion onDiskVersion = fileContent.Version as OnDiskTextSourceVersion; if (onDiskVersion != null) { parseInfo.UnresolvedFile.LastWriteTime = onDiskVersion.LastWriteTime; } FreezableHelper.Freeze(parseInfo.UnresolvedFile); results[i] = new ParseInformationEventArgs(entries[i].Project, entries[i].UnresolvedFile, parseInfo); } // Only if all parse runs succeeded, register the parse information. rwLock.EnterWriteLock(); try { currentVersion = fileContent.Version; for (int i = 0; i < entries.Count; i++) { if (fullParseInformationRequested || (entries[i].CachedParseInformation != null && results[i].NewParseInformation.IsFullParseInformation)) { entries[i] = new ProjectEntry(entries[i].Project, results[i].NewUnresolvedFile, results[i].NewParseInformation); } else { entries[i] = new ProjectEntry(entries[i].Project, results[i].NewUnresolvedFile, null); } if (entries[i].Project != null) { entries[i].Project.OnParseInformationUpdated(results[i]); } parserService.RaiseParseInformationUpdated(results[i]); } result = entries[index]; } finally { rwLock.ExitWriteLock(); } } finally { rwLock.ExitUpgradeableReadLock(); } parserService.RegisterForCacheExpiry(this); return(result); }
void FreezeInternal() { attributes = FreezableHelper.FreezeListAndElements(attributes); FreezableHelper.Freeze(defaultValue); }
protected void ThrowIfFrozen() { FreezableHelper.ThrowIfFrozen(this); }
protected override void FreezeInternal() { FreezableHelper.Freeze(constantValue); base.FreezeInternal(); }
protected override void FreezeInternal() { base.FreezeInternal(); interfaceImplementations = FreezableHelper.FreezeList(interfaceImplementations); }