Esempio n. 1
0
        public void Push(ActionSet actionSet, IWorkshopTree value)
        {
            var structValue = ValueInArrayToWorkshop.ExtractStructValue(value);

            foreach (var child in _children)
            {
                child.Value.Push(actionSet, structValue.GetValue(child.Key));
            }
        }
Esempio n. 2
0
        public void Set(ActionSet actionSet, IWorkshopTree value, Element target, Element[] index)
        {
            var structValue = ValueInArrayToWorkshop.ExtractStructValue(value);

            foreach (var child in _children)
            {
                child.Value.Set(actionSet, structValue.GetValue(child.Key), target, index);
            }
        }
        public IWorkshopTree Parse(ActionSet actionSet)
        {
            IWorkshopTree result = Calling.ToWorkshop(actionSet);

            for (int i = 0; i < Index.Length; i++)
            {
                result = ValueInArrayToWorkshop.ValueInArray(result, Index[i].Parse(actionSet));
            }

            return(result);
        }
Esempio n. 4
0
        public void Modify(ActionSet actionSet, Operation operation, IWorkshopTree value, Element target, Element[] index)
        {
            switch (operation)
            {
            case Operation.RemoveFromArrayByIndex:
                foreach (var child in _children)
                {
                    child.Value.Modify(actionSet, operation, value, target, index);
                }
                break;

            default:
                var structValue = ValueInArrayToWorkshop.ExtractStructValue(value);

                foreach (var child in _children)
                {
                    child.Value.Modify(actionSet, operation, structValue.GetValue(child.Key), target, index);
                }
                break;
            }
        }
Esempio n. 5
0
        public GettableAssignerResult GetResult(GettableAssignerValueInfo info)
        {
            IStructValue initialValue = null;

            // Set the initial value.
            // If an initial value is provided, use that.
            if (info.InitialValueOverride != null)
            {
                initialValue = ValueInArrayToWorkshop.ExtractStructValue(info.InitialValueOverride);
            }
            // Otherwise, use the default initial value if it exists.
            else if (_attributes.DefaultValue != null)
            {
                initialValue = ValueInArrayToWorkshop.ExtractStructValue(_attributes.DefaultValue.Parse(info.ActionSet));
            }
            // 'initialValue' may still be null.

            bool inline = info.Inline || _attributes.StoreType == StoreType.None;

            var values = new Dictionary <string, IGettable>();

            foreach (var var in _variables)
            {
                // Get the child gettable.
                values.Add(
                    var.Name,
                    var.GetAssigner(new(info.ActionSet, _attributes.Name + "_"))
                    .GetValue(new GettableAssignerValueInfo(
                                  actionSet: info.ActionSet,
                                  setInitialValue: info.SetInitialValue,
                                  initialValue: initialValue?.GetValue(var.Name),
                                  inline: inline,
                                  indexReferenceCreator: info.IndexReferenceCreator,
                                  isGlobal: info.IsGlobal,
                                  isRecursive: info.IsRecursive)));
            }

            return(new GettableAssignerResult(new StructAssignerValue(values), null));
        }
Esempio n. 6
0
 IGettable IGettable.ChildFromClassReference(IWorkshopTree reference) => new WorkshopElementReference(ValueInArrayToWorkshop.ValueInArray(WorkshopElement, reference));