/// <summary> /// Set aliases to current snapshot entry. Aliases can be set even to those entries /// that doesn't belongs to any variable, field,.. /// </summary> /// <param name="context">Context snapshot where operation is proceeded</param> /// <param name="aliasedEntry">Snapshot entry which will be aliased from current entry</param> protected override void setAliases(SnapshotBase context, ReadSnapshotEntryBase aliasedEntry) { Snapshot snapshot = ToSnapshot(context); SnapshotLogger.append(context, "set alias: " + this.ToString() + " from: " + aliasedEntry.ToString()); if (snapshot.CurrentMode == SnapshotMode.InfoLevel) { return; } ICopyModelSnapshotEntry entry = ToEntry(aliasedEntry); AliasData data = entry.CreateAliasToEntry(snapshot); AssignCollector collector = new AssignCollector(snapshot); collector.AliasesProcessing = AliasesProcessing.BeforeCollecting; collector.ProcessPath(path); AssignAliasWorker worker = new AssignAliasWorker(snapshot); worker.AssignAlias(collector, data); data.Release(snapshot); }
/// <summary> /// Resolves the type of PHP objects in the entry. /// </summary> /// <param name="context">The context.</param> /// <param name="snapshotEntry">The snapshot entry.</param> /// <returns>The list of types in the given snapshot entry.</returns> public static IEnumerable <TypeValue> ResolveType(SnapshotBase context, ICopyModelSnapshotEntry snapshotEntry) { Snapshot snapshot = SnapshotEntry.ToSnapshot(context); MemoryEntry entry = snapshotEntry.ReadMemory(snapshot); CollectComposedValuesVisitor visitor = new CollectComposedValuesVisitor(); visitor.VisitMemoryEntry(entry); return(visitor.ResolveObjectsTypes(snapshot)); }
/// <summary> /// Converts base snapshot entry variable into copy memory model snapshot entry. /// </summary> /// <param name="entry">The entry.</param> /// <returns>Given entry parameter converted into copy memory model entry.</returns> /// <exception cref="System.ArgumentException">Entry parametter is not of type Weverca.MemoryModels.CopyMemoryModel.ICopyModelSnapshotEntry</exception> internal static ICopyModelSnapshotEntry ToEntry(ReadSnapshotEntryBase entry) { ICopyModelSnapshotEntry copyEntry = entry as ICopyModelSnapshotEntry; if (copyEntry != null) { return(copyEntry); } else { throw new ArgumentException("Entry parametter is not of type Weverca.MemoryModels.CopyMemoryModel.ICopyModelSnapshotEntry"); } }
/// <summary> /// Set aliases to current snapshot entry. Aliases can be set even to those entries /// that doesn't belongs to any variable, field,.. /// </summary> /// <param name="context">Context snapshot where operation is proceeded</param> /// <param name="aliasedEntry">Snapshot entry which will be aliased from current entry</param> protected override void setAliases(SnapshotBase context, ReadSnapshotEntryBase aliasedEntry) { Snapshot snapshot = ToSnapshot(context); snapshot.Factories.Logger.Log(snapshot, "set alias: " + this.ToString() + " from: " + aliasedEntry.ToString()); snapshot.Factories.Benchmark.StartOperation(snapshot); ICopyModelSnapshotEntry entry = ToEntry(aliasedEntry); snapshot.Factories.Benchmark.StartAlgorithm(snapshot, AlgorithmType.SET_ALIAS); snapshot.Algorithms.AssignAlgorithm.AssignAlias(snapshot, path, entry.GetPath(snapshot)); snapshot.Factories.Benchmark.FinishAlgorithm(snapshot, AlgorithmType.SET_ALIAS); snapshot.Factories.Benchmark.FinishOperation(snapshot); }
/// <summary> /// Iterates the indexes of PHP array in entry. /// </summary> /// <param name="context">The context.</param> /// <param name="snapshotEntry">The snapshot entry.</param> /// <returns>The list of indexes in the given snapshot entry.</returns> public static IEnumerable <MemberIdentifier> IterateIndexes(SnapshotBase context, ICopyModelSnapshotEntry snapshotEntry) { Snapshot snapshot = SnapshotEntry.ToSnapshot(context); MemoryEntry entry = snapshotEntry.ReadMemory(snapshot); CollectComposedValuesVisitor visitor = new CollectComposedValuesVisitor(); visitor.VisitMemoryEntry(entry); return(visitor.CollectIndexes(snapshot)); }