Beispiel #1
0
        public override Value Evaluate()
        {
            var value   = target.Evaluate();
            var current = Regions.Current;

            actions.AutoRegister = false;
            State.RegisterBlock(actions);
            State.Stack.Push(value);
            var evaluated = actions.Evaluate();

            if (fieldName.IsNotEmpty())
            {
                if (Regions.FieldExists(fieldName))
                {
                    Regions[fieldName] = evaluated.AssignmentValue();
                }
                else
                {
                    current.CreateAndSet(fieldName, evaluated.AssignmentValue());
                }
            }
            result   = value.ToString();
            typeName = value.Type.ToString();
            State.UnregisterBlock();
            return(evaluated);
        }
Beispiel #2
0
 public override Value Evaluate()
 {
     Reject(Regions.FieldExists(fieldName), LOCATION, $"Field {fieldName} is already defined");
     Regions.CreateReadOnlyVariable(fieldName);
     Regions[fieldName] = thunk;
     result             = thunk.ToString();
     return(null);
 }
Beispiel #3
0
        public override Value Evaluate()
        {
            Regions.FieldExists(fieldName).Must().Not.BeTrue().OrThrow(LOCATION, () => $"Field {fieldName} is already defined");
            Regions.CreateReadOnlyVariable(fieldName);
            Regions[fieldName] = thunk;
            result             = thunk.ToString();

            return(null);
        }
Beispiel #4
0
        public override Value Evaluate()
        {
            Assert(Regions.FieldExists(fieldName), "Assign to field", $"{fieldName} doesn't exist");
            var assignmentValue = expression.Evaluate().AssignmentValue();

            if (reference)
            {
                fieldName = Regions[fieldName].Text;
            }
            Regions[fieldName] = assignmentValue;
            result             = assignmentValue.ToString();
            typeName           = assignmentValue.Type.ToString();
            return(null);
        }
Beispiel #5
0
        public override Value Evaluate()
        {
            Regions.FieldExists(fieldName).Must().BeTrue().OrThrow(LOCATION, () => $"{fieldName} doesn't exist");
            var assignmentValue = expression.Evaluate().AssignmentValue();

            if (reference)
            {
                fieldName = Regions[fieldName].Text;
            }

            Regions[fieldName] = assignmentValue;
            result             = assignmentValue.ToString();
            typeName           = assignmentValue.Type.ToString();

            return(null);
        }