public override void VisitTypeNameSpecifier(TypeNameSpecifier node, CloningAstVisitorContext context)
 {
     context.Result = new TypeNameSpecifier()
     {
         Identifier = this.CloneNode(node.Identifier, context),
         Qualifier  = this.CloneNode(node.Qualifier, context)
     };
 }
        public override void VisitTypeNameSpecifier(TypeNameSpecifier node, AstPrinterContext context)
        {
            if (node.Qualifier != null && node.Qualifier.HasAnyMembers())
            {
                this.Visit(node.Qualifier, context);
                context.Write(" ");
            }

            this.Visit(node.Identifier, context);
        }
 public override AstNode VisitType_specifier_nonarray([NotNull] GLSL_ES300Parser.Type_specifier_nonarrayContext context)
 {
     if (context.struct_specifier() != null)
     {
         var structSpecifier = (StructTypeSpecifier)this.VisitStruct_specifier(context.struct_specifier());
         return(structSpecifier);
     }
     else
     {
         TypeNameSpecifier result = new TypeNameSpecifier();
         result.Identifier = new Identifier()
         {
             Name = context.GetText()
         };
         return(result);
     }
 }
 public virtual void VisitTypeNameSpecifier(TypeNameSpecifier node, TContext context)
 {
     this.Visit(node.Identifier, context);
     this.Visit(node.Qualifier, context);
 }
Пример #5
0
 public override void VisitTypeNameSpecifier(TypeNameSpecifier node, SemanticModelBuilderContext context)
 {
     this.SafeAddSymbolReference(node.Identifier, node, context);
     base.VisitTypeNameSpecifier(node, context);
 }
        public void CanCompareQualifierLayout(
            string q1m1name,
            string q1m1value,
            string q1m2name,
            string q1m2value,
            string q2m1name,
            string q2m1value,
            string q2m2name,
            string q2m2value,
            bool expectedResult)
        {
            var specifier1 = new TypeNameSpecifier()
            {
                Identifier = new Identifier()
                {
                    Name = "int"
                },
                Qualifier = new TypeQualifier()
            };

            specifier1.Qualifier.Layout.Add(new LayoutIdQualifier()
            {
                Identifier = new Identifier()
                {
                    Name = q1m1name
                },
                Order = new IntegerLiteral()
                {
                    LiteralValue = q1m1value
                }
            });
            specifier1.Qualifier.Layout.Add(new LayoutIdQualifier()
            {
                Identifier = new Identifier()
                {
                    Name = q1m2name
                },
                Order = new IntegerLiteral()
                {
                    LiteralValue = q1m2value
                }
            });

            var specifier2 = new TypeNameSpecifier()
            {
                Identifier = new Identifier()
                {
                    Name = "int"
                },
                Qualifier = new TypeQualifier()
            };

            specifier2.Qualifier.Layout.Add(new LayoutIdQualifier()
            {
                Identifier = new Identifier()
                {
                    Name = q2m1name
                },
                Order = new IntegerLiteral()
                {
                    LiteralValue = q2m1value
                }
            });
            specifier2.Qualifier.Layout.Add(new LayoutIdQualifier()
            {
                Identifier = new Identifier()
                {
                    Name = q2m2name
                },
                Order = new IntegerLiteral()
                {
                    LiteralValue = q2m2value
                }
            });

            var result = AstHelper.TypeSpecifiersAreEquivalent(specifier1, specifier2, true);

            result.Should().Be(expectedResult);
        }
Пример #7
0
 private static bool TypeNameSpecifiersAreEquivalent(TypeNameSpecifier typeSpecifier1, TypeNameSpecifier typeSpecifier2, bool compareQualifier = false)
 {
     return(IdentifiersAreEquivalent(typeSpecifier1.Identifier, typeSpecifier2.Identifier) &&
            (!compareQualifier || TypeQualifiersAreEquivalent(typeSpecifier1.Qualifier, typeSpecifier2.Qualifier)));
 }