예제 #1
0
 public void PrintCode(CodeWriter cp)
 {
     cp.BeginLine();
     foreach (CodeCustomAttribute a in customAttributes)
     {
         a.PrintCode(cp);
     }
     cp.BeginLine();
     if (IsStatic)
     {
         cp.Write("static ");
     }
     if (IsPublic)
     {
         cp.Write("public ");
     }
     if (returnType != null)
     {
         cp.Write(returnType + " ");
     }
     cp.Write(name);
     if (parameterTypes.Length > 0)
     {
         cp.Write(name + " [");
         for (int n = 0; n < parameterTypes.Length; n++)
         {
             if (n > 0)
             {
                 cp.Write(", ");
             }
             cp.Write(parameterTypes[n] + " arg" + n);
         }
         cp.Write("]");
     }
     cp.Write(" {");
     cp.EndLine();
     cp.Indent();
     cp.WriteLineInd("get {");
     get_builder.PrintCode(cp);
     cp.WriteLineUnind("}");
     cp.WriteLine("set {");
     set_builder.PrintCode(cp);
     cp.WriteLine("}");
     cp.WriteLineUnind("}");
 }
예제 #2
0
        public override void PrintCode(CodeWriter cp)
        {
            if (trueBlock == null)
            {
                return;
            }

            cp.Write("if (");
            condition.PrintCode(cp);
            cp.Write(") {");
            cp.EndLine();
            cp.Indent();
            trueBlock.PrintCode(cp);
            cp.Unindent();
            cp.BeginLine().Write("}");
            if (falseBlock != null)
            {
                cp.EndLine();
                cp.WriteLineInd("else {");
                falseBlock.PrintCode(cp);
                cp.Unindent();
                cp.BeginLine().Write("}");
            }
        }
예제 #3
0
        public virtual void PrintCode(CodeWriter cp)
        {
            cp.BeginLine();
            foreach (CodeCustomAttribute a in customAttributes)
            {
                a.PrintCode(cp);
            }
            if ((methodBase.Attributes & MethodAttributes.Static) != 0)
            {
                cp.Write("static ");
            }
            if ((methodBase.Attributes & MethodAttributes.Public) != 0)
            {
                cp.Write("public ");
            }
            if (returnType != null)
            {
                cp.Write(returnType + " ");
            }
            cp.Write(name + " (");
            for (int n = 0; n < parameterTypes.Length; n++)
            {
                if (n > 0)
                {
                    cp.Write(", ");
                }
                cp.Write(parameterTypes[n] + " arg" + n);
            }
            cp.Write(")");
            cp.EndLine();
            cp.WriteLineInd("{");

            builder.PrintCode(cp);

            cp.WriteLineUnind("}");
        }
예제 #4
0
파일: CodeMethod.cs 프로젝트: nlhepler/mono
		public virtual void PrintCode (CodeWriter cp)
		{
			cp.BeginLine ();
			foreach (CodeCustomAttribute a in customAttributes)
				a.PrintCode (cp);
			if ((methodBase.Attributes & MethodAttributes.Static) != 0)
				cp.Write ("static ");
			if ((methodBase.Attributes & MethodAttributes.Public) != 0)
				cp.Write ("public ");
			if (returnType != null) cp.Write (returnType + " ");
			cp.Write (name + " (");
			for (int n=0; n<parameterTypes.Length; n++) {
				if (n > 0) cp.Write (", ");
				cp.Write (parameterTypes[n] + " arg" + n);
			}
			cp.Write (")");
			cp.EndLine ();
			cp.WriteLineInd ("{");
			
			builder.PrintCode (cp);
			
			cp.WriteLineUnind ("}");
		}
		public void PrintCode (CodeWriter cp)
		{
			cp.BeginLine ();
			foreach (CodeCustomAttribute a in customAttributes)
				a.PrintCode (cp);
			cp.BeginLine ();
			if (IsStatic)
				cp.Write ("static ");
			if (IsPublic)
				cp.Write ("public ");
			if (returnType != null) cp.Write (returnType + " ");
			cp.Write (name);
			if (parameterTypes.Length > 0) {
				cp.Write (name + " [");
				for (int n=0; n<parameterTypes.Length; n++) {
					if (n > 0) cp.Write (", ");
					cp.Write (parameterTypes[n] + " arg" + n);
				}
				cp.Write ("]");
			}
			cp.Write (" {");
			cp.EndLine ();
			cp.Indent ();
			cp.WriteLineInd ("get {");
			get_builder.PrintCode (cp);
			cp.WriteLineUnind ("}");
			cp.WriteLine ("set {");
			set_builder.PrintCode (cp);
			cp.WriteLine ("}");
			cp.WriteLineUnind ("}");
		}
예제 #6
0
		public override void PrintCode (CodeWriter cp)
		{
			if (trueBlock == null) return;
			
			cp.Write ("if (");
			condition.PrintCode (cp);
			cp.Write (") {");
			cp.EndLine ();
			cp.Indent ();
			trueBlock.PrintCode (cp);
			cp.Unindent ();
			cp.BeginLine ().Write ("}");
			if (falseBlock != null) {
				cp.EndLine ();
				cp.WriteLineInd ("else {");
				falseBlock.PrintCode (cp);
				cp.Unindent ();
				cp.BeginLine ().Write ("}");
			}
		}