コード例 #1
0
 public LoweringVisitor(DocumentIntermediateNode document, IntermediateNodeBuilder builder, Dictionary <string, SourceSpan?> namespaces, RazorParserFeatureFlags featureFlags)
 {
     _document     = document;
     _builder      = builder;
     _namespaces   = namespaces;
     _featureFlags = featureFlags;
 }
コード例 #2
0
 public LoweringVisitor(DocumentIntermediateNode document, IntermediateNodeBuilder builder, RazorParserFeatureFlags featureFlags)
 {
     _document     = document;
     _builder      = builder;
     _usings       = new List <UsingReference>();
     _featureFlags = featureFlags;
 }
コード例 #3
0
        public void Create_UnknownVersion_Throws()
        {
            // Arrange, Act & Assert
            var exception = Assert.Throws <ArgumentException>(
                () => RazorParserFeatureFlags.Create(0));

            Assert.Equal("Provided value for razor language version is unsupported or invalid: '0'.", exception.Message);
        }
コード例 #4
0
        public void Create_OlderVersion_DoesNotAllowMinimizedBooleanTagHelperAttributes()
        {
            // Arrange & Act
            var context = RazorParserFeatureFlags.Create(RazorLanguageVersion.Version1_1);

            // Assert
            Assert.False(context.AllowMinimizedBooleanTagHelperAttributes);
        }
コード例 #5
0
        public void Create_LatestVersion_AllowsMinimizedBooleanTagHelperAttributes()
        {
            // Arrange & Act
            var context = RazorParserFeatureFlags.Create(RazorLanguageVersion.Version2_1);

            // Assert
            Assert.True(context.AllowMinimizedBooleanTagHelperAttributes);
        }
コード例 #6
0
        public void Create_21Version_Allows21Features()
        {
            // Arrange & Act
            var context = RazorParserFeatureFlags.Create(RazorLanguageVersion.Version_2_1, FileKinds.Legacy);

            // Assert
            Assert.True(context.AllowMinimizedBooleanTagHelperAttributes);
            Assert.True(context.AllowHtmlCommentsInTagHelpers);
        }
コード例 #7
0
        public void Create_LatestVersion_AllowsLatestFeatures()
        {
            // Arrange & Act
            var context = RazorParserFeatureFlags.Create(RazorLanguageVersion.Latest, FileKinds.Legacy);

            // Assert
            Assert.True(context.AllowComponentFileKind);
            Assert.True(context.AllowRazorInAllCodeBlocks);
            Assert.True(context.AllowUsingVariableDeclarations);
            Assert.True(context.AllowNullableForgivenessOperator);
        }
コード例 #8
0
        public void Create_OldestVersion_DoesNotAllowLatestFeatures()
        {
            // Arrange & Act
            var context = RazorParserFeatureFlags.Create(RazorLanguageVersion.Version_1_0, FileKinds.Legacy);

            // Assert
            Assert.False(context.AllowMinimizedBooleanTagHelperAttributes);
            Assert.False(context.AllowHtmlCommentsInTagHelpers);
            Assert.False(context.AllowComponentFileKind);
            Assert.False(context.AllowRazorInAllCodeBlocks);
            Assert.False(context.AllowUsingVariableDeclarations);
            Assert.False(context.AllowNullableForgivenessOperator);
        }
コード例 #9
0
        public DefaultRazorParserOptions(DirectiveDescriptor[] directives, bool designTime, bool parseLeadingDirectives, RazorLanguageVersion version)
        {
            if (directives == null)
            {
                throw new ArgumentNullException(nameof(directives));
            }

            Directives             = directives;
            DesignTime             = designTime;
            ParseLeadingDirectives = parseLeadingDirectives;
            Version      = version;
            FeatureFlags = RazorParserFeatureFlags.Create(Version);
        }
コード例 #10
0
 public ImportsVisitor(DocumentIntermediateNode document, IntermediateNodeBuilder builder, Dictionary <string, SourceSpan?> namespaces, RazorParserFeatureFlags featureFlags)
     : base(document, new ImportBuilder(builder), namespaces, featureFlags)
 {
 }
コード例 #11
0
 public MainSourceVisitor(DocumentIntermediateNode document, IntermediateNodeBuilder builder, Dictionary <string, SourceSpan?> namespaces, string tagHelperPrefix, RazorParserFeatureFlags featureFlags)
     : base(document, builder, namespaces, featureFlags)
 {
     _tagHelperPrefix = tagHelperPrefix;
 }
コード例 #12
0
 public ImportsVisitor(DocumentIntermediateNode document, IntermediateNodeBuilder builder, RazorParserFeatureFlags featureFlags)
     : base(document, new ImportBuilder(builder), featureFlags)
 {
 }
コード例 #13
0
 public MainSourceVisitor(DocumentIntermediateNode document, IntermediateNodeBuilder builder, string tagHelperPrefix, RazorParserFeatureFlags featureFlags)
     : base(document, builder, featureFlags)
 {
     _tagHelperPrefix = tagHelperPrefix;
 }