本文整理汇总了C#中Mono.CSharp.LocalVariableReference.Error_TypeArgumentsCannotBeUsed方法的典型用法代码示例。如果您正苦于以下问题:C# LocalVariableReference.Error_TypeArgumentsCannotBeUsed方法的具体用法?C# LocalVariableReference.Error_TypeArgumentsCannotBeUsed怎么用?C# LocalVariableReference.Error_TypeArgumentsCannotBeUsed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.LocalVariableReference
的用法示例。
在下文中一共展示了LocalVariableReference.Error_TypeArgumentsCannotBeUsed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoSimpleNameResolve
/// <remarks>
/// 7.5.2: Simple Names.
///
/// Local Variables and Parameters are handled at
/// parse time, so they never occur as SimpleNames.
///
/// The `intermediate' flag is used by MemberAccess only
/// and it is used to inform us that it is ok for us to
/// avoid the static check, because MemberAccess might end
/// up resolving the Name as a Type name and the access as
/// a static type access.
///
/// ie: Type Type; .... { Type.GetType (""); }
///
/// Type is both an instance variable and a Type; Type.GetType
/// is the static method not an instance method of type.
/// </remarks>
Expression DoSimpleNameResolve(ResolveContext ec, Expression right_side, bool intermediate)
{
Expression e = null;
//
// Stage 1: Performed by the parser (binding to locals or parameters).
//
Block current_block = ec.CurrentBlock;
if (current_block != null){
LocalInfo vi = current_block.GetLocalInfo (Name);
if (vi != null){
e = new LocalVariableReference (ec.CurrentBlock, Name, loc);
if (right_side != null) {
e = e.ResolveLValue (ec, right_side);
} else {
if (intermediate) {
using (ec.With (ResolveContext.Options.DoFlowAnalysis, false)) {
e = e.Resolve (ec, ResolveFlags.VariableOrValue);
}
} else {
e = e.Resolve (ec, ResolveFlags.VariableOrValue);
}
}
if (HasTypeArguments && e != null)
e.Error_TypeArgumentsCannotBeUsed (ec.Report, loc, null, 0);
return e;
}
e = current_block.Toplevel.GetParameterReference (Name, loc);
if (e != null) {
if (right_side != null)
e = e.ResolveLValue (ec, right_side);
else
e = e.Resolve (ec);
if (HasTypeArguments && e != null)
e.Error_TypeArgumentsCannotBeUsed (ec.Report, loc, null, 0);
return e;
}
}
//
// Stage 2: Lookup members
//
int arity = HasTypeArguments ? Arity : -1;
// TypeSpec almost_matched_type = null;
// IList<MemberSpec> almost_matched = null;
for (TypeSpec lookup_ds = ec.CurrentType; lookup_ds != null; lookup_ds = lookup_ds.DeclaringType) {
e = MemberLookup (ec.Compiler, ec.CurrentType, lookup_ds, Name, arity, BindingRestriction.NoOverrides, loc);
if (e != null) {
PropertyExpr pe = e as PropertyExpr;
if (pe != null) {
// since TypeManager.MemberLookup doesn't know if we're doing a lvalue access or not,
// it doesn't know which accessor to check permissions against
if (pe.PropertyInfo.Kind == MemberKind.Property && pe.IsAccessibleFrom (ec.CurrentType, right_side != null))
break;
} else if (e is EventExpr) {
if (((EventExpr) e).IsAccessibleFrom (ec.CurrentType))
break;
} else if (HasTypeArguments && e is TypeExpression) {
e = new GenericTypeExpr (e.Type, targs, loc).ResolveAsTypeStep (ec, false);
break;
} else {
break;
}
e = null;
}
/*
if (almost_matched == null && almost_matched_members.Count > 0) {
almost_matched_type = lookup_ds;
almost_matched = new List<MemberSpec>(almost_matched_members);
}
*/
}
if (e == null) {
/*
if (almost_matched == null && almost_matched_members.Count > 0) {
almost_matched_type = ec.CurrentType;
//.........这里部分代码省略.........