Example #1
0
        public void Write(ScriptWriter writer)
        {
            writer.BeginScope();

            for (int x = 0; x < instructions.Count; x++)
            {
                writer.WriteFullLine(instructions[x]);
            }

            writer.EndScope();
        }
        public override void Write(ScriptWriter writer)
        {
            writer.WriteFullLineFormat("{0} {1} {2}", IsPublic ? "public":"private", TypeName, Name);

            // write property getter/setter
            writer.BeginScope();

            if (getterBody != null)
            {
                writer.WriteFullLine("get");
                getterBody.Write(writer);
            }

            if (setterBody != null)
            {
                writer.WriteFullLine("set");
                setterBody.Write(writer);
            }

            writer.EndScope();
        }
        public void Write(ScriptWriter writer)
        {
            // method signature
            {
                writer.BeginWrite();

                writer.Write("public ");

                if (IsStatic)
                {
                    writer.Write("static ");
                }

                if (!IsConstructor)
                {
                    writer.WriteFormat("{0} ", ReturnType);
                }

                writer.Write(Name);

                // write parameters
                writer.Write("(");
                for (int x = 0; x < parameters.Count; x++)
                {
                    writer.WriteFormat("{0} {1}", parameters[x].TypeName, parameters[x].Name);

                    if (x + 1 < parameters.Count)
                    {
                        writer.Write(", ");
                    }
                }
                writer.Write(")");
                writer.EndWrite();
            }

            // write method definition
            instructions.Write(writer);

            writer.WriteFullLine(string.Empty);
        }