Helper for accessing interface in AST
Inheritance: Helper
        /// <summary>
        /// Creates a <see cref="MethodDeclarationTranslationUnit"/>.
        /// </summary>
        /// <returns>A <see cref="MethodDeclarationTranslationUnit"/>.</returns>
        public ITranslationUnit Create()
        {
            if (this.DoNotCreateTranslationUnit)
            {
                return null;
            }

            var helper = new FieldDeclaration(this.Node as FieldDeclarationSyntax, this.SemanticModel);

            var fieldDeclaration = this.CreateTranslationUnit(
                helper.Visibility,
                TypeIdentifierTranslationUnit.Create(helper.Type.MapType()),
                IdentifierTranslationUnit.Create(helper.Name));

            return fieldDeclaration;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="node"></param>
        public override void VisitFieldDeclaration(FieldDeclarationSyntax node)
        {
            base.VisitFieldDeclaration(node);

            var fieldDeclaration = new FieldDeclaration(node);
            var fieldDeclarationTranslationUnit = FieldDeclarationTranslationUnit.Create(fieldDeclaration.Visibility,
                IdentifierTranslationUnit.Create(fieldDeclaration.Type), IdentifierTranslationUnit.Create(fieldDeclaration.Name));
            this.classDeclaration.AddMemberDeclaration(fieldDeclarationTranslationUnit);

            this.InvokeFieldDeclarationVisited(this, new WalkerEventArgs());
        }