protected override IExpression ConvertAssign(IAssignExpression iae) { object targetDecl = Recognizer.GetArrayDeclaration(iae.Target); IStatement increment; if (this.isOperatorStatement && targetDecl is IVariableDeclaration) { IVariableDeclaration ivd = (IVariableDeclaration)targetDecl; if (analysis.onUpdate.TryGetValue(targetDecl, out increment)) { IExpression incrExpr = ((IExpressionStatement)increment).Expression; Containers containers = new Containers(context); containers.AddContainersNeededForExpression(context, incrExpr); containers = Containers.RemoveUnusedLoops(containers, context, incrExpr); containers = Containers.RemoveStochasticConditionals(containers, context); List <Containers> list; if (!containersOfUpdate.TryGetValue(targetDecl, out list)) { list = new List <Containers>(); containersOfUpdate[targetDecl] = list; } // have we already performed this update in these containers? bool alreadyDone = false; foreach (Containers prevContainers in list) { if (containers.Contains(prevContainers)) { // prevContainers is more general, i.e. has fewer containers than 'containers' alreadyDone = true; break; } } if (!alreadyDone) { list.Add(containers); // must set this attribute before the statement is wrapped context.OutputAttributes.Set(increment, new OperatorStatement()); int ancIndex = containers.GetMatchingAncestorIndex(context); Containers missing = containers.GetContainersNotInContext(context, ancIndex); increment = Containers.WrapWithContainers(increment, missing.outputs); context.AddStatementAfterAncestorIndex(ancIndex, increment); } } if (analysis.suppressUpdate.ContainsKey(ivd)) { foreach (IStatement ist in context.FindAncestors <IStatement>()) { if (context.InputAttributes.Has <OperatorStatement>(ist)) { var attr = analysis.suppressUpdate[ivd]; context.OutputAttributes.Set(ist, new HasIncrement(attr)); break; } } } } return(base.ConvertAssign(iae)); }