Skip to content

Commit

Permalink
Merging
Browse files Browse the repository at this point in the history
  • Loading branch information
anderson-joyle committed Jan 23, 2025
2 parents cc8c3b1 + 222fbe9 commit 84ed0b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.PowerFx.Core.Functions;
using Microsoft.PowerFx.Core.IR;
using Microsoft.PowerFx.Functions;
using Microsoft.PowerFx.Interpreter.Localization;
Expand Down Expand Up @@ -425,20 +424,20 @@ public async Task<FormulaValue> InvokeAsync(FunctionInvokeInfo invokeInfo, Cance
}

// Remove(collection:*[], item1:![], item2:![], ..., ["All"])
internal class RemoveImpl : RemoveFunction, IAsyncTexlFunction3
internal class RemoveImpl : RemoveFunction, IFunctionInvoker
{
public async Task<FormulaValue> InvokeAsync(FormulaType irContext, FormulaValue[] args, CancellationToken cancellationToken)
public async Task<FormulaValue> InvokeAsync(FunctionInvokeInfo invokeInfo, CancellationToken cancellationToken)
{
return await MutationUtils.RemoveCore(irContext, args, cancellationToken).ConfigureAwait(false);
return await MutationUtils.RemoveCore(invokeInfo, cancellationToken).ConfigureAwait(false);
}
}

// Remove(collection:*[], source:*[], ["All"])
internal class RemoveAllImpl : RemoveAllFunction, IAsyncTexlFunction3
internal class RemoveAllImpl : RemoveAllFunction, IFunctionInvoker
{
public async Task<FormulaValue> InvokeAsync(FormulaType irContext, FormulaValue[] args, CancellationToken cancellationToken)
public async Task<FormulaValue> InvokeAsync(FunctionInvokeInfo invokeInfo, CancellationToken cancellationToken)
{
return await MutationUtils.RemoveCore(irContext, args, cancellationToken).ConfigureAwait(false);
return await MutationUtils.RemoveCore(invokeInfo, cancellationToken).ConfigureAwait(false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.PowerFx.Core.IR;
using Microsoft.PowerFx.Functions;
using Microsoft.PowerFx.Interpreter.Localization;
using Microsoft.PowerFx.Types;

Expand Down Expand Up @@ -46,8 +46,9 @@ public static DValue<RecordValue> MergeRecords(IEnumerable<FormulaValue> records
return DValue<RecordValue>.Of(FormulaValue.NewRecordFromFields(mergedFields.Select(kvp => new NamedValue(kvp.Key, kvp.Value))));
}

public static async Task<FormulaValue> RemoveCore(FormulaType irContext, FormulaValue[] args, CancellationToken cancellationToken)
public static async Task<FormulaValue> RemoveCore(FunctionInvokeInfo invokeInfo, CancellationToken cancellationToken)
{
var args = invokeInfo.Args.ToArray();
cancellationToken.ThrowIfCancellationRequested();

FormulaValue arg0;
Expand Down Expand Up @@ -124,10 +125,10 @@ public static async Task<FormulaValue> RemoveCore(FormulaType irContext, Formula
});
}

return new ErrorValue(IRContext.NotInSource(irContext), errors);
return new ErrorValue(invokeInfo.IRContext, errors);
}

return irContext == FormulaType.Void ? FormulaValue.NewVoid() : FormulaValue.NewBlank();
return invokeInfo.ReturnType == FormulaType.Void ? FormulaValue.NewVoid() : FormulaValue.NewBlank();
}
}
}

0 comments on commit 84ed0b2

Please sign in to comment.