本文整理汇总了C#中Analyzer.EnterActParam方法的典型用法代码示例。如果您正苦于以下问题:C# Analyzer.EnterActParam方法的具体用法?C# Analyzer.EnterActParam怎么用?C# Analyzer.EnterActParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Analyzer
的用法示例。
在下文中一共展示了Analyzer.EnterActParam方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Analyze
public void Analyze(ActualParam/*!*/node, Analyzer/*!*/ analyzer, bool isBaseCtorCallConstrained)
{
// TODO: isBaseCtorCallConstrained
ExInfoFromParent info = new ExInfoFromParent(node);
analyzer.EnterActParam();
if (node.IsVariadic) throw new NotImplementedException();
if (analyzer.ActParamDeclIsUnknown())
{
// we don't know whether the parameter will be passed by reference at run-time:
if (node.Expression.AllowsPassByReference)
{
info.Access = AccessType.ReadUnknown;
// Although we prepare to pass reference, value can be really passed.
// That's why we report warning when user use '&' in calling,
// because it has no influence.
if (node.Ampersand)
analyzer.ErrorSink.Add(Warnings.ActualParamWithAmpersand, analyzer.SourceUnit, node.Span);
}
else
{
info.Access = AccessType.Read;
}
}
else
{
if (analyzer.ActParamPassedByRef())
{
if (node.Expression.AllowsPassByReference)
{
info.Access = AccessType.ReadRef;
}
else
{
analyzer.ErrorSink.Add(Errors.NonVariablePassedByRef, analyzer.SourceUnit, node.Expression.Span);
analyzer.LeaveActParam();
return;
}
}
else
{
info.Access = AccessType.Read;
if (node.Ampersand) analyzer.ErrorSink.Add(Warnings.ActualParamWithAmpersand, analyzer.SourceUnit, node.Span);
}
}
node._expression = node.Expression.Analyze(analyzer, info).Literalize();
// TODO: if signature is known, act. param has type hint and expression has known type; check if type hint matches expression
analyzer.LeaveActParam();
}
示例2: Analyze
internal void Analyze(Analyzer/*!*/ analyzer, bool isBaseCtorCallConstrained)
{
// TODO: isBaseCtorCallConstrained
ExInfoFromParent info = new ExInfoFromParent(this);
analyzer.EnterActParam();
if (analyzer.ActParamDeclIsUnknown())
{
// we don't know whether the parameter will be passed by reference at run-time:
if (expression.AllowsPassByReference)
{
info.Access = AccessType.ReadUnknown;
// Although we prepare to pass reference, value can be really passed.
// That's why we report warning when user use '&' in calling,
// because it has no influence.
if (ampersand)
analyzer.ErrorSink.Add(Warnings.ActualParamWithAmpersand, analyzer.SourceUnit, position);
}
else
{
info.Access = AccessType.Read;
}
}
else
{
if (analyzer.ActParamPassedByRef())
{
if (expression.AllowsPassByReference)
{
info.Access = AccessType.ReadRef;
}
else
{
analyzer.ErrorSink.Add(Errors.NonVariablePassedByRef, analyzer.SourceUnit, expression.Position);
analyzer.LeaveActParam();
return;
}
}
else
{
info.Access = AccessType.Read;
if (ampersand) analyzer.ErrorSink.Add(Warnings.ActualParamWithAmpersand, analyzer.SourceUnit, position);
}
}
expression = expression.Analyze(analyzer, info).Literalize();
analyzer.LeaveActParam();
}