本文整理汇总了C#中SynthesizedLocalKind类的典型用法代码示例。如果您正苦于以下问题:C# SynthesizedLocalKind类的具体用法?C# SynthesizedLocalKind怎么用?C# SynthesizedLocalKind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SynthesizedLocalKind类属于命名空间,在下文中一共展示了SynthesizedLocalKind类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AssignLocalOrdinal
public int AssignLocalOrdinal(SynthesizedLocalKind localKind, int syntaxOffset)
{
#if !DEBUG
// Optimization (avoid growing the dictionary below):
// User-defined locals have to have a distinct syntax offset, thus ordinal is always 0.
if (localKind == SynthesizedLocalKind.UserDefined)
{
return 0;
}
#endif
int ordinal;
long key = MakeKey(localKind, syntaxOffset);
// Group by syntax offset and kind.
// Variables associated with the same syntax and kind will be assigned different ordinals.
if (_lazyMap == null)
{
_lazyMap = PooledDictionary<long, int>.GetInstance();
ordinal = 0;
}
else if (!_lazyMap.TryGetValue(key, out ordinal))
{
ordinal = 0;
}
_lazyMap[key] = ordinal + 1;
Debug.Assert(ordinal == 0 || localKind != SynthesizedLocalKind.UserDefined);
return ordinal;
}
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:29,代码来源:SynthesizedLocalOrdinalsDispenser.cs
示例2: TryGetPreviousHoistedLocalSlotIndex
/// <summary>
/// Returns an index of a slot that stores specified hoisted local variable in the previous generation.
/// </summary>
public abstract bool TryGetPreviousHoistedLocalSlotIndex(
SyntaxNode currentDeclarator,
Cci.ITypeReference currentType,
SynthesizedLocalKind synthesizedKind,
LocalDebugId currentId,
DiagnosticBag diagnostics,
out int slotIndex);
开发者ID:Rickinio,项目名称:roslyn,代码行数:10,代码来源:VariableSlotAllocator.cs
示例3: 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;
}
开发者ID:Rickinio,项目名称:roslyn,代码行数:10,代码来源:EncHoistedLocalMetadata.cs
示例4: GetPreviousLocal
public abstract LocalDefinition GetPreviousLocal(
Cci.ITypeReference type,
ILocalSymbolInternal symbol,
string nameOpt,
SynthesizedLocalKind kind,
LocalDebugId id,
LocalVariableAttributes pdbAttributes,
LocalSlotConstraints constraints,
bool isDynamic,
ImmutableArray<TypedConstant> dynamicTransformFlags);
开发者ID:Rickinio,项目名称:roslyn,代码行数:10,代码来源:VariableSlotAllocator.cs
示例5: WithSynthesizedLocalKind
internal SynthesizedLocal WithSynthesizedLocalKind(SynthesizedLocalKind kind)
{
return new SynthesizedLocal(
this.containingMethodOpt,
this.type,
kind,
this.syntaxOpt,
this.isPinned,
this.refKind);
}
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:10,代码来源:SynthesizedLocal.cs
示例6: WithSynthesizedLocalKindAndSyntax
internal SynthesizedLocal WithSynthesizedLocalKindAndSyntax(SynthesizedLocalKind kind, SyntaxNode syntax)
{
return new SynthesizedLocal(
_containingMethodOpt,
_type,
kind,
syntax,
_isPinned,
_refKind);
}
开发者ID:GloryChou,项目名称:roslyn,代码行数:10,代码来源:SynthesizedLocal.cs
示例7: SynthesizedLocal
internal SynthesizedLocal(
MethodSymbol containingMethodOpt,
TypeSymbol type,
SynthesizedLocalKind kind,
SyntaxNode syntaxOpt = null,
bool isPinned = false,
RefKind refKind = RefKind.None)
{
_containingMethodOpt = containingMethodOpt;
_type = type;
_kind = kind;
_syntaxOpt = syntaxOpt;
_isPinned = isPinned;
_refKind = refKind;
}
开发者ID:GloryChou,项目名称:roslyn,代码行数:15,代码来源:SynthesizedLocal.cs
示例8: SynthesizedLocal
internal SynthesizedLocal(
MethodSymbol containingMethodOpt,
TypeSymbol type,
SynthesizedLocalKind kind,
CSharpSyntaxNode syntaxOpt = null,
bool isPinned = false,
RefKind refKind = RefKind.None)
{
this.containingMethodOpt = containingMethodOpt;
this.type = type;
this.kind = kind;
this.syntaxOpt = syntaxOpt;
this.isPinned = isPinned;
this.refKind = refKind;
}
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:15,代码来源:SynthesizedLocal.cs
示例9: LocalDefinition
/// <summary>
/// Creates a new LocalDefinition.
/// </summary>
/// <param name="symbolOpt">Local symbol, used by edit and continue only, null otherwise.</param>
/// <param name="nameOpt">Name associated with the slot.</param>
/// <param name="type">Type associated with the slot.</param>
/// <param name="slot">Slot position in the signature.</param>
/// <param name="dynamicTransformFlags">Contains the synthesized dynamic attributes of the local</param>
/// <param name="synthesizedKind">Local kind.</param>
/// <param name="id">Local id.</param>
/// <param name="pdbAttributes">Value to emit in the attributes field in the PDB.</param>
/// <param name="constraints">Specifies whether slot type should have pinned modifier and whether slot should have byref constraint.</param>
/// <param name="isDynamic">Specifies if the type is Dynamic.</param>
public LocalDefinition(
ILocalSymbol symbolOpt,
string nameOpt,
Cci.ITypeReference type,
int slot,
SynthesizedLocalKind synthesizedKind,
LocalDebugId id,
uint pdbAttributes,
LocalSlotConstraints constraints,
bool isDynamic,
ImmutableArray<TypedConstant> dynamicTransformFlags)
{
_symbolOpt = symbolOpt;
_nameOpt = nameOpt;
_type = type;
_slot = slot;
_slotInfo = new LocalSlotDebugInfo(synthesizedKind, id);
_pdbAttributes = pdbAttributes;
_dynamicTransformFlags = dynamicTransformFlags;
_constraints = constraints;
_isDynamic = isDynamic;
}
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:35,代码来源:LocalDefinition.cs
示例10: LocalDefinition
/// <summary>
/// Creates a new LocalDefinition.
/// </summary>
/// <param name="symbolOpt">Local symbol, used by edit and continue only, null otherwise.</param>
/// <param name="nameOpt">Name associated with the slot.</param>
/// <param name="type">Type associated with the slot.</param>
/// <param name="slot">Slot position in the signature.</param>
/// <param name="synthesizedKind">Local kind.</param>
/// <param name="id">Local id.</param>
/// <param name="pdbAttributes">Value to emit in the attributes field in the PDB.</param>
/// <param name="constraints">Specifies whether slot type should have pinned modifier and whether slot should have byref constraint.</param>
/// <param name="dynamicTransformFlags">The synthesized dynamic attributes of the local.</param>
/// <param name="tupleElementNames">Tuple element names of the local.</param>
public LocalDefinition(
ILocalSymbol symbolOpt,
string nameOpt,
Cci.ITypeReference type,
int slot,
SynthesizedLocalKind synthesizedKind,
LocalDebugId id,
LocalVariableAttributes pdbAttributes,
LocalSlotConstraints constraints,
ImmutableArray<TypedConstant> dynamicTransformFlags,
ImmutableArray<TypedConstant> tupleElementNames)
{
_symbolOpt = symbolOpt;
_nameOpt = nameOpt;
_type = type;
_slot = slot;
_slotInfo = new LocalSlotDebugInfo(synthesizedKind, id);
_pdbAttributes = pdbAttributes;
_dynamicTransformFlags = dynamicTransformFlags.NullToEmpty();
_tupleElementNames = tupleElementNames.NullToEmpty();
_constraints = constraints;
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:35,代码来源:LocalDefinition.cs
示例11: 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;
}
开发者ID:rafaellincoln,项目名称:roslyn,代码行数:12,代码来源:GeneratedNames.cs
示例12: 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();
}
开发者ID:rafaellincoln,项目名称:roslyn,代码行数:42,代码来源:GeneratedNames.cs
示例13: TryGetPreviousHoistedLocalSlotIndex
public override bool TryGetPreviousHoistedLocalSlotIndex(SyntaxNode currentDeclarator, Cci.ITypeReference currentType, SynthesizedLocalKind synthesizedKind, LocalDebugId currentId, out int slotIndex)
{
Debug.Assert(_hoistedLocalSlotsOpt != null);
LocalDebugId previousId;
if (!TryGetPreviousLocalId(currentDeclarator, currentId, out previousId))
{
slotIndex = -1;
return false;
}
var previousType = _symbolMap.MapReference(currentType);
if (previousType == null)
{
slotIndex = -1;
return false;
}
// TODO (bug #781309): Should report a warning if the type of the local has changed
// and the previous value will be dropped.
var localKey = new EncHoistedLocalInfo(new LocalSlotDebugInfo(synthesizedKind, previousId), previousType);
return _hoistedLocalSlotsOpt.TryGetValue(localKey, out slotIndex);
}
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:24,代码来源:EncVariableSlotAllocator.cs
示例14: GetPreviousLocal
public override LocalDefinition GetPreviousLocal(
Cci.ITypeReference currentType,
ILocalSymbolInternal currentLocalSymbol,
string nameOpt,
SynthesizedLocalKind kind,
LocalDebugId id,
uint pdbAttributes,
LocalSlotConstraints constraints,
bool isDynamic,
ImmutableArray<TypedConstant> dynamicTransformFlags)
{
if (id.IsNone)
{
return null;
}
LocalDebugId previousId;
if (!TryGetPreviousLocalId(currentLocalSymbol.GetDeclaratorSyntax(), id, out previousId))
{
return null;
}
var previousType = _symbolMap.MapReference(currentType);
if (previousType == null)
{
return null;
}
// TODO (bug #781309): Should report a warning if the type of the local has changed
// and the previous value will be dropped.
var localKey = new EncLocalInfo(new LocalSlotDebugInfo(kind, previousId), previousType, constraints, signature: null);
int slot;
if (!_previousLocalSlots.TryGetValue(localKey, out slot))
{
return null;
}
return new LocalDefinition(
currentLocalSymbol,
nameOpt,
currentType,
slot,
kind,
id,
pdbAttributes,
constraints,
isDynamic,
dynamicTransformFlags);
}
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:50,代码来源:EncVariableSlotAllocator.cs
示例15: StateMachineFieldSymbol
public StateMachineFieldSymbol(NamedTypeSymbol stateMachineType, TypeSymbol type, string name, SynthesizedLocalKind synthesizedKind, int slotIndex, bool isPublic)
: this(stateMachineType, type, name, new LocalSlotDebugInfo(synthesizedKind, LocalDebugId.None), slotIndex, isPublic: isPublic)
{
}
开发者ID:Rickinio,项目名称:roslyn,代码行数:4,代码来源:StateMachineFieldSymbol.cs
示例16: 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);
}
开发者ID:afrog33k,项目名称:csnative,代码行数:20,代码来源:GeneratedNames.cs
示例17: WithSynthesizedLocalKindAndSyntax
internal override LocalSymbol WithSynthesizedLocalKindAndSyntax(SynthesizedLocalKind kind, SyntaxNode syntax)
{
throw ExceptionUtilities.Unreachable;
}
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:4,代码来源:SourceLocalSymbol.cs
示例18: 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;
}
开发者ID:afrog33k,项目名称:csnative,代码行数:25,代码来源:SyntheticBoundNodeFactory.cs
示例19: TryGetPreviousHoistedLocalSlotIndex
public override bool TryGetPreviousHoistedLocalSlotIndex(
SyntaxNode currentDeclarator,
Cci.ITypeReference currentType,
SynthesizedLocalKind synthesizedKind,
LocalDebugId currentId,
DiagnosticBag diagnostics,
out int slotIndex)
{
// Well-formed state machine attribute wasn't found in the baseline (the type is missing or bad).
// Should rarely happen since the IDE reports a rude edit if the attribute type doesn't exist.
if (_hoistedLocalSlotsOpt == null)
{
// TODO: better error message https://github.com/dotnet/roslyn/issues/9196
diagnostics.Add(_messageProvider.CreateDiagnostic(_messageProvider.ERR_ModuleEmitFailure, NoLocation.Singleton, _previousTopLevelMethod.ContainingModule.Name));
slotIndex = -1;
return false;
}
LocalDebugId previousId;
if (!TryGetPreviousLocalId(currentDeclarator, currentId, out previousId))
{
slotIndex = -1;
return false;
}
var previousType = _symbolMap.MapReference(currentType);
if (previousType == null)
{
slotIndex = -1;
return false;
}
// TODO (bug #781309): Should report a warning if the type of the local has changed
// and the previous value will be dropped.
var localKey = new EncHoistedLocalInfo(new LocalSlotDebugInfo(synthesizedKind, previousId), previousType);
return _hoistedLocalSlotsOpt.TryGetValue(localKey, out slotIndex);
}
开发者ID:Eyas,项目名称:roslyn,代码行数:38,代码来源:EncVariableSlotAllocator.cs
示例20: SynthesizedLocal
public LocalSymbol SynthesizedLocal(TypeSymbol type, CSharpSyntaxNode syntax = null, bool isPinned = false, RefKind refKind = RefKind.None, SynthesizedLocalKind kind = SynthesizedLocalKind.LoweringTemp)
{
return new SynthesizedLocal(CurrentMethod, type, kind, syntax, isPinned, refKind);
}
开发者ID:afrog33k,项目名称:csnative,代码行数:4,代码来源:SyntheticBoundNodeFactory.cs
注:本文中的SynthesizedLocalKind类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论