Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove function #2634

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

using System.Collections.Generic;

namespace Microsoft.PowerFx.Core.App
{
internal interface IExternalDocumentProperties
Expand Down
10 changes: 8 additions & 2 deletions src/libraries/Microsoft.PowerFx.Core/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,10 @@ internal static class TexlStrings
public static StringGetter AboutClearCollect = (b) => StringResources.Get("AboutClearCollect", b);

public static StringGetter AboutRemove = (b) => StringResources.Get("AboutRemove", b);
public static StringGetter RemoveDataSourceArg = (b) => StringResources.Get("RemoveDataSourceArg", b);
public static StringGetter RemoveRecordsArg = (b) => StringResources.Get("RemoveRecordsArg", b);
public static StringGetter RemoveArg1 = (b) => StringResources.Get("RemoveArg1", b);
public static StringGetter RemoveArg2 = (b) => StringResources.Get("RemoveArg2", b);
public static StringGetter RemoveArg3 = (b) => StringResources.Get("RemoveArg3", b);
public static StringGetter RemoveAllArg2 = (b) => StringResources.Get("RemoveAllArg2", b);

public static StringGetter AboutDec2Hex = (b) => StringResources.Get("AboutDec2Hex", b);
public static StringGetter Dec2HexArg1 = (b) => StringResources.Get("Dec2HexArg1", b);
Expand Down Expand Up @@ -649,6 +651,7 @@ internal static class TexlStrings
public static ErrorResourceKey ErrBadSchema_ExpectedType = new ErrorResourceKey("ErrBadSchema_ExpectedType");
public static ErrorResourceKey ErrInvalidArgs_Func = new ErrorResourceKey("ErrInvalidArgs_Func");
public static ErrorResourceKey ErrNeedTable_Func = new ErrorResourceKey("ErrNeedTable_Func");
public static ErrorResourceKey ErrNeedTable_Arg = new ErrorResourceKey("ErrNeedTable_Arg");
public static ErrorResourceKey ErrNeedTableCol_Func = new ErrorResourceKey("ErrNeedTableCol_Func");
public static ErrorResourceKey ErrNotAccessibleInCurrentContext = new ErrorResourceKey("ErrNotAccessibleInCurrentContext");
public static ErrorResourceKey ErrInternalControlInInputProperty = new ErrorResourceKey("ErrInternalControlInInputProperty");
Expand Down Expand Up @@ -853,5 +856,8 @@ internal static class TexlStrings
public static ErrorResourceKey ErrReachedMaxJsonLength = new ErrorResourceKey("ErrReachedMaxJsonLength");

public static ErrorResourceKey ErrUserDefinedTypesDisabled = new ErrorResourceKey("ErrUserDefinedTypesDisabled");
public static ErrorResourceKey ErrCollectionDoesNotAcceptThisType = new ErrorResourceKey("ErrCollectionDoesNotAcceptThisType");
public static ErrorResourceKey ErrNeedAll = new ErrorResourceKey("ErrNeedAll");
public static ErrorResourceKey ErrNeedCollection_Func = new ErrorResourceKey("ErrNeedCollection_Func");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ public sealed class Features
/// </summary>
internal bool IsUserDefinedTypesEnabled { get; set; } = false;

/// <summary>
/// Enables Remove All delegation.
/// </summary>
internal bool IsRemoveAllDelegationEnabled { get; set; }

internal static Features None => new Features();

public static Features PowerFxV1 => new Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,15 @@ internal void AddFunction(TexlFunction function)
{
using var guard = _guard.Enter(); // Region is single threaded.
Inc();
_functions.Add(function);
_functions.Add(function);

if (EnumStoreBuilder == null)
{
_enumStoreBuilder = new EnumStoreBuilder();
}

// Add any associated enums
EnumStoreBuilder?.WithRequiredEnums(new TexlFunctionSet(function));
EnumStoreBuilder.WithRequiredEnums(new TexlFunctionSet(function));
}

internal EnumStoreBuilder EnumStoreBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public override async Task<DValue<BooleanValue>> RemoveAsync(IEnumerable<Formula
if (!found)
{
// https://github.com/microsoft/Power-Fx/issues/2618
errors.Add(new ExpressionError() { Message = "The specified record was not found.", Kind = ErrorKind.NotFound });
errors.Add(new ExpressionError() { Kind = ErrorKind.NotFound });
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public virtual async Task<DValue<BooleanValue>> ClearAsync(CancellationToken can
{
return DValue<BooleanValue>.Of(NotImplementedError(IRContext));
}

/// <summary>
/// Patch implementation for derived classes.
/// </summary>
Expand Down
Loading