本文整理汇总了C#中System.Compiler.Method.GetParameterTypes方法的典型用法代码示例。如果您正苦于以下问题:C# Method.GetParameterTypes方法的具体用法?C# Method.GetParameterTypes怎么用?C# Method.GetParameterTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Compiler.Method
的用法示例。
在下文中一共展示了Method.GetParameterTypes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitCall
protected override object VisitCall(Variable dest, Variable receiver, Method callee, ExpressionList arguments, bool virtcall, Statement stat, object arg) {
NonNullState nn=(NonNullState)arg;
bool resultIsNonNull = false;
// Check for Receiver
if (!callee.IsStatic)
CheckReceiver(stat,receiver,nn);
// Check for parameter matching.
if (arguments!=null && callee.Parameters != null){
for(int i=0;i<callee.Parameters.Count;i++){
Variable actual = (Variable)arguments[i];
if (ts.IsNonNullType(callee.GetParameterTypes()[i])) {
if(nn.IsNull(actual)) {
HandleError(stat, actual, Error.CannotCoerceNullToNonNullType);
}
else if(!nn.IsNonNull(actual)) {
//System.Console.WriteLine("visit call, argument: {0}", actual);
HandleError(stat, actual, Error.CoercionToNonNullTypeMightFail, callee.GetParameterTypes()[i]);
}
}
nn.HavocIndirect(actual, callee.Parameters[i].Type as Reference);
}
}
// special case some methods
if (this.IsAssertionMethodThatDoesNotReturn(callee)) {
// we assume that all assertion methods are called with false.
return null;
}
else if (this.NNChecker.IsAssertNotNullImplicitMethod(callee)) {
if (arguments.Count == 1){
Variable source = (Variable)arguments[0]; // guaranteed by CodeFlattener
// compiler inserts this test throughout, so let's warn here.
if (nn.IsNonNull(source)) {
// opportunity to optimize away check.
RecordUnnecessaryCheck(stat);
// Console.WriteLine("Could optimize IsNonNull check at line {0}", stat.SourceContext.StartLine);
}
else {
RecordNecessaryCheck(stat);
if (nn.IsNull(source)) {
HandleError(stat, source, Error.CannotCoerceNullToNonNullType);
// do not explore this path further, except for exceptional path
PushNullException(nn);
return null;
}
else {
//System.Console.WriteLine("visit call and callee is assertnotnullimplicitmethod");
HandleError(stat, source, Error.CoercionToNonNullTypeMightFail,
OptionalModifier.For(SystemTypes.NonNullType, source.Type));
}
}
nn = PushNullException(nn);
nn.AssumeNonNull(source);
}
}
else if (NNChecker.IsAssertNotNullMethod(callee)) {
if (arguments.Count == 1){
Variable source = (Variable)arguments[0]; // guaranteed by CodeFlattener
// User inserted cast, so let's warn if it is unnecessary.
if (nn.IsNonNull(source)) {
// Let user know his check is useless here.
RecordUnnecessaryCheck(stat);
// Console.WriteLine("Could optimize IsNonNull check at line {0}", stat.SourceContext.StartLine);
}
else {
RecordNecessaryCheck(stat);
if (nn.IsNull(source)) {
// Error already emitted at checker time. HandleError(stat, source, Error.CannotCoerceNullToNonNullType);
// do not explore this path further except for exceptional path
PushNullException(nn);
return null;
}
}
nn = PushNullException(nn);
nn.AssumeNonNull(source);
}
}
else if ( callee.Name.Name == "GetEnumerator" ) {
// special case assume result is non-null because it is in generated code and confuses.
if (dest != null) {
nn.AssignNonNull(dest);
dest = null; // avoid setting dest again below.
}
}
else if (callee == GetTypeFromHandleMethod) {
// special case that should be handled by annotating mscorlib
if (dest != null) {
nn.AssignNonNull(dest);
dest = null; // avoid setting dest again below
}
}
else {
Property pget = IsPropertyGetter(callee);
if (pget != null) {
resultIsNonNull = nn.LoadProperty(receiver, pget, dest);
//.........这里部分代码省略.........