public DynaIterationStatement(DynaStatement InitValue, DynaExpression LoopCondition, DynaStatement ValueIncrement, DynaStatement[] LoopStatements) { switch (InitValue.GetType().Name.ToLower()) { case "dynaiterationstatement": this._initValue = (InitValue as DynaIterationStatement).Statement; break; case "dynaassignmentstatement": this._initValue = (InitValue as DynaAssignmentStatement).Statement; break; case "dynaconditionstatement": this._initValue = (InitValue as DynaConditionStatement).Statement; break; case "dynareturnstatement": this._initValue = (InitValue as DynaReturnStatement).Statement; break; case "dynadeclarationstatement": this._initValue = (InitValue as DynaDeclarationStatement).Statement; break; case "dynacommentstatement": this._initValue = (InitValue as DynaCommentStatement).Statement; break; } switch (LoopCondition.GetType().Name.ToLower()) { case "dynamethodexpression": this._testCondition = (LoopCondition as DynaMethodExpression).Expression; break; case "dynaarraycreateexpression": this._testCondition = (LoopCondition as DynaArrayCreateExpression).Expression; break; case "dynaarrayindexerexpression": this._testCondition = (LoopCondition as DynaArrayIndexerExpression).Expression; break; case "dynaoperatorexpression": this._testCondition = (LoopCondition as DynaOperatorExpression).Expression; break; } switch (ValueIncrement.GetType().Name.ToLower()) { case "dynaiterationstatement": this._valueInc = (ValueIncrement as DynaIterationStatement).Statement; break; case "dynaassignmentstatement": this._valueInc = (ValueIncrement as DynaAssignmentStatement).Statement; break; case "dynaconditionstatement": this._valueInc = (ValueIncrement as DynaConditionStatement).Statement; break; case "dynareturnstatement": this._valueInc = (ValueIncrement as DynaReturnStatement).Statement; break; case "dynadeclarationstatement": this._valueInc = (ValueIncrement as DynaDeclarationStatement).Statement; break; case "dynacommentstatement": this._valueInc = (ValueIncrement as DynaCommentStatement).Statement; break; } if (LoopStatements != null) { foreach (DynaStatement ds in LoopStatements) switch (ds.GetType().Name.ToLower()) { case "dynaiterationstatement": csc.Add((ds as DynaIterationStatement).Statement); break; case "dynaassignmentstatement": csc.Add((ds as DynaAssignmentStatement).Statement); break; case "dynaconditionstatement": csc.Add((ds as DynaConditionStatement).Statement); break; case "dynareturnstatement": csc.Add((ds as DynaReturnStatement).Statement); break; case "dynadeclarationstatement": csc.Add((ds as DynaDeclarationStatement).Statement); break; case "dynacommentstatement": csc.Add((ds as DynaCommentStatement).Statement); break; } } }
public void SetLoopCondition(DynaExpression value) { switch (value.GetType().Name.ToLower()) { case "dynamethodexpression": this._testCondition = (value as DynaMethodExpression).Expression; break; case "dynaarraycreateexpression": this._testCondition = (value as DynaArrayCreateExpression).Expression; break; case "dynaarrayindexerexpression": this._testCondition = (value as DynaArrayIndexerExpression).Expression; break; case "dynaoperatorexpression": this._testCondition = (value as DynaOperatorExpression).Expression; break; } }
/// <summary> /// Adds an argument value to this method call. Be cautious, when adding values here, that they are added in the proper order. /// </summary> /// <param name="value">A DynaExpression object containing an expression whose result value will be passed to the method.</param> public void AddArgument(DynaExpression value) { switch (value.GetType().Name.ToLower()) { case "dynamethodexpression": cec.Add((value as DynaMethodExpression).Expression); break; case "dynaarraycreateexpression": cec.Add((value as DynaArrayCreateExpression).Expression); break; case "dynaarrayindexerexpression": cec.Add((value as DynaArrayIndexerExpression).Expression); break; case "dynaoperatorexpression": cec.Add((value as DynaOperatorExpression).Expression); break; } }