protected override Result _execute(ImmutableArray <EvaluatedParameter> parameters, FunctionScope function_scope) { IArray result_array = new ArrayStructure(); function_scope.Root.Arrays.Add(result_array); foreach (EvaluatedParameter param in parameters) { if (param.EvaluatedValue is ArrayPointerExpression array_pointer) { foreach (ArrayItem item in array_pointer.Array.GetAll()) { if (item.Key.IsDigitsOnly()) { result_array.Set(new ArrayItem("", item.Value)); } else { result_array.Set(new ArrayItem(item.Key, item.Value)); } } } } return(new Result(result_array.AsExpression)); }
protected override Result _execute(ImmutableArray <EvaluatedParameter> parameters, FunctionScope function_scope) { IArray arr = new ArrayStructure(); function_scope.Root.Arrays.Add(arr); function_scope.Parent.FindNearestScope <IFunctionLikeScope> (s => { foreach (var p in s.Signature.Parameters) { arr.Set(new ArrayItem("", p.EvaluatedValue)); } }); return(new Result(arr.AsExpression)); }
public static Result Run(ArrayCreateExpression expression, Scope scope) { IArray arr = new ArrayStructure(); scope.Root.Arrays.Add(arr); foreach (ArrayItemExpression item_expr in expression.Items) { FinalExpression key_expr = Interpreters.Execute(item_expr.Key, scope).ResultValue; FinalExpression value_expr = Interpreters.Execute(item_expr.Value, scope).ResultValue; ArrayKey key = new ArrayKey(key_expr.GetStringValue()); arr.Set(new ArrayItem(key, value_expr)); } return(new Result(arr.AsExpression)); }