[XamlC] TypedBindings, some tests, a compiler, ... #489

Merged
merged 1 commit into from Nov 15, 2016

Conversation

Projects
None yet
4 participants
@StephaneDelcroix
Member

StephaneDelcroix commented Oct 27, 2016

Description of Change

Compile the bindings when the x:DataType is given, because we can

API Changes

TypedBindings in the Internals namespace. not for public consumption

Behavioral Changes

shouldn't be any, but speed

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Consolidate commits as makes sense
@@ -7,21 +8,20 @@
namespace Xamarin.Forms.Build.Tasks
{
- public class DebugXamlCTask : XamlCTask
+ public class DebugXamlCTask : XamlTask
{

This comment has been minimized.

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

mostly refactoring in this file, nothing to see

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

mostly refactoring in this file, nothing to see

@@ -13,7 +13,8 @@ class ExpandMarkupsVisitor : IXamlNodeVisitor
XmlName.xKey,
XmlName.xTypeArguments,
XmlName.xFactoryMethod,
- XmlName.xName
+ XmlName.xName,
+ XmlName.xDataType

This comment has been minimized.

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

x:DataType is the new attribute we look for

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

x:DataType is the new attribute we look for

@@ -271,6 +273,10 @@ internal static string GetContentProperty(TypeReference typeRef)
else if (vardefref.VariableDefinition.VariableType.ImplementsGenericInterface("Xamarin.Forms.Xaml.IMarkupExtension`1",
out markupExtension, out genericArguments))
{
+ if (vardefref.VariableDefinition.VariableType.FullName == "Xamarin.Forms.Xaml.BindingExtension")
+ foreach (var instruction in CompileBindingPath(node, context, vardefref.VariableDefinition))
+ yield return instruction;

This comment has been minimized.

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

this is the part that sets the TypedBinding property to the BindingExtension

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

this is the part that sets the TypedBinding property to the BindingExtension

@@ -312,6 +318,359 @@ internal static string GetContentProperty(TypeReference typeRef)
}
}
+ //Once we get compiled IValueProvider, this will move to the BindingExpression

This comment has been minimized.

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

the 340 lines below do not need any comment at all, you should be able to figure what it does, and that what it does is correct, without any effort at all

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

the 340 lines below do not need any comment at all, you should be able to figure what it does, and that what it does is correct, without any effort at all

+ //Once we get compiled IValueProvider, this will move to the BindingExpression
+ static IEnumerable<Instruction> CompileBindingPath(ElementNode node, ILContext context, VariableDefinition bindingExt)
+ {
+ //TODO implement handlers[]

This comment has been minimized.

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

this is actually implemented

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

this is actually implemented

bindable.OnBindingContextChanged();
}
- protected void ApplyBindings(object oldContext = null)

This comment has been minimized.

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

oldContext was never used

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

oldContext was never used

{
- if (self == null)

This comment has been minimized.

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

this is internal API, we don't need to check arguments

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

this is internal API, we don't need to check arguments

- public WeakPropertyChangedProxy(INotifyPropertyChanged source, PropertyChangedEventHandler listener)
+ public WeakPropertyChangedProxy()

This comment has been minimized.

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

the purpose of these changes is to be able to reuse the WPCP and the underlying WeakReferences, thus avoiding allocations

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

the purpose of these changes is to be able to reuse the WPCP and the underlying WeakReferences, thus avoiding allocations

@@ -0,0 +1,291 @@
+#define DO_NOT_CHECK_FOR_BINDING_REUSE

This comment has been minimized.

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

we do not check for reuse, as a user can't have a handle on a TypedBinding

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

we do not check for reuse, as a user can't have a handle on a TypedBinding

+ }
+
+ public sealed class TypedBinding<TSource, TProperty> : TypedBindingBase
+ {

This comment has been minimized.

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

this is where the other part of the magic happens

@StephaneDelcroix

StephaneDelcroix Oct 27, 2016

Member

this is where the other part of the magic happens

@jassmith jassmith merged commit a6bbed0 into master Nov 15, 2016

4 of 6 checks passed

OSX-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle9 (EZ Test) :: OSX Debug : Canceled (Exit code 137 (new))
Details
iOS10-UITests Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle8 (EZ Test) :: UI Tests :: OSX Test Cloud Package - Run iOS Unified iOS10 : Tests f…
Details
Android-UITests Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle8 (EZ Test) :: UI Tests :: OSX Test Cloud Package - Run Android 6.0.1 : Tests passe…
Details
Windows-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle8 :: Windows Debug : Tests passed: 3563, ignored: 10
Details
iOS8-UITests Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle8 (EZ Test) :: UI Tests :: OSX Test Cloud Package - Run iOS Unified IOS8 : Tests pa…
Details
iOS9-UITests Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle8 (EZ Test) :: UI Tests :: OSX Test Cloud Package - Run iOS Unified iOS9 : Running
Details

@StephaneDelcroix StephaneDelcroix deleted the typedbindings branch Jan 31, 2017

jonathanpeppers pushed a commit to Hitcents/Xamarin.Forms that referenced this pull request Feb 1, 2017

@samhouts samhouts added this to the 2.3.4 milestone Jun 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment