This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
using JetBrains.Annotations; | |
namespace JetBrains.Util.Concurrency.Threading; | |
/// <summary> | |
/// Reader-writer lock for reader-heavy scenarios. | |
/// </summary> | |
public sealed class StripedReaderWriterLock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#nullable enable | |
using System; | |
using JetBrains.Application.Progress; | |
using JetBrains.DocumentManagers.Transactions; | |
using JetBrains.ProjectModel; | |
using JetBrains.ReSharper.Feature.Services.Bulbs; | |
using JetBrains.ReSharper.Feature.Services.Daemon; | |
using JetBrains.ReSharper.Feature.Services.Intentions.Scoped.Scopes; | |
using JetBrains.TextControl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Text; | |
PrintNumber(0f); | |
PrintNumber(-0f); | |
PrintNumber(1f); | |
PrintNumber(-1f); | |
PrintNumber(float.PositiveInfinity); | |
PrintNumber(float.NegativeInfinity); | |
PrintNumber(float.NaN); | |
PrintNumber(float.Epsilon); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Concurrent; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
// the task is to Analyze() files in parallel and Process() them on the main thread in batches | |
var files = Enumerable.Range(0, 1000).Select(x => $"File{x:0000}.cs").ToList(); | |
var degreeOfParallelism = Math.Min(Environment.ProcessorCount, 8); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Concurrent; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
// the task is to Analyze() files in parallel and Process() them on the main thread in batches | |
var files = Enumerable.Range(0, 1000).Select(x => $"File{x:0000}.cs").ToList(); | |
var degreeOfParallelism = Math.Min(Environment.ProcessorCount, 8); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.CompilerServices; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Jobs; | |
using BenchmarkDotNet.Running; | |
// ReSharper disable RedundantToStringCall | |
// ReSharper disable NotAccessedField.Local | |
#pragma warning disable 169 | |
BenchmarkRunner.Run<NullChecksBenchmark>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case IProperty {IsAuto: false, IsStatic: false} autoProperty | |
when !autoProperty.CanBeOverridden() | |
&& (autoProperty.Setter == null || autoProperty.Setter.IsInitOnly): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static bool IsPossibleCodeBehind(IFile file) | |
{ | |
return file is IFileImpl {SecondaryRangeTranslator: { } translator} && !(translator is IInjectedRangeTranslator); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (pattern is IPatternWithDesignation withDesignation) | |
{ | |
var existingDesignation = withDesignation.Designation; | |
if (existingDesignation != null && !(existingDesignation is IDiscardDesignation)) return false; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (declaredElement is ITypeElement && !(declaredElement is IDelegate)) | |
return false; | |
if (declaredElement is IFunction && !(declaredElement is IMethod) || declaredElement is ILabel || declaredElement is INamespace) | |
return false; |
NewerOlder