Beispiel #1
0
        internal FieldStorageVisitor(SnapshotStorageEntry fieldedEntry, Snapshot context, VariableIdentifier field)
        {
            _context = context;
            _field   = field;

            var fieldedValues = fieldedEntry.ReadMemory(context);

            VisitMemoryEntry(fieldedValues);

            if (_implicitObject != null)
            {
                //TODO replace only undefined values
                fieldedEntry.WriteMemory(context, new MemoryEntry(_implicitObject));
            }

            if (_needsTemporaryField)
            {
                foreach (var key in fieldedEntry.Storages)
                {
                    _fieldStorages.Add(new VariableFieldKey(key, _field));
                }
            }

            Storages = _fieldStorages.ToArray();
        }
Beispiel #2
0
        internal IndexStorageVisitor(SnapshotStorageEntry indexedEntry, Snapshot context, MemberIdentifier index)
        {
            _context = context;
            _index   = index;
            var indexedValues = indexedEntry.ReadMemory(context);

            VisitMemoryEntry(indexedValues);

            if (implicitArray != null)
            {
                //TODO replace only undefined values
                indexedEntry.WriteMemoryWithoutCopy(context, new MemoryEntry(implicitArray));
            }

            var forceStrong = indexedEntry.ForceStrong;

            if (_hasOnlyArrays && indexedEntry.HasDirectIdentifier && index.IsDirect)
            {
                //optimization
                forceStrong = true;
            }

            if (_needsTemporaryIndex)
            {
                foreach (var key in indexedEntry.Storages)
                {
                    _indexStorages.Add(new VariableIndexKey(key, _index));
                }
            }

            IndexedValue = new SnapshotStorageEntry(null, forceStrong, _indexStorages.ToArray());
        }