Exemple #1
0
 static DiagnosticMessage CheckNativeDisableContainerSafetyRestriction(
     MethodDefinition method,
     LambdaJobDescriptionConstruction.InvokedConstructionMethod constructionMethod,
     FieldDefinition field)
 {
     if (field.FieldType.HasAttributeOrFieldWithAttribute(typeof(NativeContainerAttribute)))
     {
         return(null);
     }
     return(UserError.DC0036(method, field.Name, field.FieldType, constructionMethod.InstructionInvokingMethod));
 }
 static DiagnosticMessage CheckNativeDisableParallelForRestriction(
     MethodDefinition method,
     LambdaJobDescriptionConstruction.InvokedConstructionMethod constructionMethod,
     FieldDefinition field)
 {
     if (HasAttribute(field.FieldType.Resolve(), typeof(NativeContainerAttribute)))
     {
         return(null);
     }
     return(UserError.DC0037(method, field.Name, field.FieldType, constructionMethod.InstructionInvokingMethod));
 }
 static DiagnosticMessage CheckDeallocateOnJobCompletion(
     MethodDefinition method,
     LambdaJobDescriptionConstruction.InvokedConstructionMethod constructionMethod,
     FieldDefinition field)
 {
     if (HasAttribute(field.FieldType.Resolve(), typeof(NativeContainerSupportsDeallocateOnJobCompletionAttribute)))
     {
         return(null);
     }
     return(UserError.DC0035(method, field.Name, field.FieldType, constructionMethod.InstructionInvokingMethod));
 }
 public static DiagnosticMessage DC0012(MethodDefinition methodToAnalyze, LambdaJobDescriptionConstruction.InvokedConstructionMethod constructionMethod)
 {
     return(MakeError(nameof(DC0012), $"{constructionMethod.MethodName} requires its argument to be a local variable that is captured by the lambda expression.", methodToAnalyze, constructionMethod.InstructionInvokingMethod));
 }
Exemple #5
0
 public static DiagnosticMessage DCICE007(MethodDefinition methodToAnalyze, LambdaJobDescriptionConstruction.InvokedConstructionMethod constructionMethod)
 {
     return(UserError.MakeError(nameof(DCICE007), $"Could not find field for local captured variable for argument of {constructionMethod.MethodName}.", methodToAnalyze, constructionMethod.InstructionInvokingMethod));
 }
Exemple #6
0
 public static DiagnosticMessage DC0038(MethodDefinition containingMethod, FieldDefinition field, LambdaJobDescriptionConstruction.InvokedConstructionMethod constructionMethod)
 {
     return(MakeError(nameof(DC0038), $"Entities.{constructionMethod.MethodName} is called with an invalid argument {field.DeclaringType.Name}.{field.Name}. You cannot use Entities.{constructionMethod.MethodName} with fields of user-defined types as the argument. Please assign the field to a local variable and use that instead.", containingMethod, constructionMethod.InstructionInvokingMethod));
 }