本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol类的典型用法代码示例。如果您正苦于以下问题:C# FieldSymbol类的具体用法?C# FieldSymbol怎么用?C# FieldSymbol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FieldSymbol类属于Microsoft.CodeAnalysis.CSharp.Symbols命名空间,在下文中一共展示了FieldSymbol类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ReportUnassigned
protected override void ReportUnassigned(FieldSymbol fieldSymbol, int unassignedSlot, SyntaxNode node)
{
if (node.Parent.Kind() == SyntaxKind.AddressOfExpression)
{
_result.Add((PrefixUnaryExpressionSyntax)node.Parent);
}
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:7,代码来源:UnassignedAddressTakenVariablesWalker.cs
示例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);
}
}
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:30,代码来源:MethodToStateMachineRewriter.cs
示例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;
}
开发者ID:rafaellincoln,项目名称:roslyn,代码行数:29,代码来源:AsyncMethodToStateMachineRewriter.cs
示例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;
}
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:29,代码来源:LocalRewriter_Field.cs
示例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);
}
开发者ID:riversky,项目名称:roslyn,代码行数:26,代码来源:AsyncMethodToClassRewriter.cs
示例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;
}
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:8,代码来源:FieldOrPropertyInitializer.cs
示例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;
}
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:10,代码来源:RetargetingFieldSymbol.cs
示例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;
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:9,代码来源:TupleFieldSymbol.cs
示例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;
}
开发者ID:riversky,项目名称:roslyn,代码行数:11,代码来源:RetargetingFieldSymbol.cs
示例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)
{
}
开发者ID:RoryVL,项目名称:roslyn,代码行数:9,代码来源:Constructors.cs
示例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;
}
开发者ID:EkardNT,项目名称:Roslyn,代码行数:9,代码来源:EmitMetadataTestBase.cs
示例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);
}
开发者ID:RoryVL,项目名称:roslyn,代码行数:9,代码来源:Constructors.cs
示例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;
}
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:14,代码来源:IteratorMethodToStateMachineRewriter.cs
示例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;
}
开发者ID:nagyist,项目名称:roslyn,代码行数:17,代码来源:IteratorMethodToClassRewriter.cs
示例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;
}
开发者ID:daking2014,项目名称:roslyn,代码行数:17,代码来源:IteratorMethodToStateMachineRewriter.cs
示例16: GetHostObjectField
internal FieldSymbol GetHostObjectField()
{
if ((object)_hostObjectField != null)
{
return _hostObjectField;
}
var hostObjectTypeSymbol = _compilation.GetHostObjectTypeSymbol();
if ((object)hostObjectTypeSymbol != null && hostObjectTypeSymbol.Kind != SymbolKind.ErrorType)
{
return _hostObjectField = new SynthesizedFieldSymbol(
_declaringSubmissionClass, hostObjectTypeSymbol, "<host-object>", isPublic: false, isReadOnly: true, isStatic: false);
}
return null;
}
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:16,代码来源:SynthesizedSubmissionFields.cs
示例17: BindFieldOrEnumInitializer
private static BoundExpression BindFieldOrEnumInitializer(
Binder binder,
FieldSymbol fieldSymbol,
EqualsValueClauseSyntax initializer,
DiagnosticBag diagnostics)
{
var enumConstant = fieldSymbol as SourceEnumConstantSymbol;
var collisionDetector = new LocalScopeBinder(binder);
if ((object)enumConstant != null)
{
return collisionDetector.BindEnumConstantInitializer(enumConstant, initializer.Value, diagnostics);
}
else
{
return collisionDetector.BindVariableOrAutoPropInitializer(initializer, fieldSymbol.Type, diagnostics);
}
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:17,代码来源:ConstantValueUtils.cs
示例18: Create
internal static GlobalExpressionVariable Create(
SourceMemberContainerTypeSymbol containingType,
DeclarationModifiers modifiers,
TypeSyntax typeSyntax,
string name,
SyntaxNode syntax,
Location location,
FieldSymbol containingFieldOpt,
SyntaxNode nodeToBind)
{
Debug.Assert(nodeToBind.Kind() == SyntaxKind.VariableDeclarator || nodeToBind is ExpressionSyntax);
var syntaxReference = syntax.GetReference();
return typeSyntax.IsVar
? new InferrableGlobalExpressionVariable(containingType, modifiers, typeSyntax, name, syntaxReference, location, containingFieldOpt, nodeToBind)
: new GlobalExpressionVariable(containingType, modifiers, typeSyntax, name, syntaxReference, location);
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:17,代码来源:GlobalExpressionVariable.cs
示例19: LambdaFrame
internal LambdaFrame(MethodSymbol topLevelMethod, CSharpSyntaxNode scopeSyntaxOpt, DebugId methodId, DebugId closureId)
: base(MakeName(scopeSyntaxOpt, methodId, closureId), topLevelMethod)
{
_topLevelMethod = topLevelMethod;
_constructor = new LambdaFrameConstructor(this);
this.ClosureOrdinal = closureId.Ordinal;
// static lambdas technically have the class scope so the scope syntax is null
if (scopeSyntaxOpt == null)
{
_staticConstructor = new SynthesizedStaticConstructor(this);
var cacheVariableName = GeneratedNames.MakeCachedFrameInstanceFieldName();
_singletonCache = new SynthesizedLambdaCacheFieldSymbol(this, this, cacheVariableName, topLevelMethod, isReadOnly: true, isStatic: true);
}
AssertIsClosureScopeSyntax(scopeSyntaxOpt);
this.ScopeSyntaxOpt = scopeSyntaxOpt;
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:18,代码来源:LambdaFrame.cs
示例20: MakeTupleFieldAccess
/// <summary>
/// Converts access to a tuple instance into access into the underlying ValueTuple(s).
///
/// For instance, tuple.Item8
/// produces fieldAccess(field=Item1, receiver=fieldAccess(field=Rest, receiver=ValueTuple for tuple))
/// </summary>
private BoundExpression MakeTupleFieldAccess(
CSharpSyntaxNode syntax,
FieldSymbol tupleField,
BoundExpression rewrittenReceiver,
ConstantValue constantValueOpt,
LookupResultKind resultKind,
TypeSymbol type)
{
var tupleType = tupleField.ContainingType;
NamedTypeSymbol currentLinkType = tupleType.TupleUnderlyingType;
FieldSymbol underlyingField = tupleField.TupleUnderlyingField;
if ((object)underlyingField == null)
{
// Use-site error must have been reported elsewhere.
return new BoundFieldAccess(syntax, rewrittenReceiver, tupleField, constantValueOpt, resultKind, type, hasErrors: true);
}
if (underlyingField.ContainingType != currentLinkType)
{
WellKnownMember wellKnownTupleRest = TupleTypeSymbol.GetTupleTypeMember(TupleTypeSymbol.RestPosition, TupleTypeSymbol.RestPosition);
var tupleRestField = (FieldSymbol)TupleTypeSymbol.GetWellKnownMemberInType(currentLinkType.OriginalDefinition, wellKnownTupleRest, _diagnostics, syntax);
if ((object)tupleRestField == null)
{
// error tolerance for cases when Rest is missing
return new BoundFieldAccess(syntax, rewrittenReceiver, tupleField, constantValueOpt, resultKind, type, hasErrors: true);
}
// make nested field accesses to Rest
do
{
FieldSymbol nestedFieldSymbol = tupleRestField.AsMember(currentLinkType);
currentLinkType = currentLinkType.TypeArgumentsNoUseSiteDiagnostics[TupleTypeSymbol.RestPosition - 1].TupleUnderlyingType;
rewrittenReceiver = new BoundFieldAccess(syntax, rewrittenReceiver, nestedFieldSymbol, ConstantValue.NotAvailable, LookupResultKind.Viable, currentLinkType);
}
while (underlyingField.ContainingType != currentLinkType);
}
// make a field access for the most local access
return new BoundFieldAccess(syntax, rewrittenReceiver, underlyingField, constantValueOpt, resultKind, type);
}
开发者ID:RoryVL,项目名称:roslyn,代码行数:50,代码来源:LocalRewriter_Field.cs
注:本文中的Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论