Interface for describing compound translation elements.
Internal members protected for testability.
Inheritance: ScopedElementTranslationUnit, ITranslationUnit, ICompoundTranslationUnit, ITranslationInjector
        /// <summary>
        /// Copy initializes a new instance of the <see cref="ClassDeclarationTranslationUnit"/> class.
        /// </summary>
        /// <param name="other"></param>
        /// <remarks>
        /// For testability.
        /// </remarks>
        public ClassDeclarationTranslationUnit(ClassDeclarationTranslationUnit other)
            : base(other)
        {
            this.Name          = other.Name;
            this.BaseClassName = other.BaseClassName;
            this.Interfaces    = other.Interfaces;

            this.memberDeclarations      = other.memberDeclarations;
            this.constructorDeclarations = other.constructorDeclarations;
            this.propertyDeclarations    = other.propertyDeclarations;
            this.methodDeclarations      = other.methodDeclarations;

            this.injectedBefore = other.injectedBefore;
        }
        /// <summary>
        /// Copy initializes a new instance of the <see cref="ClassDeclarationTranslationUnit"/> class.
        /// </summary>
        /// <param name="other"></param>
        /// <remarks>
        /// For testability.
        /// </remarks>
        public ClassDeclarationTranslationUnit(ClassDeclarationTranslationUnit other)
            : base(other)
        {
            this.Name = other.Name;
            this.BaseClassName = other.BaseClassName;
            this.Interfaces = other.Interfaces;

            this.memberDeclarations = other.memberDeclarations;
            this.constructorDeclarations = other.constructorDeclarations;
            this.propertyDeclarations = other.propertyDeclarations;
            this.methodDeclarations = other.methodDeclarations;

            this.injectedBefore = other.injectedBefore;
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClassASTWalker"/> class.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="classDeclaration"></param>
        /// <param name="semanticModel">The semantic model.</param>
        protected ClassASTWalker(CSharpSyntaxNode node, ClassDeclarationTranslationUnit classDeclaration, SemanticModel semanticModel)
            : base(node, semanticModel)
        {
            var classDeclarationSyntaxNode = node as ClassDeclarationSyntax;
            if (classDeclarationSyntaxNode == null)
            {
                throw new ArgumentException(
                    string.Format("Specified node is not of type {0}",
                    typeof(ClassDeclarationSyntax).Name));
            }

            if (classDeclaration == null)
            {
                throw new ArgumentNullException(nameof(classDeclaration));
            }

            this.classDeclaration = classDeclaration;
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClassASTWalker"/> class.
        /// </summary>
        protected ClassASTWalker(CSharpSyntaxNode node)
        {
            var classDeclarationSyntaxNode = node as ClassDeclarationSyntax;
            if (classDeclarationSyntaxNode == null)
            {
                throw new ArgumentException(
                    string.Format("Specified node is not of type {0}",
                    typeof(ClassDeclarationSyntax).Name));
            }

            this.node = node;
            ClassDeclaration classHelper = new ClassDeclaration(classDeclarationSyntaxNode);

            this.classDeclaration = ClassDeclarationTranslationUnit.Create(
                classHelper.Visibility,
                IdentifierTranslationUnit.Create(classHelper.Name),
                classHelper.BaseClass == null ? null : IdentifierTranslationUnit.Create(classHelper.BaseClass.Name));

            foreach (BaseTypeReference implementedInterface in classHelper.ImplementedInterfaces)
            {
                this.classDeclaration.AddImplementedInterface(IdentifierTranslationUnit.Create(implementedInterface.Name));
            }
        }
示例#5
0
 /// <summary>
 /// Copy initializes a new instance of the <see cref="ClassASTWalker"/> class.
 /// </summary>
 /// <param name="other"></param>
 /// <remarks>
 /// For testability.
 /// </remarks>
 public ClassASTWalker(ClassASTWalker other)
     : base(other)
 {
     this.classDeclaration = other.classDeclaration;
 }
 public static MockedClassDeclarationTranslationUnit Create(ClassDeclarationTranslationUnit classDeclarationTranslationUnit)
 {
     return new MockedClassDeclarationTranslationUnit(classDeclarationTranslationUnit);
 }
 protected MockedClassDeclarationTranslationUnit(ClassDeclarationTranslationUnit original)
     : base(original)
 {
 }