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
public override bool Accepts(IDeclaredElement declaredElement, ISubstitution substitution) | |
{ | |
switch (declaredElement) | |
{ | |
case ISymbolAlias symbolAlias: | |
{ | |
var aliasedSymbol = symbolAlias.GetAliasedSymbol(); | |
if (aliasedSymbol == null) return true; | |
return Accepts(aliasedSymbol.Element, aliasedSymbol.Substitution); |
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
[NotNull, Pure] | |
public static IPattern UnwrapFromSandbox([NotNull] this IPattern pattern) | |
{ | |
if (pattern.Parent is ISandBox sandBox | |
&& sandBox.ContextType == SandBoxContextType.Replace | |
&& sandBox.ContextNode is IPattern replacedPattern) | |
{ | |
return replacedPattern; | |
} |
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
var elementType = GetElementType(declaredElement); | |
if (elementType is IDeclaredType declaredType) | |
{ | |
var delegateInvokeMethod = declaredType.GetTypeElement<IDelegate>()?.InvokeMethod; | |
if (delegateInvokeMethod != null) | |
{ | |
var returnType = declaredType.GetSubstitution()[delegateInvokeMethod.ReturnType]; | |
if (returnType.IsValid()) | |
{ |
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
switch (myJumpStatement) | |
{ | |
case IReturnStatement returnStatement when returnStatement.Value != null: | |
ReplaceWithValue(returnStatement, returnStatement.Value); | |
break; | |
case IYieldStatement yieldStatement when yieldStatement.Expression != null: | |
ReplaceWithValue(yieldStatement, yieldStatement.Value); | |
break; |
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
BenchmarkDotNet=v0.12.0, OS=Windows 10.0.17763.805 (1809/October2018Update/Redstone5), VM=VMware | |
Intel Core i7-7700K CPU 4.20GHz (Kaby Lake), 1 CPU, 4 logical and 4 physical cores | |
.NET Core SDK=2.1.507 | |
[Host] : .NET Core 2.1.11 (CoreCLR 4.6.27617.04, CoreFX 4.6.27617.02), X64 RyuJIT | |
DefaultJob : .NET Core 2.1.11 (CoreCLR 4.6.27617.04, CoreFX 4.6.27617.02), X64 RyuJIT | |
| Method | Count | Mean | Error | StdDev | Rank | | |
|--------------- |------ |------------:|----------:|----------:|-----:| | |
| IntArray | 1000 | 407.0 ns | 5.17 ns | 4.84 ns | 1 | |
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
BenchmarkDotNet=v0.12.0, OS=Windows 10.0.17763.805 (1809/October2018Update/Redstone5), VM=VMware | |
Intel Core i7-7700K CPU 4.20GHz (Kaby Lake), 1 CPU, 4 logical and 4 physical cores | |
[Host] : .NET Framework 4.8 (4.8.4018.0), X86 LegacyJIT | |
DefaultJob : .NET Framework 4.8 (4.8.4018.0), X86 LegacyJIT | |
| Method | Count | Mean | Error | StdDev | Rank | | |
|--------------- |------ |------------:|----------:|----------:|-----:| | |
| IntArray | 1000 | 260.9 ns | 3.25 ns | 3.04 ns | 1 | | |
| StringArray | 1000 | 3,372.6 ns | 25.71 ns | 22.79 ns | 4 | |
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
switch (targetIdentifier.Name) | |
{ | |
case "assembly": | |
return AttributeTargets.Assembly; | |
case "module": | |
return AttributeTargets.Module; | |
case "return": | |
return AttributeTargets.ReturnValue; | |
case "field": | |
return AttributeTargets.Field; |
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
foreach (var sourceFile in transaction.GetProperties(typeof(SymbolCache)).OfType<Pair<IPsiSourceFile, bool>>()) | |
{ | |
SynchUpdateCacheForFile(sourceFile: sourceFile.First, isRollback: true, underTransaction: false, fireEvent: sourceFile.Second); | |
} |
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
// 1 | |
foreach (var x in xs) | |
using (var r = x.GetResource()) | |
DoWork(x, r); | |
// 2 | |
foreach (var x in xs) | |
using (var r = x.GetResource()) { | |
DoWork(x, r); |
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 void ModifyItemsCount(int newCount) | |
{ | |
if (myTail == null || myTail is FrugalLocalMarkerList<T>) | |
{ | |
if (newCount == 0) | |
myTail = null; | |
else if (newCount == 1) | |
myTail = FrugalLocalMarkerList<T>.One; | |
else if (newCount == 2) | |
myTail = FrugalLocalMarkerList<T>.Two; |