Exemplo n.º 1
0
        private ParseOptions GetParseOptions(DocumentationMode documentationMode, [NotNull] string languageName,
                                             OperationFeature operationFeature)
        {
            // Bug workaround: Setting DocumentationMode to a non-default value resets Features.
            ParseOptions optionsWithLostFeatures = languageName == LanguageNames.VisualBasic
                ? (ParseOptions)DefaultBasicParseOptions.WithDocumentationMode(documentationMode)
                : DefaultCSharpParseOptions.WithDocumentationMode(documentationMode);

            return(operationFeature == OperationFeature.Enabled
                ? optionsWithLostFeatures.WithFeatures(OperationFeatureFlag)
                : optionsWithLostFeatures);
        }
        private ParseOptions GetParseOptions(DocumentationMode documentationMode, [NotNull] string languageName,
                                             OperationFeature operationFeature)
        {
#pragma warning disable AV2310 // Code blocks should not contain inline comments
            // Bug workaround: Setting DocumentationMode to a non-default value resets Features.
#pragma warning restore AV2310 // Code blocks should not contain inline comments

            ParseOptions optionsWithLostFeatures = languageName == LanguageNames.VisualBasic
                ? (ParseOptions)DefaultBasicParseOptions.WithDocumentationMode(documentationMode)
                : DefaultCSharpParseOptions.WithDocumentationMode(documentationMode);

            return(operationFeature == OperationFeature.Enabled
                ? optionsWithLostFeatures.WithFeatures(OperationFeatureFlag)
                : optionsWithLostFeatures);
        }
 private AnalyzerTestContext([NotNull] string markupCode, [NotNull] string languageName, [NotNull] string fileName,
                             [NotNull] string assemblyName, [NotNull][ItemNotNull] ImmutableHashSet <MetadataReference> references,
                             DocumentationMode documentationMode, OperationFeature operationFeature, [CanBeNull] int?compilerWarningLevel,
                             TestValidationMode validationMode, DiagnosticsCaptureMode diagnosticsCaptureMode, [NotNull] AnalyzerOptions options)
 {
     MarkupCode             = markupCode;
     LanguageName           = languageName;
     FileName               = fileName;
     AssemblyName           = assemblyName;
     References             = references;
     DocumentationMode      = documentationMode;
     OperationFeature       = operationFeature;
     CompilerWarningLevel   = compilerWarningLevel;
     ValidationMode         = validationMode;
     DiagnosticsCaptureMode = diagnosticsCaptureMode;
     Options = options;
 }
 public AnalyzerTestContext WithOperationFeature(OperationFeature feature)
 {
     return(new AnalyzerTestContext(MarkupCode, LanguageName, FileName, AssemblyName, References, DocumentationMode,
                                    feature, CompilerWarningLevel, ValidationMode, DiagnosticsCaptureMode, Options));
 }