本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol类的典型用法代码示例。如果您正苦于以下问题:C# FieldSymbol类的具体用法?C# FieldSymbol怎么用?C# FieldSymbol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FieldSymbol类属于Microsoft.CodeAnalysis.CSharp.Symbols命名空间,在下文中一共展示了FieldSymbol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReportUnassigned
protected override void ReportUnassigned(FieldSymbol fieldSymbol, int unassignedSlot, SyntaxNode node)
{
if (node.Parent.Kind() == SyntaxKind.AddressOfExpression)
{
_result.Add((PrefixUnaryExpressionSyntax)node.Parent);
}
}
示例2: MethodToStateMachineRewriter
public MethodToStateMachineRewriter(
SyntheticBoundNodeFactory F,
MethodSymbol originalMethod,
FieldSymbol state,
IReadOnlySet<Symbol> variablesCaptured,
IReadOnlyDictionary<Symbol, CapturedSymbolReplacement> nonReusableLocalProxies,
DiagnosticBag diagnostics,
bool useFinalizerBookkeeping)
: base(F.CompilationState, diagnostics)
{
Debug.Assert(F != null);
Debug.Assert(originalMethod != null);
Debug.Assert(state != null);
Debug.Assert(nonReusableLocalProxies != null);
Debug.Assert(diagnostics != null);
Debug.Assert(variablesCaptured != null);
this.F = F;
this.stateField = state;
this.cachedState = F.SynthesizedLocal(F.SpecialType(SpecialType.System_Int32), kind: SynthesizedLocalKind.StateMachineCachedState);
this.useFinalizerBookkeeping = useFinalizerBookkeeping;
this.hasFinalizerState = useFinalizerBookkeeping;
this.originalMethod = originalMethod;
this.variablesCaptured = variablesCaptured;
foreach (var proxy in nonReusableLocalProxies)
{
this.proxies.Add(proxy.Key, proxy.Value);
}
}
示例3: AsyncMethodToStateMachineRewriter
internal AsyncMethodToStateMachineRewriter(
MethodSymbol method,
int methodOrdinal,
AsyncMethodBuilderMemberCollection asyncMethodBuilderMemberCollection,
SyntheticBoundNodeFactory F,
FieldSymbol state,
FieldSymbol builder,
IReadOnlySet<Symbol> hoistedVariables,
IReadOnlyDictionary<Symbol, CapturedSymbolReplacement> nonReusableLocalProxies,
SynthesizedLocalOrdinalsDispenser synthesizedLocalOrdinals,
VariableSlotAllocator slotAllocatorOpt,
int nextFreeHoistedLocalSlot,
DiagnosticBag diagnostics)
: base(F, method, state, hoistedVariables, nonReusableLocalProxies, synthesizedLocalOrdinals, slotAllocatorOpt, nextFreeHoistedLocalSlot, diagnostics, useFinalizerBookkeeping: false)
{
_method = method;
_asyncMethodBuilderMemberCollection = asyncMethodBuilderMemberCollection;
_asyncMethodBuilderField = builder;
_exprReturnLabel = F.GenerateLabel("exprReturn");
_exitLabel = F.GenerateLabel("exitLabel");
_exprRetValue = method.IsGenericTaskReturningAsync(F.Compilation)
? F.SynthesizedLocal(asyncMethodBuilderMemberCollection.ResultType, syntax: F.Syntax, kind: SynthesizedLocalKind.AsyncMethodReturnValue)
: null;
_dynamicFactory = new LoweredDynamicOperationFactory(F, methodOrdinal);
_awaiterFields = new Dictionary<TypeSymbol, FieldSymbol>(TypeSymbol.EqualsIgnoringDynamicComparer);
_nextAwaiterId = slotAllocatorOpt?.PreviousAwaiterSlotCount ?? 0;
}
示例4: MakeFieldAccess
private BoundExpression MakeFieldAccess(
CSharpSyntaxNode syntax,
BoundExpression rewrittenReceiver,
FieldSymbol fieldSymbol,
ConstantValue constantValueOpt,
LookupResultKind resultKind,
TypeSymbol type,
BoundFieldAccess oldNodeOpt = null)
{
if (fieldSymbol.IsTupleField)
{
return MakeTupleFieldAccess(syntax, fieldSymbol, rewrittenReceiver, constantValueOpt, resultKind);
}
BoundExpression result = oldNodeOpt != null ?
oldNodeOpt.Update(rewrittenReceiver, fieldSymbol, constantValueOpt, resultKind, type) :
new BoundFieldAccess(syntax, rewrittenReceiver, fieldSymbol, constantValueOpt, resultKind, type);
if (fieldSymbol.IsFixed)
{
// a reference to a fixed buffer is translated into its address
result = new BoundConversion(syntax,
new BoundAddressOfOperator(syntax, result, syntax != null && SyntaxFacts.IsFixedStatementExpression(syntax), type, false),
new Conversion(ConversionKind.PointerToPointer), false, false, default(ConstantValue), type, false);
}
return result;
}
示例5: AsyncMethodToClassRewriter
internal AsyncMethodToClassRewriter(
MethodSymbol method,
AsyncMethodBuilderMemberCollection asyncMethodBuilderMemberCollection,
SyntheticBoundNodeFactory F,
FieldSymbol state,
FieldSymbol builder,
HashSet<Symbol> variablesCaptured,
Dictionary<Symbol, CapturedSymbolReplacement> initialProxies,
DiagnosticBag diagnostics,
bool generateDebugInfo)
: base(F, method, state, variablesCaptured, initialProxies, diagnostics,
useFinalizerBookkeeping: false,
generateDebugInfo: generateDebugInfo)
{
this.method = method;
this.asyncMethodBuilderMemberCollection = asyncMethodBuilderMemberCollection;
this.asyncMethodBuilderField = builder;
this.exprReturnLabel = F.GenerateLabel("exprReturn");
this.exitLabel = F.GenerateLabel("exitLabel");
this.exprRetValue = method.IsGenericTaskReturningAsync(F.Compilation)
? F.SynthesizedLocal(asyncMethodBuilderMemberCollection.ResultType, GeneratedNames.AsyncExprRetValueFieldName())
: null;
this.dynamicFactory = new LoweredDynamicOperationFactory(F);
}
示例6: FieldOrPropertyInitializer
public FieldOrPropertyInitializer(FieldSymbol fieldOpt, SyntaxNode syntax, int precedingInitializersLength)
{
Debug.Assert(syntax.IsKind(SyntaxKind.EqualsValueClause) && fieldOpt != null || syntax is StatementSyntax);
FieldOpt = fieldOpt;
Syntax = syntax.GetReference();
PrecedingInitializersLength = precedingInitializersLength;
}
示例7: RetargetingFieldSymbol
private DiagnosticInfo _lazyUseSiteDiagnostic = CSDiagnosticInfo.EmptyErrorInfo; // Indicates unknown state.
public RetargetingFieldSymbol(RetargetingModuleSymbol retargetingModule, FieldSymbol underlyingField)
: base (underlyingField)
{
Debug.Assert((object)retargetingModule != null);
Debug.Assert(!(underlyingField is RetargetingFieldSymbol));
_retargetingModule = retargetingModule;
}
示例8: TupleFieldSymbol
public TupleFieldSymbol(TupleTypeSymbol container, FieldSymbol underlyingField, int tupleElementIndex)
: base(underlyingField)
{
Debug.Assert(container.UnderlyingNamedType.Equals(underlyingField.ContainingType, TypeCompareKind.IgnoreDynamicAndTupleNames) || this is TupleVirtualElementFieldSymbol,
"virtual fields should be represented by " + nameof(TupleVirtualElementFieldSymbol));
_containingTuple = container;
_tupleElementIndex = tupleElementIndex;
}
示例9: RetargetingFieldSymbol
private DiagnosticInfo lazyUseSiteDiagnostic = CSDiagnosticInfo.EmptyErrorInfo; // Indicates unknown state.
public RetargetingFieldSymbol(RetargetingModuleSymbol retargetingModule, FieldSymbol underlyingField)
{
Debug.Assert((object)retargetingModule != null);
Debug.Assert((object)underlyingField != null);
Debug.Assert(!(underlyingField is RetargetingFieldSymbol));
this.retargetingModule = retargetingModule;
this.underlyingField = underlyingField;
}
示例10: BoundFieldAccess
public BoundFieldAccess(
CSharpSyntaxNode syntax,
BoundExpression receiver,
FieldSymbol fieldSymbol,
ConstantValue constantValueOpt,
bool hasErrors = false)
: this(syntax, receiver, fieldSymbol, constantValueOpt, LookupResultKind.Viable, fieldSymbol.Type, hasErrors)
{
}
示例11: LoadField
private static XElement LoadField(FieldSymbol f)
{
XElement elem = new XElement("field");
elem.Add(new XAttribute("name", f.Name));
elem.Add(new XAttribute("type", f.Type.ToTestDisplayString()));
return elem;
}
示例12: Update
public BoundFieldAccess Update(
BoundExpression receiver,
FieldSymbol fieldSymbol,
ConstantValue constantValueOpt,
LookupResultKind resultKind,
TypeSymbol typeSymbol)
{
return this.Update(receiver, fieldSymbol, constantValueOpt, resultKind, this.IsByValue, typeSymbol);
}
示例13: IteratorMethodToStateMachineRewriter
private int nextFinalizeState = StateMachineStates.FinishedStateMachine - 1; // -3
internal IteratorMethodToStateMachineRewriter(
SyntheticBoundNodeFactory F,
MethodSymbol originalMethod,
FieldSymbol state,
FieldSymbol current,
IReadOnlySet<Symbol> variablesCaptured,
IReadOnlyDictionary<Symbol, CapturedSymbolReplacement> initialProxies,
DiagnosticBag diagnostics)
: base(F, originalMethod, state, variablesCaptured, initialProxies, diagnostics, useFinalizerBookkeeping: false)
{
this.current = current;
}
示例14: IteratorMethodToClassRewriter
private int nextFinalizeState = StateMachineStates.FinishedStateMachine - 1; // -3
internal IteratorMethodToClassRewriter(
SyntheticBoundNodeFactory F,
MethodSymbol originalMethod,
FieldSymbol state,
FieldSymbol current,
HashSet<Symbol> variablesCaptured,
Dictionary<Symbol, CapturedSymbolReplacement> initialProxies,
DiagnosticBag diagnostics,
bool generateDebugInfo)
: base(F, originalMethod, state, variablesCaptured, initialProxies, diagnostics,
useFinalizerBookkeeping: false,
generateDebugInfo: generateDebugInfo)
{
this.current = current;
}
示例15: IteratorMethodToStateMachineRewriter
private int _nextFinalizeState = StateMachineStates.FinishedStateMachine - 1; // -3
internal IteratorMethodToStateMachineRewriter(
SyntheticBoundNodeFactory F,
MethodSymbol originalMethod,
FieldSymbol state,
FieldSymbol current,
IReadOnlySet<Symbol> hoistedVariables,
IReadOnlyDictionary<Symbol, CapturedSymbolReplacement> nonReusableLocalProxies,
SynthesizedLocalOrdinalsDispenser synthesizedLocalOrdinals,
VariableSlotAllocator slotAllocatorOpt,
int nextFreeHoistedLocalSlot,
DiagnosticBag diagnostics)
: base(F, originalMethod, state, hoistedVariables, nonReusableLocalProxies, synthesizedLocalOrdinals, slotAllocatorOpt, nextFreeHoistedLocalSlot, diagnostics, useFinalizerBookkeeping: false)
{
_current = current;
}