Ejemplo n.º 1
0
        public void Export(TextWriter writer, int intent)
        {
            writer.WriteIndent(intent);
            string returnTypeName = ReturnType.GetTypeNestedName(DeclaringType);

            writer.Write("{0} override {1} {2}(", Keyword, returnTypeName, Name);
            for (int i = 0; i < Parameters.Count; i++)
            {
                ScriptExportParameter parameter = Parameters[i];
                parameter.Export(writer, intent);
                if (i < Parameters.Count - 1)
                {
                    writer.Write(", ");
                }
            }
            writer.WriteLine(")");
            writer.WriteIndent(intent);
            writer.WriteLine("{");
            foreach (ScriptExportParameter parameter in Parameters)
            {
                if (parameter.ByRef == ScriptExportParameter.ByRefType.Out)
                {
                    writer.WriteIndent(intent + 1);
                    writer.WriteLine("{0} = default({1});", parameter.Name, parameter.Type.GetTypeNestedName(DeclaringType));
                }
            }
            if (ReturnType.TypeName != MonoUtils.CVoidName)
            {
                writer.WriteIndent(intent + 1);
                writer.WriteLine("return default({0});", returnTypeName);
            }
            writer.WriteIndent(intent);
            writer.WriteLine("}");
        }
 public sealed override void Export(TextWriter writer, int intent)
 {
     writer.WriteIndent(intent);
     writer.Write("{0} delegate {1} {2}(", Keyword, Return.NestedName, TypeName);
     for (int i = 0; i < Parameters.Count; i++)
     {
         ScriptExportParameter parameter = Parameters[i];
         parameter.Export(writer, intent);
         if (i < Parameters.Count - 1)
         {
             writer.Write(',');
         }
     }
     writer.WriteLine(");");
 }
        public override void Export(TextWriter writer, int intent)
        {
            writer.WriteIndent(intent);
            writer.Write("{0} {1}(", Keyword, DeclaringType.CleanName);
            for (int i = 0; i < Parameters.Count; i++)
            {
                ScriptExportParameter parameter = Parameters[i];
                parameter.Export(writer, intent);
                if (i < Parameters.Count - 1)
                {
                    writer.Write(", ");
                }
            }

            if (Base != null && Base.Parameters.Count != 0)
            {
                writer.Write(") : base(");
                for (int i = 0; i < Base.Parameters.Count; i++)
                {
                    ScriptExportParameter parameter = Base.Parameters[i];
                    writer.Write("default({0})", parameter.Type.GetTypeNestedName(DeclaringType));
                    if (i < Base.Parameters.Count - 1)
                    {
                        writer.Write(", ");
                    }
                }
            }
            else if (DeclaringType.IsStruct)
            {
                // all field of a value type must be initialized
                writer.Write(") : this(");
            }

            writer.WriteLine(")");
            writer.WriteIndent(intent);
            writer.WriteLine("{");
            writer.WriteIndent(intent);
            writer.WriteLine("}");
        }