|
|
|
@ -12,11 +12,8 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers |
|
|
|
if (node is XamlIlPropertyAssignmentNode pa |
|
|
|
&& pa.Property.Name == "Name" |
|
|
|
&& pa.Property.Setter.DeclaringType.FullName == "Avalonia.StyledElement") |
|
|
|
{ |
|
|
|
return new ScopeRegistrationNode(pa); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return node; |
|
|
|
} |
|
|
|
|
|
|
|
@ -40,13 +37,15 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers |
|
|
|
var findNameScope = exts.FindMethod(m => m.Name == "FindNameScope"); |
|
|
|
var registerMethod = findNameScope.ReturnType.FindMethod(m => m.Name == "Register"); |
|
|
|
using (var nameLoc = context.GetLocal(context.Configuration.WellKnownTypes.String)) |
|
|
|
using (var targetLoc = context.GetLocal(context.Configuration.WellKnownTypes.Object)) |
|
|
|
using (var targetLoc = context.GetLocal(_property.Setter.DeclaringType)) |
|
|
|
using (var nameScopeLoc = context.GetLocal(findNameScope.ReturnType)) |
|
|
|
{ |
|
|
|
var exit = codeGen.DefineLabel(); |
|
|
|
|
|
|
|
// var target = {target}
|
|
|
|
codeGen.Stloc(targetLoc.Local); |
|
|
|
codeGen |
|
|
|
.Castclass(_property.Setter.DeclaringType) |
|
|
|
.Stloc(targetLoc.Local); |
|
|
|
|
|
|
|
// var name = {EmitName()}
|
|
|
|
context.Emit(Value, codeGen, _property.PropertyType); |
|
|
|
@ -57,6 +56,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers |
|
|
|
.EmitCall(_property.Setter) |
|
|
|
// var scope = target.FindNameScope()
|
|
|
|
.Ldloc(targetLoc.Local) |
|
|
|
.Castclass(findNameScope.Parameters[0]) |
|
|
|
.EmitCall(findNameScope) |
|
|
|
.Stloc(nameScopeLoc.Local) |
|
|
|
// if({scope} != null) goto call;
|
|
|
|
|