示例#1
0
        /// <inheritdoc/>
        public override void VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration)
        {
            bool            isStatic = (constructorDeclaration.Modifiers & Modifiers.Static) != 0;
            TypeDeclaration type     = constructorDeclaration.Parent as TypeDeclaration;
            String          name     = null;

            if (type != null && type.Name != constructorDeclaration.Name)
            {
                name = type.NameToken.Name;
            }
            else
            {
                name = constructorDeclaration.NameToken.Name;
            }
            Formatter.AppendIndented(String.Empty);
            if (!isStatic)
            {
                IType type2 = constructorDeclaration.GetResolveResult().Type;
                WriteMethodHeader(name, constructorDeclaration.Parameters);
                Formatter.AppendLine(";");
            }
            else
            {
                Formatter.Append("static Boolean ");
                Formatter.AppendName(name);
                Formatter.AppendLine("_Static();");
                Formatter.AppendIndented("static Boolean ");
                Formatter.AppendName(name);
                Formatter.AppendLine("_Initilized;");
            }
            HadConstructor = true;
            if (constructorDeclaration.Parameters.Count == 0)
            {
                HadDefaultConstructor = true;
            }
        }
示例#2
0
 /// <inheritdoc/>
 public override void VisitVariableInitializer(VariableInitializer variableInitializer)
 {
     Formatter.AppendName(variableInitializer.Name);
 }
示例#3
0
 /// <inheritdoc/>
 protected override void WriteMethodHeader(String methodName, AstNodeCollection <ParameterDeclaration> parameters)
 {
     Formatter.AppendName(methodName);
     WriteCommaSeparatedListInParenthesis(parameters);
 }