/// <summary> /// Collects the temporary variables into target structure. /// </summary> /// <param name="snapshot">The snapshot.</param> /// <param name="sourceLevel">The source level.</param> /// <param name="targetLevel">The target level.</param> private void collectTemporary(Snapshot snapshot, int sourceLevel, int targetLevel) { IWriteableSet <MemoryIndex> temporary = writeableStrucure.GetWriteableStackContext(targetLevel).WriteableTemporaryVariables; foreach (TemporaryIndex temp in snapshot.Structure.Readonly.GetReadonlyStackContext(sourceLevel).ReadonlyTemporaryVariables) { if (!temporary.Contains(temp)) { temporary.Add(temp); } } }
/// <summary> /// Creates merge operations for all temporary indexes in the target structure. /// </summary> /// <param name="index">The index.</param> private void mergeTemporary(int index) { IWriteableSet <MemoryIndex> temporary = writeableStrucure.GetWriteableStackContext(index).WriteableTemporaryVariables; foreach (var temp in temporary) { MergeOperation operation = new MergeOperation(temp); addOperation(operation); foreach (Snapshot snapshot in sourceSnapshots) { if (snapshot.Structure.Readonly.IsDefined(temp)) { operation.Add(temp, snapshot); } else { operation.SetUndefined(); } } } }