本文整理汇总了C#中LocalSymbol.AsImmutable方法的典型用法代码示例。如果您正苦于以下问题:C# LocalSymbol.AsImmutable方法的具体用法?C# LocalSymbol.AsImmutable怎么用?C# LocalSymbol.AsImmutable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalSymbol
的用法示例。
在下文中一共展示了LocalSymbol.AsImmutable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConstructFieldLikeEventAccessorBody_Regular
//.........这里部分代码省略.........
receiver: fieldReceiver,
fieldSymbol: eventSymbol.AssociatedField,
constantValueOpt: null)
{ WasCompilerGenerated = true };
BoundParameter boundParameter = new BoundParameter(syntax,
parameterSymbol: accessor.Parameters[0])
{ WasCompilerGenerated = true };
// tmp0 = _event;
BoundStatement tmp0Init = new BoundExpressionStatement(syntax,
expression: new BoundAssignmentOperator(syntax,
left: boundTmps[0],
right: boundBackingField,
type: delegateType)
{ WasCompilerGenerated = true })
{ WasCompilerGenerated = true };
// LOOP:
BoundStatement loopStart = new BoundLabelStatement(syntax,
label: loopLabel)
{ WasCompilerGenerated = true };
// tmp1 = tmp0;
BoundStatement tmp1Update = new BoundExpressionStatement(syntax,
expression: new BoundAssignmentOperator(syntax,
left: boundTmps[1],
right: boundTmps[0],
type: delegateType)
{ WasCompilerGenerated = true })
{ WasCompilerGenerated = true };
// (DelegateType)Delegate.Combine(tmp1, value)
BoundExpression delegateUpdate = BoundConversion.SynthesizedNonUserDefined(syntax,
operand: BoundCall.Synthesized(syntax,
receiverOpt: null,
method: updateMethod,
arguments: ImmutableArray.Create<BoundExpression>(boundTmps[1], boundParameter)),
kind: ConversionKind.ExplicitReference,
type: delegateType);
// tmp2 = (DelegateType)Delegate.Combine(tmp1, value);
BoundStatement tmp2Update = new BoundExpressionStatement(syntax,
expression: new BoundAssignmentOperator(syntax,
left: boundTmps[2],
right: delegateUpdate,
type: delegateType)
{ WasCompilerGenerated = true })
{ WasCompilerGenerated = true };
// Interlocked.CompareExchange<DelegateType>(ref _event, tmp2, tmp1)
BoundExpression compareExchange = BoundCall.Synthesized(syntax,
receiverOpt: null,
method: compareExchangeMethod,
arguments: ImmutableArray.Create<BoundExpression>(boundBackingField, boundTmps[2], boundTmps[1]));
// tmp0 = Interlocked.CompareExchange<DelegateType>(ref _event, tmp2, tmp1);
BoundStatement tmp0Update = new BoundExpressionStatement(syntax,
expression: new BoundAssignmentOperator(syntax,
left: boundTmps[0],
right: compareExchange,
type: delegateType)
{ WasCompilerGenerated = true })
{ WasCompilerGenerated = true };
// tmp0 == tmp1 // i.e. exit when they are equal, jump to start otherwise
BoundExpression loopExitCondition = new BoundBinaryOperator(syntax,
operatorKind: BinaryOperatorKind.ObjectEqual,
left: boundTmps[0],
right: boundTmps[1],
constantValueOpt: null,
methodOpt: null,
resultKind: LookupResultKind.Viable,
type: boolType)
{ WasCompilerGenerated = true };
// branchfalse (tmp0 == tmp1) LOOP
BoundStatement loopEnd = new BoundConditionalGoto(syntax,
condition: loopExitCondition,
jumpIfTrue: false,
label: loopLabel)
{ WasCompilerGenerated = true };
BoundStatement @return = new BoundReturnStatement(syntax,
expressionOpt: null)
{ WasCompilerGenerated = true };
return new BoundBlock(syntax,
locals: tmps.AsImmutable(),
statements: ImmutableArray.Create<BoundStatement>(
tmp0Init,
loopStart,
tmp1Update,
tmp2Update,
tmp0Update,
loopEnd,
@return))
{ WasCompilerGenerated = true };
}