-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mark UDFs and NFs Async If there's a reference to cross screen control (
#2620) Marks UDF and Nf async if they refer to cross screen control and a new binding config to do that is enabled. There's no definite way to say where binder is binding nf or udf rules so config would be used to communicate the marking of top parse node as async upon countering those references. We don't need to mark those async if all they refer to is component definition but there's no definite way to also check that. ExternalTemplate.IsComponent returns true for component defs and instances but we need to check only for the former. However that shouldn't matter as code gen to lazy load component defs would be no op since component defs are loaded upfront.
- Loading branch information
1 parent
923f501
commit 85e769e
Showing
10 changed files
with
376 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...oft.PowerFx.Interpreter.Tests.Shared/Helpers/SymbolTableHelperMocks/ControlVirtualType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
using Microsoft.PowerFx.Core.App.Controls; | ||
using Microsoft.PowerFx.Core.Types; | ||
using Microsoft.PowerFx.Core.Utils; | ||
|
||
internal class ControlVirtualType : DType, IExternalControlType | ||
{ | ||
public ControlVirtualType(TypeTree typeTree = default) | ||
: base(typeTree) | ||
{ | ||
foreach (var (key, value) in typeTree) | ||
{ | ||
Template.OutputProps.Add(key, new DummyProperty() { InvariantName = new DName(key), Type = value }); | ||
} | ||
} | ||
|
||
public readonly DummyTemplate Template = new (); | ||
|
||
public IExternalControlTemplate ControlTemplate => Template; | ||
|
||
public bool IsMetaField => false; | ||
} |
47 changes: 47 additions & 0 deletions
47
...t.PowerFx.Interpreter.Tests.Shared/Helpers/SymbolTableHelperMocks/DummyExternalControl.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
using Microsoft.PowerFx.Core.App.Controls; | ||
using Microsoft.PowerFx.Core.Types; | ||
using Microsoft.PowerFx.Core.Utils; | ||
|
||
internal class DummyExternalControl : IExternalControl | ||
{ | ||
public IExternalControlTemplate Template => null; | ||
|
||
public bool IsComponentControl { get; set; } = false; | ||
|
||
public IExternalControl TopParentOrSelf => this; | ||
|
||
public string DisplayName { get; set; } = "DummyExternalControl"; | ||
|
||
public bool IsReplicable { get; set; } = false; | ||
|
||
public bool IsAppInfoControl { get; set; } = false; | ||
|
||
public DType ThisItemType { get; set; } = DType.Unknown; | ||
|
||
public bool IsAppGlobalControl => IsAppInfoControl; | ||
|
||
public bool IsCommandComponentInstance { get; set; } = false; | ||
|
||
public DName EntityName => new DName(DisplayName); | ||
|
||
public DType Type { get; set; } = DType.Unknown; | ||
|
||
public virtual IExternalRule GetRule(string propertyInvariantName) | ||
{ | ||
return null; | ||
} | ||
|
||
public virtual bool IsDescendentOf(IExternalControl controlInfo) | ||
{ | ||
return false; | ||
} | ||
|
||
public virtual bool TryGetRule(string dName, out IExternalRule rule) | ||
{ | ||
rule = GetRule(dName); | ||
return rule != null; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...icrosoft.PowerFx.Interpreter.Tests.Shared/Helpers/SymbolTableHelperMocks/DummyProperty.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
using Microsoft.PowerFx.Core.App.Controls; | ||
using Microsoft.PowerFx.Core.Functions; | ||
using Microsoft.PowerFx.Core.Types; | ||
using Microsoft.PowerFx.Core.Utils; | ||
|
||
internal class DummyProperty : IExternalControlProperty | ||
{ | ||
public bool IsImmutableOnInstance { get; set; } = false; | ||
|
||
public bool SupportsPaging { get; set; } = false; | ||
|
||
public bool RequiresDefaultablePropertyReferences { get; set; } = false; | ||
|
||
public bool ShouldIncludeThisItemInFormula { get; set; } = false; | ||
|
||
public bool IsTestCaseProperty { get; set; } = false; | ||
|
||
public bool UseForDataQuerySelects { get; set; } = false; | ||
|
||
public bool IsTypeInferredFromPrimaryInput { get; set; } = false; | ||
|
||
public PropertyRuleCategory PropertyCategory { get; set; } = PropertyRuleCategory.Data; | ||
|
||
public bool IsScopeVariable { get; set; } = false; | ||
|
||
public string UnloadedDefault { get; set; } = string.Empty; | ||
|
||
public IExternalControlProperty PassThroughInput => new DummyProperty(); | ||
|
||
public DName InvariantName { get; set; } = new DName("DummyProperty"); | ||
|
||
public bool IsScopedProperty { get; set; } = false; | ||
|
||
public TexlFunction ScopeFunctionPrototype { get; set; } = null; | ||
|
||
public DType Type { get; set; } = DType.Unknown; | ||
|
||
public DType GetOpaqueType() | ||
{ | ||
return Type; | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...icrosoft.PowerFx.Interpreter.Tests.Shared/Helpers/SymbolTableHelperMocks/DummyTemplate.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Microsoft.PowerFx.Core.App.Components; | ||
using Microsoft.PowerFx.Core.App.Controls; | ||
using Microsoft.PowerFx.Core.Utils; | ||
|
||
internal class DummyTemplate : IExternalControlTemplate | ||
{ | ||
public readonly Dictionary<string, IExternalControlProperty> InputProps = new (); | ||
|
||
public readonly Dictionary<string, IExternalControlProperty> OutputProps = new (); | ||
|
||
public ComponentType ComponentType { get; set; } = ComponentType.FunctionComponent; | ||
|
||
public bool IncludesThisItemInSpecificProperty { get; set; } = false; | ||
|
||
public bool ReplicatesNestedControls { get; set; } = false; | ||
|
||
public IEnumerable<DName> NestedAwareTableOutputs { get; set; } = Enumerable.Empty<DName>(); | ||
|
||
public bool IsComponent { get; set; } = false; | ||
|
||
public bool HasExpandoProperties { get; set; } = false; | ||
|
||
public IEnumerable<IExternalControlProperty> ExpandoProperties { get; set; } = Enumerable.Empty<IExternalControlProperty>(); | ||
|
||
public bool HasPropsInferringTypeFromPrimaryInProperty { get; set; } = false; | ||
|
||
public IEnumerable<IExternalControlProperty> PropsInferringTypeFromPrimaryInProperty => Enumerable.Empty<IExternalControlProperty>(); | ||
|
||
public string ThisItemInputInvariantName { get; set; } = string.Empty; | ||
|
||
public IExternalControlProperty PrimaryOutputProperty { get; set; } = new DummyProperty(); | ||
|
||
public bool IsMetaLoc { get; set; } = false; | ||
|
||
public bool IsCommandComponent { get; set; } = false; | ||
|
||
public bool HasOutput(DName rightName) | ||
{ | ||
return OutputProps.ContainsKey(rightName.Value); | ||
} | ||
|
||
public bool HasProperty(string currentPropertyValue, PropertyRuleCategory category) | ||
{ | ||
return TryGetProperty(currentPropertyValue, out _); | ||
} | ||
|
||
public bool TryGetInputProperty(string resolverCurrentProperty, out IExternalControlProperty currentProperty) | ||
{ | ||
return InputProps.TryGetValue(resolverCurrentProperty, out currentProperty); | ||
} | ||
|
||
public bool TryGetOutputProperty(string name, out IExternalControlProperty externalControlProperty) | ||
{ | ||
return OutputProps.TryGetValue(name, out externalControlProperty); | ||
} | ||
|
||
public bool TryGetProperty(string name, out IExternalControlProperty controlProperty) | ||
{ | ||
return TryGetInputProperty(name, out controlProperty) || TryGetOutputProperty(name, out controlProperty); | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
...sts/Microsoft.PowerFx.Interpreter.Tests.Shared/Helpers/SymbolTableHelperMocks/MockGlue.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
using Microsoft.PowerFx.Core.App.Controls; | ||
using Microsoft.PowerFx.Core.Binding; | ||
using Microsoft.PowerFx.Core.Functions; | ||
using Microsoft.PowerFx.Core.Glue; | ||
|
||
internal class MockGlue : IBinderGlue | ||
{ | ||
public bool IsComponentDataSource(object lookupInfoData) | ||
{ | ||
return false; | ||
} | ||
|
||
public bool IsDataComponentDefinition(object lookupInfoData) | ||
{ | ||
return false; | ||
} | ||
|
||
public bool IsDataComponentInstance(object lookupInfoData) | ||
{ | ||
return false; | ||
} | ||
|
||
public bool IsDynamicDataSourceInfo(object lookupInfoData) | ||
{ | ||
return false; | ||
} | ||
|
||
bool IBinderGlue.CanControlBeUsedInComponentProperty(TexlBinding binding, IExternalControl control) | ||
{ | ||
return true; | ||
} | ||
|
||
IExternalControl IBinderGlue.GetVariableScopedControlFromTexlBinding(TexlBinding txb) | ||
{ | ||
return new DummyExternalControl(); | ||
} | ||
|
||
bool IBinderGlue.IsComponentScopedPropertyFunction(TexlFunction infoFunction) | ||
{ | ||
return false; | ||
} | ||
|
||
bool IBinderGlue.IsContextProperty(IExternalControlProperty externalControlProperty) | ||
{ | ||
return false; | ||
} | ||
|
||
bool IBinderGlue.IsPrimaryCommandComponentProperty(IExternalControlProperty externalControlProperty) | ||
{ | ||
return false; | ||
} | ||
|
||
bool IBinderGlue.TryGetCdsDataSourceByBind(object lhsInfoData, out IExternalControl o) | ||
{ | ||
o = null; | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.