Пример #1
0
        protected DeclStatNode AssertDeclarationNode(string src,
                                                     string type,
                                                     AccessModifiers access    = AccessModifiers.Unspecified,
                                                     QualifierFlags qualifiers = QualifierFlags.None)
        {
            ASTNode      ast  = this.GenerateAST(src);
            DeclStatNode decl = ast is SourceNode block
                ? this.ExtractDeclarationFromBlock(block)
                : ast.As <DeclStatNode>();

            Assert.That(decl.Children, Has.Exactly(2).Items);
            Assert.That(decl.Specifiers.Parent, Is.EqualTo(decl));
            Assert.That(decl.Specifiers.Modifiers.AccessModifiers, Is.EqualTo(access));
            Assert.That(decl.Specifiers.Modifiers.QualifierFlags, Is.EqualTo(qualifiers));
            Assert.That(decl.Specifiers.TypeName, Is.EqualTo(type));
            Assert.That(decl.Specifiers.Children, Is.Empty);
            return(decl);
        }
Пример #2
0
 public virtual MatchIssues Compare(ASTNode n1, ASTNode n2) => this.Compare(n1.As <T>(), n2.As <T>());
Пример #3
0
 public override bool Equals([AllowNull] ASTNode other)
 => base.Equals(other) && this.Identifier.Equals(other.As <IdNode>().Identifier);