1 using System.Collections.Generic;
3 using System.Globalization;
8 using Tizen.NUI.Xaml.Build.Tasks;
10 using static Mono.Cecil.Cil.Instruction;
11 using static Mono.Cecil.Cil.OpCodes;
13 namespace Tizen.NUI.Xaml.Core.XamlC
15 class ConstraintTypeConverter : ICompiledTypeConverter
17 public IEnumerable<Instruction> ConvertFromString(string value, ILContext context, BaseNode node)
19 var module = context.Body.Method.Module;
23 if (string.IsNullOrEmpty(value) || !double.TryParse(value, NumberStyles.Number, CultureInfo.InvariantCulture, out size))
24 throw new XamlParseException($"Cannot convert \"{value}\" into {typeof(Constraint)}", node);
26 yield return Create(Ldc_R8, size);
27 yield return Create(Call, module.ImportMethodReference((XamlTask.nuiAssemblyName, XamlTask.nuiNameSpace, "Constraint"),
28 methodName: "Constant",
29 parameterTypes: new[] { ("mscorlib", "System", "Double") },