public FieldDeclarationTranslation(FieldDeclarationSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
 {
     Declaration = syntax.Declaration.Get<VariableDeclarationTranslation>(this);
     Declaration.ExcludeVar = true;
     Modifiers = syntax.Modifiers.Get(this);
     Modifiers.ConstantToStatic = true;                     
 }
 public BaseMethodDeclarationTranslation(BaseMethodDeclarationSyntax syntax,  SyntaxTranslation parent) : base(syntax, parent)
 {
     ParameterList = syntax.ParameterList.Get<ParameterListTranslation>(this);
     Modifiers = syntax.Modifiers.Get(this);
     Body = syntax.Body.Get<BlockTranslation>(this);
     SemicolonToken = syntax.SemicolonToken.Get(this);
 }
 public ClassStructDeclarationTranslation(TypeDeclarationSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
 {
     if (syntax.BaseList != null)
     {
         BaseList = syntax.BaseList.Get<BaseListTranslation>(this);                
     }           
 }
 public ClassDeclarationTranslation(ClassDeclarationSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
 {
     var constructor = Members.GetEnumerable<ConstructorDeclarationTranslation>().FirstOrDefault();
     if (constructor == null)
     {
         return;
     }
 }
 public ParameterTranslation(ParameterSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
 {
     Type = syntax.Type.Get<TypeTranslation>(this);
     Identifier = syntax.Identifier.Get(this);
     Modifiers = syntax.Modifiers.Get(this);
     Default = syntax.Default.Get<EqualsValueClauseTranslation>(this);
    
 }
        public BasePropertyDeclarationTranslation(BasePropertyDeclarationSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
        {
            Type = syntax.Type.Get<TypeTranslation>(this);
            AccessorList = syntax.AccessorList.Get<AccessorListTranslation>(this);
            Modifiers = syntax.Modifiers.Get(this);

            AccessorList.SetModifier(Modifiers);
        }
 public MethodDeclarationTranslation(MethodDeclarationSyntax syntax, SyntaxTranslation parent)
     : base(syntax, parent)
 {
     ReturnType = syntax.ReturnType.Get<TypeTranslation>(this);
     SemicolonToken = syntax.SemicolonToken.Get(this);
     Identifier = syntax.Identifier.Get(this);
     TypeParameterList = syntax.TypeParameterList.Get<TypeParameterListTranslation>(this);
     ConstraintClauses = syntax.ConstraintClauses.Get<TypeParameterConstraintClauseSyntax, TypeParameterConstraintClauseTranslation>(this);
 }
        public InterfaceDeclarationTranslation(InterfaceDeclarationSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
        {

            if (syntax.BaseList != null)
            {
                BaseList = syntax.BaseList.Get<BaseListTranslation>(this);
                BaseList.IsForInterface = true;
            }
        }
        public ConstructorDeclarationTranslation(ConstructorDeclarationSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
        {
            Identifier = syntax.Identifier.Get(this);

            if (syntax.Initializer != null)
            {
                Initializer = syntax.Initializer.Get<ConstructorInitializerTranslation>(this);
            }
        }
 public InvocationExpressionTranslation(InvocationExpressionSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
 {
     Expression = syntax.Expression.Get<ExpressionTranslation>(this);
     ArgumentList = syntax.ArgumentList.Get<ArgumentListTranslation>(this);
     if (Expression is MemberAccessExpressionTranslation)
     {
         var memberAccess = (MemberAccessExpressionTranslation)Expression;
         memberAccess.IsInInvocation = true;
     }
 }
        public UsingStatementTranslation(UsingStatementSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
        {
            Declaration = syntax.Declaration.Get<VariableDeclarationTranslation>(this);
            Expression = syntax.Expression.Get<ExpressionTranslation>(this);
            Statement = syntax.Statement.Get<StatementTranslation>(this);

            //if(Expression != null)
            //{
            //    throw new Exception("only support Declaration");
            //}
        }
        //public StructDeclarationTranslation() { }
        public StructDeclarationTranslation(StructDeclarationSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
        {              
            if(BaseList == null)
            {
                BaseList = new BaseListTranslation();
                BaseList.Parent = this;
                BaseList.Types = new SeparatedSyntaxListTranslation<BaseTypeSyntax, BaseTypeTranslation>();
                BaseList.Types.Parent = BaseList;
            }

            //BaseList.Types.Add(new BaseTypeTranslation() { SyntaxString = TC.IStruct });
        }
        public MemberAccessExpressionTranslation(MemberAccessExpressionSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
        {
            Expression = syntax.Expression.Get<ExpressionTranslation>(this);
            Name = syntax.Name.Get<SimpleNameTranslation>(this);

            var simpleName = Name as SimpleNameTranslation;

            if (simpleName != null)
            {
                simpleName.DetectApplyThis = false;
            }
        }
        public ForStatementTranslation(ForStatementSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
        {
            //KeyValuePair<int, string>? a = null;            
            //var b = ((bool?)null)?.Equals(false) ?? true ? false ? true : false :true;

            //string str = "\{ ("\{( "(\{ "{}" })" )}") }";

            Condition = syntax.Condition.Get<ExpressionTranslation>(this);
            Declaration = syntax.Declaration.Get<VariableDeclarationTranslation>(this);
            Incrementors = syntax.Incrementors.Get<ExpressionSyntax, ExpressionTranslation>(this);
            Initializers = syntax.Initializers.Get<ExpressionSyntax, ExpressionTranslation>(this);
            Statement = syntax.Statement.Get<StatementTranslation>(this);
        }
        public VariableDeclarationTranslation(VariableDeclarationSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
        {
            Type = syntax.Type.Get<TypeTranslation>(this);
            Variables = syntax.Variables.Get<VariableDeclaratorSyntax, VariableDeclaratorTranslation>(this);
            if (!syntax.Type.IsVar)
            {
                Variables.GetEnumerable().First().FirstType = Type;
            }

            foreach (var item in Variables.GetEnumerable())
            {
                item.KnownType = Type;
            }
        }
        public GenericNameTranslation(GenericNameSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
        {
            TypeArgumentList = syntax.TypeArgumentList.Get<TypeArgumentListTranslation>(this);
            string name = syntax.Identifier.ToString();
            switch (name)
            {
                case "Func":
                    Func = new FunctionTypeGenericNameTranslation(this);
                    break;
                case "Predicate":
                    Func = new PredicateGenericNameTranslation(this);
                    break;
                case "Action":
                    Func = new ActionTypeGenericNameTranslation(this);
                    break;
                case "Comparison":
                    Func = new ComparisonGenericNameTranslation(this);
                    break;
            }

        }
        public QualifiedNameTranslation(QualifiedNameSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
        {
            Left = syntax.Left.Get<NameTranslation>(this);
            Right = syntax.Right.Get<SimpleNameTranslation>(this);

            var genericTranslation = Left as GenericNameTranslation;
            if (genericTranslation != null)
            {
                ((GenericNameTranslation)Left).ExcludeTypeParameter = true;

            }

            var simpleName = Right as SimpleNameTranslation;
            if (simpleName != null)
            {
                simpleName.DetectApplyThis = false;
                var identifierName = simpleName as IdentifierNameTranslation;
                if (genericTranslation != null && identifierName!=null)
                {
                    identifierName.TypeArgumentList = genericTranslation.TypeArgumentList;
                }
                
            }
        }
 public EnumDeclarationTranslation(EnumDeclarationSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
 {
     Members = syntax.Members.Get<EnumMemberDeclarationSyntax, EnumMemberDeclarationTranslation>(this);
     Members.IsNewLine = true;
 }
 public InstanceExpressionTranslation(InstanceExpressionSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
 {
 }
 public PostfixUnaryExpressionTranslation(PostfixUnaryExpressionSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
 {
     Operand = syntax.Operand.Get<ExpressionTranslation>(this);
 }
 public CSharpSyntaxTranslation(SyntaxNode syntax, SyntaxTranslation parent) : base(syntax, parent)
 {
 }
        public TypeParameterConstraintTranslation(TypeParameterConstraintSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
        {

        }
 public ObjectCreationExpressionTranslation(ObjectCreationExpressionSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
 {
     ArgumentList = syntax.ArgumentList.Get<ArgumentListTranslation>(this);
     Initializer = syntax.Initializer.Get<InitializerExpressionTranslation>(this);
     Type = syntax.Type.Get<TypeTranslation>(this);
 }
 public GotoStatementTranslation(GotoStatementSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
 {
     
 }
 public BaseParameterListTranslation(BaseParameterListSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
 {
     Parameters = syntax.Parameters.Get<ParameterSyntax, ParameterTranslation>(this);
 }
        public TokenTranslation(SyntaxToken token, SyntaxTranslation parent) : base(null, parent)
        {
            this.token = token;

        }
 public GenericTranslation(SyntaxNode syntax,  SyntaxTranslation parent) : base(syntax, parent)
 {
 }
 public ForEachStatementTranslation(ForEachStatementSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
 {
     Expression = syntax.Expression.Get<ExpressionTranslation>(this);
     Statement = syntax.Statement.Get<StatementTranslation>(this);
     Type = syntax.Type.Get<TypeTranslation>(this);
 }
 public BaseTypeDeclarationTranslation(BaseTypeDeclarationSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
 {
     Modifiers = syntax.Modifiers.Get(this);
     AttributeList = syntax.AttributeLists.Get<AttributeListSyntax, AttributeListTranslation>(this);
 }
 public CaseSwitchLabelTranslation(CaseSwitchLabelSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
 {
     Value = syntax.Value.Get<ExpressionTranslation>(this);
 }
 public ArrayCreationExpressionTranslation(ArrayCreationExpressionSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
 {
     Type = syntax.Type.Get<ArrayTypeTranslation>(this);
     Initializer = syntax.Initializer.Get<InitializerExpressionTranslation>(this);
 }