本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Symbols.PropertySymbol.GetOwnOrInheritedGetMethod方法的典型用法代码示例。如果您正苦于以下问题:C# PropertySymbol.GetOwnOrInheritedGetMethod方法的具体用法?C# PropertySymbol.GetOwnOrInheritedGetMethod怎么用?C# PropertySymbol.GetOwnOrInheritedGetMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CodeAnalysis.CSharp.Symbols.PropertySymbol
的用法示例。
在下文中一共展示了PropertySymbol.GetOwnOrInheritedGetMethod方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeIndexerAccess
private BoundExpression MakeIndexerAccess(
CSharpSyntaxNode syntax,
BoundExpression rewrittenReceiver,
PropertySymbol indexer,
ImmutableArray<BoundExpression> rewrittenArguments,
ImmutableArray<string> argumentNamesOpt,
ImmutableArray<RefKind> argumentRefKindsOpt,
bool expanded,
ImmutableArray<int> argsToParamsOpt,
TypeSymbol type,
BoundIndexerAccess oldNodeOpt,
bool isLeftOfAssignment)
{
if (isLeftOfAssignment)
{
// This is an indexer set access. We return a BoundIndexerAccess node here.
// This node will be rewritten with MakePropertyAssignment when rewriting the enclosing BoundAssignmentOperator.
return oldNodeOpt != null ?
oldNodeOpt.Update(rewrittenReceiver, indexer, rewrittenArguments, argumentNamesOpt, argumentRefKindsOpt, expanded, argsToParamsOpt, type) :
new BoundIndexerAccess(syntax, rewrittenReceiver, indexer, rewrittenArguments, argumentNamesOpt, argumentRefKindsOpt, expanded, argsToParamsOpt, type);
}
else
{
var getMethod = indexer.GetOwnOrInheritedGetMethod();
Debug.Assert((object)getMethod != null);
// We have already lowered each argument, but we may need some additional rewriting for the arguments,
// such as generating a params array, re-ordering arguments based on argsToParamsOpt map, inserting arguments for optional parameters, etc.
ImmutableArray<LocalSymbol> temps;
rewrittenArguments = MakeArguments(syntax, rewrittenArguments, indexer, getMethod, expanded, argsToParamsOpt, ref argumentRefKindsOpt, out temps, enableCallerInfo: ThreeState.True);
BoundExpression call = MakePropertyGetAccess(syntax, rewrittenReceiver, indexer, rewrittenArguments, getMethod);
if (temps.IsDefaultOrEmpty)
{
return call;
}
else
{
return new BoundSequence(
syntax,
temps,
ImmutableArray<BoundExpression>.Empty,
call,
type);
}
}
}
示例2: VisitCall
private void VisitCall(
MethodSymbol method,
PropertySymbol propertyAccess,
ImmutableArray<BoundExpression> arguments,
ImmutableArray<RefKind> argumentRefKindsOpt,
ImmutableArray<string> argumentNamesOpt,
bool expanded,
BoundNode node)
{
Debug.Assert((object)method != null);
Debug.Assert(((object)propertyAccess == null) ||
(method == propertyAccess.GetOwnOrInheritedGetMethod()) ||
(method == propertyAccess.GetOwnOrInheritedSetMethod()) ||
propertyAccess.MustCallMethodsDirectly);
CheckArguments(argumentRefKindsOpt, arguments, method);
if (_inExpressionLambda)
{
if (method.CallsAreOmitted(node.SyntaxTree))
{
Error(ErrorCode.ERR_PartialMethodInExpressionTree, node);
}
else if ((object)propertyAccess != null && propertyAccess.IsIndexedProperty() && !propertyAccess.IsIndexer)
{
Error(ErrorCode.ERR_ExpressionTreeContainsIndexedProperty, node);
}
else if (arguments.Length < (((object)propertyAccess != null) ? propertyAccess.ParameterCount : method.ParameterCount) + (expanded ? -1 : 0))
{
Error(ErrorCode.ERR_ExpressionTreeContainsOptionalArgument, node);
}
else if (!argumentNamesOpt.IsDefaultOrEmpty)
{
Error(ErrorCode.ERR_ExpressionTreeContainsNamedArgument, node);
}
else if (IsComCallWithRefOmitted(method, arguments, argumentRefKindsOpt))
{
Error(ErrorCode.ERR_ComRefCallInExpressionTree, node);
}
else if (method.MethodKind == MethodKind.LocalFunction)
{
Error(ErrorCode.ERR_ExpressionTreeContainsLocalFunction, node);
}
else if (method.RefKind != RefKind.None)
{
Error(ErrorCode.ERR_RefReturningCallInExpressionTree, node);
}
}
}
示例3: MakePropertyGetAccess
private BoundExpression MakePropertyGetAccess(
SyntaxNode syntax,
BoundExpression rewrittenReceiver,
PropertySymbol property,
ImmutableArray<BoundExpression> rewrittenArguments,
MethodSymbol getMethodOpt = null,
BoundPropertyAccess oldNodeOpt = null)
{
if (_inExpressionLambda && rewrittenArguments.IsEmpty)
{
return oldNodeOpt != null ?
oldNodeOpt.Update(rewrittenReceiver, property, LookupResultKind.Viable, property.Type) :
new BoundPropertyAccess(syntax, rewrittenReceiver, property, LookupResultKind.Viable, property.Type);
}
else
{
var getMethod = getMethodOpt ?? property.GetOwnOrInheritedGetMethod();
Debug.Assert((object)getMethod != null);
Debug.Assert(getMethod.ParameterCount == rewrittenArguments.Length);
Debug.Assert(((object)getMethodOpt == null) || ReferenceEquals(getMethod, getMethodOpt));
return BoundCall.Synthesized(
syntax,
rewrittenReceiver,
getMethod,
rewrittenArguments);
}
}