public override void visit(Generated.RuleCondition obj, bool subNodes) { Rules.RuleCondition ruleCondition = obj as Rules.RuleCondition; if (ruleCondition != null) { try { bool found = false; ruleCondition.Messages.Clear(); foreach (Rules.PreCondition preCondition in ruleCondition.PreConditions) { Interpreter.BinaryExpression expression = checkExpression(preCondition, preCondition.Expression) as Interpreter.BinaryExpression; if (expression != null) { if (expression.IsSimpleEquality()) { Types.ITypedElement variable = expression.Left.Ref as Types.ITypedElement; if (variable != null) { if (variable.Type != null) { // Check that when preconditions are based on a request, // the corresponding action affects the value Request.Disabled to the same variable if (variable.Type.Name.Equals("Request") && expression.Right != null && expression.Right is Interpreter.UnaryExpression) { Values.IValue val2 = expression.Right.Ref as Values.IValue; if (val2 != null && "Response".CompareTo(val2.Name) == 0) { if (ruleCondition != null) { found = false; foreach (Rules.Action action in ruleCondition.Actions) { Variables.IVariable var = OverallVariableFinder.INSTANCE.findByName(action, preCondition.findVariable()); Interpreter.Statement.VariableUpdateStatement update = action.Modifies(var); if (update != null) { Interpreter.UnaryExpression updateExpr = update.Expression as Interpreter.UnaryExpression; if (updateExpr != null) { Values.IValue val3 = updateExpr.Ref as Values.IValue; if (val3 != null && val3.Name.CompareTo("Disabled") == 0) { found = true; break; } } } } if (!found) { preCondition.AddError("Rules where the Pre conditions is based on a Request type variable must assign that variable the value 'Request.Disabled'"); } } } } } // Check that the outgoing variables are not read if (variable.Mode == Generated.acceptor.VariableModeEnumType.aOutgoing) { if (ruleCondition.Reads(variable)) { preCondition.AddError("An outgoing variable cannot be read"); } } // Check that the incoming variables are not modified if (variable.Mode == Generated.acceptor.VariableModeEnumType.aIncoming) { if (ruleCondition.Modifies(variable) != null) { preCondition.AddError("An incoming variable cannot be written"); } } } } } } } catch (Exception exception) { ruleCondition.AddException(exception); } } base.visit(obj, subNodes); }