示例#1
0
        /// <inheritdoc />
        protected override void flowThrough()
        {
            ValuePoint firstPart, secondPart;

            switch (Assign.PublicOperation)
            {
            case Operations.AssignPrepend:
                firstPart  = ROperand;
                secondPart = LOperand;
                break;

            case Operations.AssignAppend:
                firstPart  = LOperand;
                secondPart = ROperand;
                break;

            default:
                throw new NotSupportedException("Given concat assign is not supported");
            }

            var concatedValue = Services.Evaluator.Concat(new MemoryEntry[] { firstPart.Value.ReadMemory(OutSnapshot), secondPart.Value.ReadMemory(OutSnapshot) });

            Value = OutSet.CreateSnapshotEntry(concatedValue);
            Services.Evaluator.Assign(AssignTarget.LValue, concatedValue);
        }
示例#2
0
        /// <inheritdoc />
        protected override void flowThrough()
        {
            var value = Services.Evaluator.UnaryEx(
                Expression.PublicOperation, Operand.Value.ReadMemory(OutSnapshot));

            Value = OutSet.CreateSnapshotEntry(value);
        }
示例#3
0
        /// <inheritdoc />
        protected override void flowThrough()
        {
            var partValues = from part in Parts select part.Value.ReadMemory(OutSnapshot);

            var concatedValue = Services.Evaluator.Concat(partValues);

            Value = OutSet.CreateSnapshotEntry(concatedValue);
        }
示例#4
0
        /// <inheritdoc />
        protected override void flowThrough()
        {
            var binaryOperation = toBinaryOperation(Assign.PublicOperation);
            var value           = Services.Evaluator.BinaryEx(LOperand.Value.ReadMemory(OutSnapshot), binaryOperation, ROperand.Value.ReadMemory(OutSnapshot));

            Value = OutSet.CreateSnapshotEntry(value);

            Services.Evaluator.Assign(LOperand.LValue, value);
        }
示例#5
0
        /// <inheritdoc />
        protected override void flowThrough()
        {
            var entries = new ReadSnapshotEntryBase[_variables.Length];

            for (var i = 0; i < _variables.Length; ++i)
            {
                entries[i] = _variables[i].LValue;
            }

            var values = Services.Evaluator.IssetEx(entries);
            var value  = new MemoryEntry(values);

            Value = OutSet.CreateSnapshotEntry(value);
        }
示例#6
0
        /// <inheritdoc />
        protected override void flowThrough()
        {
            MemoryEntry value;

            if (ThisObj == null)
            {
                value = Services.Evaluator.ClassConstant(_partial.ClassName.QualifiedName, _partial.Name);
            }
            else
            {
                value = Services.Evaluator.ClassConstant(ThisObj.Value.ReadMemory(OutSnapshot), _partial.Name);
            }
            Value = OutSet.CreateSnapshotEntry(value);
        }
示例#7
0
        /// <inheritdoc />
        protected override void flowThrough()
        {
            MemoryEntry result;

            if (ResultExpression == null)
            {
                result = new MemoryEntry(OutSet.UndefinedValue);
            }
            else
            {
                result = ResultExpression.Value.ReadMemory(OutSnapshot);
            }
            var value = Services.Evaluator.Exit(Exit, result);

            Value = OutSet.CreateSnapshotEntry(value);
        }
示例#8
0
        /// <inheritdoc />
        protected override void flowThrough()
        {
            var initializer = new List <KeyValuePair <MemoryEntry, MemoryEntry> >(_initializedValues.Count);

            foreach (var pair in _initializedValues)
            {
                //resolve initializing values to memory entries

                var index = pair.Key == null ? null : pair.Key.Value.ReadMemory(OutSnapshot);
                var value = pair.Value.Value.ReadMemory(OutSnapshot);
                initializer.Add(new KeyValuePair <MemoryEntry, MemoryEntry>(index, value));
            }

            var arrayValue = Services.Evaluator.ArrayEx(initializer);

            Value = OutSet.CreateSnapshotEntry(arrayValue);
        }
示例#9
0
        /// <inheritdoc />
        protected override void flowThrough()
        {
            var         expression = Expression.Value.ReadMemory(OutSnapshot);
            MemoryEntry value;

            if (Name == null)
            {
                value = Services.Evaluator.InstanceOfEx(expression,
                                                        InstanceOfEx.ClassNameRef.GenericQualifiedName.QualifiedName);
            }
            else
            {
                value = Services.Evaluator.IndirectInstanceOfEx(expression,
                                                                Name.Value.ReadMemory(OutSnapshot));
            }

            Value = OutSet.CreateSnapshotEntry(value);
        }
示例#10
0
        /// <inheritdoc />
        protected override void flowThrough()
        {
            var beforeIncrementValue = IncrementedValue.Value.ReadMemory(OutSnapshot);
            var afterIncrementValue  = Services.Evaluator.IncDecEx(IncDecEx, beforeIncrementValue);

            IncrementTarget.LValue.WriteMemoryWithoutCopy(OutSnapshot, afterIncrementValue);

            if (IncDecEx.Post)
            {
                //return value before incrementation
                Value = OutSet.CreateSnapshotEntry(beforeIncrementValue);
            }
            else
            {
                //return value after incrementation
                Value = OutSet.CreateSnapshotEntry(afterIncrementValue);
            }
        }
示例#11
0
        public override void Foreach(MemoryEntry enumeree, ReadWriteSnapshotEntryBase keyVariable,
                                     ReadWriteSnapshotEntryBase valueVariable)
        {
            var values = new HashSet <Value>();

            var array      = enumeree.PossibleValues.First() as AssociativeArray;
            var arrayEntry = OutSet.CreateSnapshotEntry(new MemoryEntry(array));

            var indexes = arrayEntry.IterateIndexes(OutSnapshot);

            foreach (var index in indexes)
            {
                var indexEntry = arrayEntry.ReadIndex(OutSnapshot, index);
                var element    = indexEntry.ReadMemory(OutSnapshot);
                values.UnionWith(element.PossibleValues);
            }

            valueVariable.WriteMemory(OutSnapshot, new MemoryEntry(values));
        }
示例#12
0
        /// <inheritdoc />
        protected override void flowThrough()
        {
            switch (_partial.Type)
            {
            case PseudoConstUse.Types.Line:
                Value = OutSet.CreateSnapshotEntry(new MemoryEntry(OutSet.CreateInt(_partial.Position.FirstLine)));
                return;

            case PseudoConstUse.Types.File:
                Value = OutSet.CreateSnapshotEntry(new MemoryEntry(OutSet.CreateString(OwningScriptFullName)));
                return;

            case PseudoConstUse.Types.Dir:
                Value = OutSet.CreateSnapshotEntry(new MemoryEntry(OutSet.CreateString(OwningScript.Directory.FullName)));
                return;

            case PseudoConstUse.Types.Function:
                if (OwningPPGraph.FunctionName == null)
                {
                    Value = OutSet.CreateSnapshotEntry(new MemoryEntry(OutSet.UndefinedValue));
                }
                else
                {
                    Value = OutSet.CreateSnapshotEntry(new MemoryEntry(OutSet.CreateString(OwningPPGraph.FunctionName)));
                }
                return;

            case PseudoConstUse.Types.Method:
            case PseudoConstUse.Types.Class:
            case PseudoConstUse.Types.Namespace:
                Value = OutSet.CreateSnapshotEntry(new MemoryEntry(OutSet.AnyStringValue));
                return;

            default:
                Value = OutSet.CreateSnapshotEntry(new MemoryEntry(OutSet.AnyValue));
                return;
            }
        }
示例#13
0
        /// <inheritdoc />
        protected override void flowThrough()
        {
            PrepareArguments();

            MemoryEntry value;

            //Create object according to class name
            if (Name == null)
            {
                value = Services.Evaluator.CreateObject(
                    NewEx.ClassNameRef.GenericQualifiedName.QualifiedName);
            }
            else
            {
                value = Services.Evaluator.IndirectCreateObject(Name.Value.ReadMemory(OutSnapshot));
            }

            //initialize created object
            var objectEntry       = OutSet.CreateSnapshotEntry(value);
            var initializedObject = Services.FunctionResolver.InitializeObject(objectEntry, Flow.Arguments);

            Value = OutSet.CreateSnapshotEntry(initializedObject);
        }
示例#14
0
        /// <inheritdoc />
        protected override void flowThrough()
        {
            MemoryEntry value;

            switch (Jump.Type)
            {
            case JumpStmt.Types.Return:
                if (Expression == null)
                {
                    //php code: return ;
                    value = new MemoryEntry(OutSet.UndefinedValue);
                }
                else
                {
                    value = Services.FunctionResolver.Return(Expression.Value.ReadMemory(OutSnapshot));
                }
                break;

            default:
                throw new NotSupportedException(Jump.Type + " is not supported jump type");
            }

            Value = OutSet.CreateSnapshotEntry(value);
        }
示例#15
0
 /// <summary>
 /// Set content of Value
 /// </summary>
 /// <param name="valueContent">Content of value</param>
 public void SetValueContent(MemoryEntry valueContent)
 {
     Value = OutSet.CreateSnapshotEntry(valueContent);
 }
示例#16
0
        /// <inheritdoc />
        protected override void flowThrough()
        {
            var value = _constantProvider(Services.Evaluator);

            Value = OutSet.CreateSnapshotEntry(value);
        }
示例#17
0
        /// <summary>
        /// Resolves return value of current sink. Resolved value is stored within Value.
        /// </summary>
        public void ResolveReturnValue()
        {
            var returnValue = Services.FunctionResolver.ResolveReturnValue(OwningExtension.Branches);

            Value = OutSet.CreateSnapshotEntry(returnValue);
        }
示例#18
0
        /// <inheritdoc />
        protected override void flowThrough()
        {
            var value = Services.Evaluator.EmptyEx(Variable.LValue);

            Value = OutSet.CreateSnapshotEntry(value);
        }