Example #1
0
 public LoweringVisitor(DocumentIntermediateNode document, IntermediateNodeBuilder builder, Dictionary <string, SourceSpan?> namespaces, RazorParserFeatureFlags featureFlags)
 {
     _document     = document;
     _builder      = builder;
     _namespaces   = namespaces;
     _featureFlags = featureFlags;
 }
 public LoweringVisitor(DocumentIntermediateNode document, IntermediateNodeBuilder builder, RazorParserFeatureFlags featureFlags)
 {
     _document     = document;
     _builder      = builder;
     _usings       = new List <UsingReference>();
     _featureFlags = featureFlags;
 }
Example #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);
        }
Example #4
0
        public void Create_OlderVersion_DoesNotAllowMinimizedBooleanTagHelperAttributes()
        {
            // Arrange & Act
            var context = RazorParserFeatureFlags.Create(RazorLanguageVersion.Version1_1);

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

            // Assert
            Assert.True(context.AllowMinimizedBooleanTagHelperAttributes);
        }
        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);
        }
        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);
        }
        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);
        }
Example #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);
        }
Example #10
0
 public ImportsVisitor(DocumentIntermediateNode document, IntermediateNodeBuilder builder, Dictionary <string, SourceSpan?> namespaces, RazorParserFeatureFlags featureFlags)
     : base(document, new ImportBuilder(builder), namespaces, featureFlags)
 {
 }
Example #11
0
 public MainSourceVisitor(DocumentIntermediateNode document, IntermediateNodeBuilder builder, Dictionary <string, SourceSpan?> namespaces, string tagHelperPrefix, RazorParserFeatureFlags featureFlags)
     : base(document, builder, namespaces, featureFlags)
 {
     _tagHelperPrefix = tagHelperPrefix;
 }
 public ImportsVisitor(DocumentIntermediateNode document, IntermediateNodeBuilder builder, RazorParserFeatureFlags featureFlags)
     : base(document, new ImportBuilder(builder), featureFlags)
 {
 }
 public MainSourceVisitor(DocumentIntermediateNode document, IntermediateNodeBuilder builder, string tagHelperPrefix, RazorParserFeatureFlags featureFlags)
     : base(document, builder, featureFlags)
 {
     _tagHelperPrefix = tagHelperPrefix;
 }