public void WriteConditionalEmit(CodeScopeStatement con, InstructionForm overridenForm, bool ignoreOtherOverrides = false)
		{
			if (Conditions.Count == 0)
				throw new Exception("There are no conditions to the override!");
			if (!ignoreOtherOverrides && CanGenSegmentSwitch(overridenForm))
			{
				CodeSwitchStatement sw = new CodeSwitchStatement(
					new CodeFieldReferenceExpression(
						new CodeThisReferenceExpression(),
						overridenForm.GetArgName(FieldTypeRegistry.Segment.ID, 1, Conditions[0].ArgIndexToCheck)
					)
				);
				for (int i = 0; i < overridenForm.Overrides.Count; i++)
				{
					CodeCaseStatement cs = new CodeCaseStatement(
						new CodeFieldReferenceExpression(
							StaticTypeReferences.SegmentExpression,
							overridenForm.Overrides[i].Conditions[0].RegisterToCompareTo
						)
					);
					CodeScopeStatement cst = new CodeScopeStatement();
					overridenForm.Overrides[i].NewForm.WriteEmit(cst, true);
					cst.Statements.Add(new CodeBreakStatement());
					cs.Statements.Add(cst);
					sw.Cases.Add(cs);
				}
				CodeDefaultCaseStatement defStat = new CodeDefaultCaseStatement();
				CodeScopeStatement defCont = new CodeScopeStatement();
				overridenForm.WriteEmit(defCont, true);
				defStat.Statements.Add(defCont);
				if (overridenForm.WriteOperations[0].Type != WriteOperationType.Throw)
				{
					defStat.Statements.Add(new CodeBreakStatement());
				}
				sw.Cases.Add(defStat);
				con.Statements.Add(sw);
			}
			else
			{
				CodeScopeStatement tCont = new CodeScopeStatement();
				CodeScopeStatement fCont = new CodeScopeStatement();
				CodeExpression condition = Conditions[0].GetConditionExpression(this, overridenForm);
				for (int i = 1; i < Conditions.Count; i++)
				{
					condition = new CodeBinaryOperatorExpression(
						condition, 
						CodeBinaryOperatorType.BooleanAnd, 
						Conditions[i].GetConditionExpression(this, overridenForm)
					);
				}
				CodeConditionStatement condStat = new CodeConditionStatement(condition, new CodeStatement[] { tCont });
				NewForm.WriteEmit(tCont, true);
				if (!ignoreOtherOverrides)
				{
					condStat.FalseStatements.Add(fCont);
					if (overridenForm.Overrides.Count > 1)
					{
						// If we've gotten here, we know that we are the override at index 0.
						for (int i = 1; i < overridenForm.Overrides.Count; i++)
						{
							CodeScopeStatement eICont = new CodeScopeStatement();
							overridenForm.Overrides[i].WriteConditionalEmit(eICont, overridenForm, true);
							fCont.Statements.Add(eICont);
							fCont = new CodeScopeStatement();
							((CodeConditionStatement)eICont.Statements[0]).FalseStatements.Add(fCont);
						}
					}
					overridenForm.WriteEmit(fCont, true);
				}
				con.Statements.Add(condStat);
			}
		}
		protected override void GenerateConditionStatement(CodeConditionStatement statement)
		{
			TextWriter output = base.Output;
			output.Write("if (");
			base.GenerateExpression(statement.Condition);
			output.Write(")");
			this.OutputStartBrace();
			base.Indent++;
			base.GenerateStatements(statement.TrueStatements);
			base.Indent--;
			CodeStatementCollection falseStatements = statement.FalseStatements;
			bool genned = false;
			if (falseStatements.Count > 0)
			{
				output.Write('}');
				if (base.Options.ElseOnClosing)
				{
					output.Write(' ');
				}
				else
				{
					output.WriteLine();
				}
				output.Write("else ");
				if (falseStatements.Count == 1)
				{
					CodeStatement stat = falseStatements[0];
					CheckSingleCondition:
					if (stat is CodeScopeStatement)
					{
						if (((CodeScopeStatement)stat).Statements.Count == 1)
						{
							stat = ((CodeScopeStatement)stat).Statements[0];
							goto CheckSingleCondition;
						}
					}
					if (stat is CodeConditionStatement)
					{
						genned = true;
						GenerateStatement(stat);
					}
				}
				if (!genned)
				{
					this.OutputStartBrace();
					base.Indent++;
					base.GenerateStatements(falseStatements);
					base.Indent--;
				}
			}
			if (!genned)
			{
				output.WriteLine('}');
			}
		}
		public void WriteToString(CodeScopeStatement con)
		{
			if (Arg1.ArgType == InstructionArgType.None)
			{
				con.Statements.Add(
					new CodeMethodReturnStatement(
						new CodePrimitiveExpression(Mnemonic)
					)
				);
			}
			else if (Arg2.ArgType == InstructionArgType.None)
			{
				if (ExcludeCondition != null)
				{
					CodeConditionStatement f = new CodeConditionStatement(ExcludeCondition.GetConditionExpression(this));
					f.TrueStatements.Add(
						new CodeMethodReturnStatement(
							new CodeBinaryOperatorExpression(
								new CodePrimitiveExpression(Mnemonic + " "),
								CodeBinaryOperatorType.StringConcat,
								Arg1.ArgType.GetToStringForArg(this, 0)
							)
						)
					);
					f.FalseStatements.Add(
						new CodeMethodReturnStatement(
							new CodePrimitiveExpression(Mnemonic)
						)
					);
					con.Statements.Add(f);
				}
				else
				{
					
					con.Statements.Add(
						new CodeMethodReturnStatement(
							new CodeBinaryOperatorExpression(
								new CodePrimitiveExpression(Mnemonic + " "),
								CodeBinaryOperatorType.StringConcat,
								Arg1.ArgType.GetToStringForArg(this, 0)
							)
						)
					);
				}
			}
			else if (Arg3.ArgType == InstructionArgType.None)
			{
				con.Statements.Add(
					new CodeMethodReturnStatement(
						new CodeBinaryOperatorExpression(
							new CodePrimitiveExpression(Mnemonic + " "),
							CodeBinaryOperatorType.StringConcat,
							new CodeBinaryOperatorExpression(
								Arg1.ArgType.GetToStringForArg(this, 0),
								CodeBinaryOperatorType.StringConcat,
								new CodeBinaryOperatorExpression(
									new CodePrimitiveExpression(", "),
									CodeBinaryOperatorType.StringConcat,
									Arg2.ArgType.GetToStringForArg(this, 1)
								)
							)
						)
					)
				);
			}
			else
			{
				con.Statements.Add(
					new CodeMethodReturnStatement(
						new CodeBinaryOperatorExpression(
							new CodePrimitiveExpression(Mnemonic + " "),
							CodeBinaryOperatorType.StringConcat,
							new CodeBinaryOperatorExpression(
								Arg1.ArgType.GetToStringForArg(this, 0),
								CodeBinaryOperatorType.StringConcat,
								new CodeBinaryOperatorExpression(
									new CodeBinaryOperatorExpression(
										new CodePrimitiveExpression(", "),
										CodeBinaryOperatorType.StringConcat,
										Arg2.ArgType.GetToStringForArg(this, 1)
									),
									CodeBinaryOperatorType.StringConcat,
									new CodeBinaryOperatorExpression(
										new CodePrimitiveExpression(", "),
										CodeBinaryOperatorType.StringConcat,
										Arg3.ArgType.GetToStringForArg(this, 2)
									)
								)
							)
						)
					)
				);
			}
		}