13 changed files with 201 additions and 11 deletions
@ -0,0 +1,35 @@ |
|||
using XamlX.Ast; |
|||
using XamlX.Emit; |
|||
using XamlX.IL; |
|||
using XamlX.TypeSystem; |
|||
|
|||
namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.AstNodes |
|||
{ |
|||
class AvaloniaXamlIlVectorLikeConstantAstNode : XamlAstNode, IXamlAstValueNode, IXamlAstILEmitableNode |
|||
{ |
|||
private readonly IXamlConstructor _constructor; |
|||
private readonly double[] _values; |
|||
|
|||
public AvaloniaXamlIlVectorLikeConstantAstNode(IXamlLineInfo lineInfo, IXamlType type, IXamlConstructor constructor, double[] values) : base(lineInfo) |
|||
{ |
|||
_constructor = constructor; |
|||
_values = values; |
|||
|
|||
Type = new XamlAstClrTypeReference(lineInfo, type, false); |
|||
} |
|||
|
|||
public IXamlAstTypeReference Type { get; } |
|||
|
|||
public XamlILNodeEmitResult Emit(XamlEmitContext<IXamlILEmitter, XamlILNodeEmitResult> context, IXamlILEmitter codeGen) |
|||
{ |
|||
foreach (var value in _values) |
|||
{ |
|||
codeGen.Ldc_R8(value); |
|||
} |
|||
|
|||
codeGen.Newobj(_constructor); |
|||
|
|||
return XamlILNodeEmitResult.Type(0, Type.GetClrType()); |
|||
} |
|||
} |
|||
} |
|||
@ -1 +1 @@ |
|||
Subproject commit 5420df861ce6f2be5ead9efa078fe7242ce88f18 |
|||
Subproject commit 8d2b6e6ee5099d6a0271e743d2808f44e3241945 |
|||
Loading…
Reference in new issue