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

            PropertyDeclaration helper = new PropertyDeclaration(this.Node as PropertyDeclarationSyntax, this.SemanticModel);

            var propertyDeclaration = this.CreateTranslationUnit(
                helper.Visibility,
                TypeIdentifierTranslationUnit.Create(helper.Type.FullName.MapType()),
                IdentifierTranslationUnit.Create(helper.Name),
                helper.HasGet,
                helper.HasSet);

            return propertyDeclaration;
        }
Example #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="node"></param>
        /// <remarks>
        /// We don't need to go further deeper in the tree by visiting the node.
        /// </remarks>
        public override void VisitPropertyDeclaration(PropertyDeclarationSyntax node)
        {
            // TODO: Use translation unit factories

            var helper = new PropertyDeclaration(node, this.semanticModel);

            // Properties in TypeScript will be translated as methods as
            // TypeScript does not support properties in interfaces
            var translationUnit = MethodSignatureDeclarationTranslationUnit.Create(
                helper.Visibility, TypeIdentifierTranslationUnit.Create(helper.Type.FullName), IdentifierTranslationUnit.Create(helper.Name));

            this.interfaceDeclaration.AddSignature(translationUnit);

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