static private AwaiterIsCompletedShouldNotBeIndexer ( object p0 ) : |
||
p0 | object | |
return |
private static void ValidateAwaiterType(Type awaiterType, out Type resultType) { if (!typeof(INotifyCompletion).IsAssignableFrom(awaiterType)) { throw Error.AwaiterTypeShouldImplementINotifyCompletion(awaiterType); } var isCompleted = awaiterType.GetProperty("IsCompleted", BindingFlags.Public | BindingFlags.Instance); if (isCompleted == null || isCompleted.GetMethod == null) { throw Error.AwaiterTypeShouldHaveIsCompletedProperty(awaiterType); } if (isCompleted.PropertyType != typeof(bool)) { throw Error.AwaiterIsCompletedShouldReturnBool(awaiterType); } if (isCompleted.GetIndexParameters().Length != 0) { throw Error.AwaiterIsCompletedShouldNotBeIndexer(awaiterType); } var getResult = AwaitCSharpExpression.GetGetResult(awaiterType); if (getResult == null || getResult.IsGenericMethodDefinition) { throw Error.AwaiterTypeShouldHaveGetResultMethod(awaiterType); } var returnType = getResult.ReturnType; if (returnType.IsByRef || returnType.IsPointer) { throw Error.AwaiterGetResultTypeInvalid(awaiterType); } resultType = returnType; }