本文整理汇总了C#中SynthesizedLocalKind.IsLongLived方法的典型用法代码示例。如果您正苦于以下问题:C# SynthesizedLocalKind.IsLongLived方法的具体用法?C# SynthesizedLocalKind.IsLongLived怎么用?C# SynthesizedLocalKind.IsLongLived使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SynthesizedLocalKind
的用法示例。
在下文中一共展示了SynthesizedLocalKind.IsLongLived方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EncHoistedLocalMetadata
public EncHoistedLocalMetadata(string name, Cci.ITypeReference type, SynthesizedLocalKind synthesizedKind)
{
Debug.Assert(name != null);
Debug.Assert(type != null);
Debug.Assert(synthesizedKind.IsLongLived());
this.Name = name;
this.Type = type;
this.SynthesizedKind = synthesizedKind;
}
示例2: SynthesizedLocal
internal SynthesizedLocal(
MethodSymbol containingMethodOpt,
TypeSymbol type,
SynthesizedLocalKind kind,
SyntaxNode syntaxOpt = null,
bool isPinned = false,
RefKind refKind = RefKind.None,
[CallerLineNumber]int createdAtLineNumber = 0,
[CallerFilePath]string createdAtFilePath = null)
{
Debug.Assert(type.SpecialType != SpecialType.System_Void);
Debug.Assert(!kind.IsLongLived() || syntaxOpt != null);
_containingMethodOpt = containingMethodOpt;
_type = type;
_kind = kind;
_syntaxOpt = syntaxOpt;
_isPinned = isPinned;
_refKind = refKind;
_createdAtLineNumber = createdAtLineNumber;
_createdAtFilePath = createdAtFilePath;
}
示例3: MakeLocalName
// Matches names generated by Dev11.
internal static string MakeLocalName(SynthesizedLocalKind kind, int uniqueId)
{
Debug.Assert(kind.IsLongLived());
if (kind == SynthesizedLocalKind.CachedAnonymousMethodDelegate)
{
// TODO: consider removing this special case, EE doesn't depend on the name.
return SynthesizedLocalNamePrefix + "<>9__CachedAnonymousMethodDelegate" + uniqueId;
}
if (kind == SynthesizedLocalKind.LambdaDisplayClass)
{
// Lambda display class local follows a different naming pattern.
// EE depends on the name format.
return MakeLambdaDisplayClassStorageName(uniqueId);
}
return string.Format(SynthesizedLocalNamePrefix + "{0}${1:0000}", (int)kind, uniqueId);
}
示例4: StoreToTemp
/// <summary>
/// Takes an expression and returns the bound local expression "temp"
/// and the bound assignment expression "temp = expr".
/// </summary>
public BoundLocal StoreToTemp(BoundExpression argument, out BoundAssignmentOperator store, RefKind refKind = RefKind.None, SynthesizedLocalKind kind = SynthesizedLocalKind.LoweringTemp)
{
MethodSymbol containingMethod = this.CurrentMethod;
var syntax = argument.Syntax;
var type = argument.Type;
var local = new BoundLocal(
syntax,
new SynthesizedLocal(containingMethod, type, kind, syntax: kind.IsLongLived() ? syntax : null, refKind: refKind),
null,
type);
store = new BoundAssignmentOperator(
syntax,
local,
argument,
refKind,
type);
return local;
}
示例5: MakeSynthesizedLocalName
internal static string MakeSynthesizedLocalName(SynthesizedLocalKind kind, ref int uniqueId)
{
Debug.Assert(kind.IsLongLived());
// Lambda display class local has to be named. EE depends on the name format.
if (kind == SynthesizedLocalKind.LambdaDisplayClass)
{
return MakeLambdaDisplayLocalName(uniqueId++);
}
return null;
}
示例6: MakeHoistedLocalFieldName
internal static string MakeHoistedLocalFieldName(SynthesizedLocalKind kind, int slotIndex, string localNameOpt = null)
{
Debug.Assert((localNameOpt != null) == (kind == SynthesizedLocalKind.UserDefined));
Debug.Assert(slotIndex >= 0);
Debug.Assert(kind.IsLongLived());
// Lambda display class local follows a different naming pattern.
// EE depends on the name format.
// There's logic in the EE to recognize locals that have been captured by a lambda
// and would have been hoisted for the state machine. Basically, we just hoist the local containing
// the instance of the lambda display class and retain its original name (rather than using an
// iterator local name). See FUNCBRECEE::ImportIteratorMethodInheritedLocals.
var result = PooledStringBuilder.GetInstance();
var builder = result.Builder;
builder.Append('<');
if (localNameOpt != null)
{
Debug.Assert(localNameOpt.IndexOf('.') == -1);
builder.Append(localNameOpt);
}
builder.Append('>');
if (kind == SynthesizedLocalKind.LambdaDisplayClass)
{
builder.Append((char)GeneratedNameKind.DisplayClassLocalOrField);
}
else if (kind == SynthesizedLocalKind.UserDefined)
{
builder.Append((char)GeneratedNameKind.HoistedLocalField);
}
else
{
builder.Append((char)GeneratedNameKind.HoistedSynthesizedLocalField);
}
builder.Append("__");
builder.Append(slotIndex + 1);
return result.ToStringAndFree();
}