/// <summary>
 /// Initializes a new instance of the <see cref="UnaryExpressionTranslationUnit"/> class.
 /// </summary>
 /// <param name="nestingLevel"></param>
 protected UnaryExpressionTranslationUnit(int nestingLevel)
     : base(nestingLevel)
 {
     this.operand = null;
     this.operatorToken = OperatorToken.Undefined;
     this.unaryPosition = UnaryPosition.Postfix;
 }
예제 #2
0
        public string RenderSimpleEmptyConstructor()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildConstructorTranslationUnit(
                ModifierTokens.Public);

            return(translationUnit.Translate());
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UnaryExpressionTranslationUnit"/> class.
 /// </summary>
 /// <param name="nestingLevel"></param>
 protected UnaryExpressionTranslationUnit(int nestingLevel)
     : base(nestingLevel)
 {
     this.operand       = null;
     this.operatorToken = OperatorToken.Undefined;
     this.unaryPosition = UnaryPosition.Postfix;
 }
 /// <summary>
 /// Copy initializes a new instance of the <see cref="PropertyDefinitionTranslationUnit"/> class.
 /// </summary>
 /// <param name="other"></param>
 /// <remarks>
 /// For testability.
 /// </remarks>
 public PropertyDefinitionTranslationUnit(PropertyDefinitionTranslationUnit other)
     : base((MemberTranslationUnit)other)
 {
     this.type = other.type;
     this.hasGet = other.hasGet;
     this.hasSet = other.hasSet;
 }
예제 #5
0
        public string RenderSimpleEmptyProperty()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildPropertyTranslationUnit(
                VisibilityToken.Public, "int", "SimpleProperty");

            return(translationUnit.Translate());
        }
예제 #6
0
        public string RenderSimpleEmptyInterface()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildInterfaceTranslationUnit(
                ModifierTokens.Public, "SimpleEmptyInterface");

            return(translationUnit.Translate());
        }
예제 #7
0
        public string StringPublicMember()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMemberTranslationUnit(
                VisibilityToken.Public, Lexems.StringType, "stringMember");

            return(translationUnit.Translate());
        }
예제 #8
0
        public string RenderSimpleEmptyInterface()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildInterfaceTranslationUnit(
                VisibilityToken.Public, "SimpleEmptyInterface");

            return(translationUnit.Translate());
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="BinaryExpressionTranslationUnit"/> class.
 /// </summary>
 /// <param name="nestingLevel"></param>
 protected BinaryExpressionTranslationUnit(int nestingLevel)
     : base(nestingLevel)
 {
     this.leftOperand = null;
     this.rightOperand = null;
     this.operatorToken = OperatorToken.Undefined;
 }
예제 #10
0
        public string RenderSimpleEmptyConstructor()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildConstructorTranslationUnit(
                VisibilityToken.Public);

            return(translationUnit.Translate());
        }
예제 #11
0
파일: Methods.cs 프로젝트: afrog33k/Rosetta
        public string RenderEmptyMethodWithReturn()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMethodTranslationUnit(
                VisibilityToken.Public, "string", "EmptyMethodWithReturn");

            return(translationUnit.Translate());
        }
예제 #12
0
        public string RenderSimpleEmptyClass()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildClassTranslationUnit(
                ModifierTokens.Public, "SimpleEmptyClass", null);

            return(translationUnit.Translate());
        }
        /// <summary>
        /// In charge of executing a fixed visit of this node.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="index"></param>
        private void VisitNode(IfStatementSyntax node, int index)
        {
            // Handling conditional expression
            this.Statement.SetTestExpression(
                new ExpressionTranslationUnitBuilder(node.Condition, this.semanticModel).Build(),
                index);

            // Handling body
            IASTWalker walker = (node.Statement as BlockSyntax != null) ?
                                BlockASTWalker.Create(node.Statement) :
                                new StatementASTWalkerBuilder(node.Statement).Build();
            ITranslationUnit translationUnit = walker.Walk();

            this.Statement.SetStatementInConditionalBlock(translationUnit, index);

            // TODO: Remember to call the event for node traversal

            if (node.Else != null && node.Else.Statement != null)
            {
                if (node.Else.Statement as IfStatementSyntax != null)
                {
                    // To the next node
                    this.VisitNode(node.Else.Statement as IfStatementSyntax, ++index);
                }
                else
                {
                    walker = (node.Else.Statement as BlockSyntax != null) ?
                             BlockASTWalker.Create(node.Else.Statement) :
                             new StatementASTWalkerBuilder(node.Else.Statement).Build();
                    translationUnit = walker.Walk();
                    this.Statement.SetStatementInElseBlock(translationUnit);
                }
            }
        }
예제 #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EnumTranslationUnit"/> class.
        /// </summary>
        protected EnumTranslationUnit() : base()
        {
            this.Name    = IdentifierTranslationUnit.Empty;
            this.members = new List <ITranslationUnit>();

            this.injectedBefore = null;
        }
예제 #15
0
        public string StringMember()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMemberTranslationUnit(
                VisibilityToken.None, "string", "stringMember");

            return(translationUnit.Translate());
        }
예제 #16
0
 /// <summary>
 /// Copy initializes a new instance of the <see cref="PropertyDefinitionTranslationUnit"/> class.
 /// </summary>
 /// <param name="other"></param>
 /// <remarks>
 /// For testability.
 /// </remarks>
 public PropertyDefinitionTranslationUnit(PropertyDefinitionTranslationUnit other)
     : base((MemberTranslationUnit)other)
 {
     this.type   = other.type;
     this.hasGet = other.hasGet;
     this.hasSet = other.hasSet;
 }
예제 #17
0
        public string IntPrivateMember()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMemberTranslationUnit(
                VisibilityToken.Private, "int", "intMember");

            return(translationUnit.Translate());
        }
예제 #18
0
            public string RenderReturnStatement()
            {
                ITranslationUnit translationUnit = TranslationUnitBuilder.BuildReturnStatementTranslationUnit(
                    TranslationUnitBuilder.BuildLiteralTranslationUnit(true));

                return(translationUnit.Translate());
            }
예제 #19
0
            public string RenderThrowStatement()
            {
                ITranslationUnit translationUnit = TranslationUnitBuilder.BuildThrowStatementTranslationUnit(
                    TranslationUnitBuilder.BuildNullLiteralTranslationUnit());

                return(translationUnit.Translate());
            }
예제 #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BinaryExpressionTranslationUnit"/> class.
 /// </summary>
 /// <param name="nestingLevel"></param>
 protected BinaryExpressionTranslationUnit(int nestingLevel)
     : base(nestingLevel)
 {
     this.leftOperand   = null;
     this.rightOperand  = null;
     this.operatorToken = OperatorToken.Undefined;
 }
예제 #21
0
        public string IntPrivateMember()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMemberTranslationUnit(
                ModifierTokens.Private, Lexems.NumberType, "intMember");

            return(translationUnit.Translate());
        }
예제 #22
0
파일: Methods.cs 프로젝트: afrog33k/Rosetta
        public string RenderSimpleEmptyMethod()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMethodTranslationUnit(
                VisibilityToken.Public, null, "SimpleEmptyMethod");

            return(translationUnit.Translate());
        }
예제 #23
0
        public string StringMember()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMemberTranslationUnit(
                ModifierTokens.None, Lexems.StringType, "stringMember");

            return(translationUnit.Translate());
        }
예제 #24
0
        public string RenderEmptyClassWithInheritance()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildClassTranslationUnit(
                ModifierTokens.Public, "EmptyClassWithInheritance", "BaseClass");

            return(translationUnit.Translate());
        }
예제 #25
0
        public string RenderEmptyMethodWithReturn()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMethodSignatureTranslationUnit(
                ModifierTokens.Public, Lexems.StringType, "MethodSignatureWithReturn");

            return(translationUnit.Translate());
        }
예제 #26
0
        public string RenderEmptyPublicStaticMethod()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMethodTranslationUnit(
                ModifierTokens.Public | ModifierTokens.Static, null, "EmptyPublicStaticMethod");

            return(translationUnit.Translate());
        }
예제 #27
0
파일: Classes.cs 프로젝트: afrog33k/Rosetta
        public string RenderSimpleEmptyClass()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildClassTranslationUnit(
                VisibilityToken.Public, "SimpleEmptyClass", null);

            return(translationUnit.Translate());
        }
예제 #28
0
        public string RenderSimpleEmptyNoVisibilityMethod()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMethodTranslationUnit(
                ModifierTokens.None, null, "SimpleEmptyMethod");

            return(translationUnit.Translate());
        }
예제 #29
0
        public string RenderSimpleEmptyMethod()
        {
            ITranslationUnit translationUnit = TranslationUnitBuilder.BuildMethodSignatureTranslationUnit(
                ModifierTokens.Public, null, "SimpleMethodSignature");

            return(translationUnit.Translate());
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="type"></param>
        /// <param name="name"></param>
        /// <param name="expressions"></param>
        /// <returns></returns>
        public static VariableDeclarationTranslationUnit Create(
            ITranslationUnit type, ITranslationUnit[] names, ITranslationUnit[] expressions = null,
            bool shouldRenderDeclarationKeyword = true)
        {
            if (names == null)
            {
                throw new ArgumentNullException(nameof(names));
            }
            if (names.Length == 0)
            {
                throw new ArgumentException(nameof(names), "At least one name needed!");
            }
            if (expressions != null && expressions.Length != names.Length)
            {
                throw new ArgumentException(nameof(expressions), "Number of expressions should match number of names!");
            }

            return(new VariableDeclarationTranslationUnit()
            {
                names = names,
                type = type,
                expressions = expressions,
                shouldRenderDeclarationKeyword = shouldRenderDeclarationKeyword
            });
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyDefinitionTranslationUnit"/> class.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="returnType"></param>
        /// <param name="visibility"></param>
        protected PropertyDefinitionTranslationUnit(ITranslationUnit name, ITranslationUnit returnType, VisibilityToken visibility)
            : base(name, visibility)
        {
            this.type = returnType;

            this.hasGet = true;
            this.hasSet = true;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConditionalStatementTranslationUnit"/> class.
 /// </summary>
 /// <param name="nestingLevel"></param>
 protected ConditionalStatementTranslationUnit(int nestingLevel)
     : base(nestingLevel)
 {
     this.testExpressions = null;
     this.bodies = null;
     this.lastBody = null;
     this.hasFinalElse = false;
 }
예제 #33
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EnumTranslationUnit"/> class.
        /// </summary>
        protected EnumTranslationUnit()
            : base()
        {
            this.Name = IdentifierTranslationUnit.Empty;
            this.members = new List<ITranslationUnit>();

            this.injectedBefore = null;
        }
예제 #34
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ModuleTranslationUnit"/> class.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="nestingLevel"></param>
        protected ModuleTranslationUnit(ITranslationUnit name, int nestingLevel)
            : base(nestingLevel)
        {
            this.classes = new List<ITranslationUnit>();
            this.interfaces = new List<ITranslationUnit>();

            this.name = name;
        }
예제 #35
0
        /// <summary>
        /// Copy initializes a new instance of the <see cref="EnumTranslationUnit"/> class.
        /// </summary>
        /// <param name="other"></param>
        /// <remarks>
        /// For testability.
        /// </remarks>
        public EnumTranslationUnit(EnumTranslationUnit other)
            : base(other)
        {
            this.Name = other.Name;
            this.members = other.members;

            this.injectedBefore = other.injectedBefore;
        }
예제 #36
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyDefinitionTranslationUnit"/> class.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="returnType"></param>
        /// <param name="visibility"></param>
        protected PropertyDefinitionTranslationUnit(ITranslationUnit name, ITranslationUnit returnType, ModifierTokens visibility)
            : base(name, visibility)
        {
            this.type = returnType;

            this.hasGet = true;
            this.hasSet = true;
        }
        protected static bool ShouldRenderSemicolon(ITranslationUnit statement)
        {
            var type = statement.GetType();

            var shouldNotRenderSemicolon = type == typeof(ConditionalStatementTranslationUnit);

            return(!shouldNotRenderSemicolon);
        }
예제 #38
0
        /// <summary>
        /// Copy initializes a new instance of the <see cref="EnumTranslationUnit"/> class.
        /// </summary>
        /// <param name="other"></param>
        /// <remarks>
        /// For testability.
        /// </remarks>
        public EnumTranslationUnit(EnumTranslationUnit other)
            : base(other)
        {
            this.Name    = other.Name;
            this.members = other.members;

            this.injectedBefore = other.injectedBefore;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="statement"></param>
        public override void AddStatement(ITranslationUnit statement)
        {
            if (statement.GetType() != typeof(ReferenceTranslationUnit))
            {
                throw new ArgumentException($"Expecting type: {typeof(ReferenceTranslationUnit).Name}", nameof(statement));
            }

            base.AddStatement(statement);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="VariableDeclarationTranslationUnit"/> class.
        /// </summary>
        /// <param name="nestingLevel"></param>
        protected VariableDeclarationTranslationUnit(int nestingLevel)
            : base(nestingLevel)
        {
            this.type = null;
            this.names = null;
            this.expressions = null;

            this.shouldRenderDeclarationKeyword = true;
        }
 /// <summary>
 /// Copy initializes a new instance of the <see cref="MethodDeclarationTranslationUnit"/> class.
 /// </summary>
 /// <param name="other"></param>
 /// <remarks>
 /// For testability.
 /// </remarks>
 public PropertyDeclarationTranslationUnit(PropertyDeclarationTranslationUnit other)
     : base((MemberTranslationUnit)other)
 {
     this.getStatements = other.getStatements;
     this.setStatements = other.setStatements;
     this.type = other.type;
     this.hasGet = other.hasGet;
     this.hasSet = other.hasSet;
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="translationUnit"></param>
        public void AddArgument(ITranslationUnit translationUnit)
        {
            if (translationUnit == null)
            {
                throw new ArgumentNullException(nameof(translationUnit));
            }

            ((List<ITranslationUnit>)this.arguments).Add(translationUnit);
        }
        /// <summary>
        /// This builder has a sole purpose: allowing the ability to create expressions that 
        /// translates in a particular desired way. This is more a utility mechanism!
        /// </summary>
        /// <param name="translationUnit"></param>
        /// <returns></returns>
        internal static ExpressionTranslationUnit Create(ITranslationUnit translationUnit)
        {
            if (translationUnit == null)
            {
                throw new ArgumentNullException(nameof(translationUnit));
            }

            return new ExpressionTranslationUnit(translationUnit);
        }
예제 #44
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static ModuleTranslationUnit Create(ITranslationUnit name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            return new ModuleTranslationUnit(name, AutomaticNestingLevel);
        }
        protected ITranslationUnit type; // Can be null

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Copy initializes a new instance of the <see cref="VariableDeclarationTranslationUnit"/> class.
        /// </summary>
        /// <param name="other"></param>
        /// <remarks>
        /// For testability.
        /// </remarks>
        public VariableDeclarationTranslationUnit(VariableDeclarationTranslationUnit other)
            : base(other)
        {
            this.type = other.type;
            this.names = other.names;
            this.expressions = other.expressions;

            this.shouldRenderDeclarationKeyword = other.shouldRenderDeclarationKeyword;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="InterfaceDeclarationTranslationUnit"/> class.
        /// </summary>
        protected InterfaceDeclarationTranslationUnit()
            : base()
        {
            this.Name = IdentifierTranslationUnit.Empty;
            this.Interfaces = new List<ITranslationUnit>();

            this.signatures = new List<ITranslationUnit>();

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

            this.signatures = other.signatures;

            this.injectedBefore = other.injectedBefore;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="type"></param>
        /// <param name="castee"></param>
        /// <returns></returns>
        public static ParenthesizedExpressionTranslationUnit Create(ITranslationUnit wrappedExpression)
        {
            if (wrappedExpression == null)
            {
                throw new ArgumentNullException(nameof(wrappedExpression));
            }

            return new ParenthesizedExpressionTranslationUnit(AutomaticNestingLevel)
            {
                WrappedExpression = wrappedExpression
            };
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyDeclarationTranslationUnit"/> class.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="returnType"></param>
        /// <param name="visibility"></param>
        protected PropertyDeclarationTranslationUnit(ITranslationUnit name, ITranslationUnit returnType, VisibilityToken visibility)
            : base(name, visibility)
        {
            // We create empty groups
            this.getStatements = StatementsGroupTranslationUnit.Create();
            this.setStatements = StatementsGroupTranslationUnit.Create();

            this.type = returnType;

            this.hasGet = true;
            this.hasSet = true;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="member"></param>
        /// <param name="accessMethod"></param>
        /// <returns></returns>
        public static InvokationExpressionTranslationUnit Create(ITranslationUnit invokeeName)
        {
            if (invokeeName == null)
            {
                throw new ArgumentNullException(nameof(invokeeName));
            }

            return new InvokationExpressionTranslationUnit(AutomaticNestingLevel)
            {
                expression = invokeeName
            };
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="statement"></param>
        public virtual void AddStatement(ITranslationUnit statement)
        {
            if (statement == null)
            {
                throw new ArgumentNullException(nameof(statement));
            }

            // Group of statements does not add one more nesting level, so we do not need to
            // increase the nesting level for each added unit.

            ((List<ITranslationUnit>)this.statements).Add(statement);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="type"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static VariableDeclarationTranslationUnit Create(ITranslationUnit type, ITranslationUnit name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            return new VariableDeclarationTranslationUnit()
            {
                name = name,
                type = type
            };
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="visibility"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static new EmptyInterfaceDefinitionTranslationUnit Create(VisibilityToken visibility, ITranslationUnit name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name), "Interface name cannot be null!");
            }

            return new EmptyInterfaceDefinitionTranslationUnit()
            {
                Visibility = visibility,
                Name = name
            };
        }
        /// <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>
        /// 
        /// </summary>
        /// <param name="visibility"></param>
        /// <param name="name"></param>
        /// <param name="baseClassName"></param>
        /// <returns></returns>
        public static new ClassDefinitionTranslationUnit Create(VisibilityToken visibility, ITranslationUnit name, ITranslationUnit baseClassName)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name), "Class name cannot be null!");
            }

            return new ClassDefinitionTranslationUnit()
            {
                Visibility = visibility,
                Name = name,
                BaseClassName = baseClassName
            };
        }
예제 #56
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="translationUnit"></param>
        public void AddContent(ITranslationUnit translationUnit)
        {
            if (translationUnit == null)
            {
                throw new ArgumentNullException(nameof(translationUnit));
            }

            if (translationUnit as NestedElementTranslationUnit != null)
            {
                ((NestedElementTranslationUnit)translationUnit).NestingLevel = NestingLevel + 1;
            }

            ((List<ITranslationUnit>)this.content).Add(translationUnit);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ClassDeclarationTranslationUnit"/> class.
        /// </summary>
        protected ClassDeclarationTranslationUnit()
            : base()
        {
            this.Name = IdentifierTranslationUnit.Empty;
            this.BaseClassName = null;
            this.Interfaces = new List<ITranslationUnit>();

            this.memberDeclarations = new List<ITranslationUnit>();
            this.constructorDeclarations = new List<ITranslationUnit>();
            this.propertyDeclarations = new List<ITranslationUnit>();
            this.methodDeclarations = new List<ITranslationUnit>();

            this.injectedBefore = null;
        }
예제 #58
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="visibility"></param>
        /// <param name="statements"></param>
        /// <returns></returns>
        public static ITranslationUnit BuildConstructorTranslationUnit(VisibilityToken visibility, ITranslationUnit[] statements = null)
        {
            ConstructorDeclarationTranslationUnit translationUnit = ConstructorDeclarationTranslationUnit.Create(visibility);

            if (statements != null)
            {
                foreach (ITranslationUnit statement in statements)
                {
                    translationUnit.AddStatement(statement);
                }
            }

            return translationUnit;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="visibility"></param>
        /// <param name="returnType"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static new MethodDeclarationTranslationUnit Create(
            VisibilityToken visibility, ITranslationUnit returnType, ITranslationUnit name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            return new MethodDeclarationTranslationUnit()
            {
                Visibility = visibility,
                Name = name,
                ReturnType = returnType
            };
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="type"></param>
        /// <param name="castee"></param>
        /// <returns></returns>
        public static CastExpressionTranslationUnit Create(ITranslationUnit type, ITranslationUnit castee)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }
            if (castee == null)
            {
                throw new ArgumentNullException(nameof(castee));
            }

            return new CastExpressionTranslationUnit(AutomaticNestingLevel)
            {
                Type = type,
                Castee = castee
            };
        }