Esempio n. 1
0
        protected override async Task <IBifoqlObject> DoApply(QueryContext context)
        {
            IBifoqlObject ignored;

            if (context.Variables.TryGetValue(Name, out ignored))
            {
                return(new AsyncError(this.Location, $"Can't change value of variable '${Name}'"));
            }
            else
            {
                // Get the new value and add to the context as a variable, and replace the current object with that new value as well.
                var variableValue = await Value.Apply(context);

                var newContext = context.AddVariable(Name, variableValue);

                var simplified = _pipedInto.Simplify(newContext.Variables);

                return(await simplified.Apply(newContext));
            }
        }