summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Build.Tasks
diff options
context:
space:
mode:
authorStephane Delcroix <stephane@delcroix.org>2016-12-07 10:35:32 (GMT)
committerGitHub <noreply@github.com>2016-12-07 10:35:32 (GMT)
commit7851541ab67c1e3c1d38b3210a1153d08ce78ab2 (patch)
tree55efc79b32a427f5a4cc1674a3566ef2e2a507c3 /Xamarin.Forms.Build.Tasks
parent8181e6d4cbe8aac6eb29c5140262d8bc51dba7b7 (diff)
downloadxamarin-forms-7851541ab67c1e3c1d38b3210a1153d08ce78ab2.zip
xamarin-forms-7851541ab67c1e3c1d38b3210a1153d08ce78ab2.tar.gz
xamarin-forms-7851541ab67c1e3c1d38b3210a1153d08ce78ab2.tar.bz2
[Xaml[C]] support op_implicit declared on Target (#585)
Diffstat (limited to 'Xamarin.Forms.Build.Tasks')
-rw-r--r--Xamarin.Forms.Build.Tasks/NodeILExtensions.cs8
1 files changed, 7 insertions, 1 deletions
diff --git a/Xamarin.Forms.Build.Tasks/NodeILExtensions.cs b/Xamarin.Forms.Build.Tasks/NodeILExtensions.cs
index 86ef268..0c9b9e6 100644
--- a/Xamarin.Forms.Build.Tasks/NodeILExtensions.cs
+++ b/Xamarin.Forms.Build.Tasks/NodeILExtensions.cs
@@ -109,6 +109,9 @@ namespace Xamarin.Forms.Build.Tasks
nullableCtor = originalTypeRef.GetMethods(md => md.IsConstructor && md.Parameters.Count == 1, module).Single().Item1;
nullableCtor = nullableCtor.ResolveGenericParameters(nullableTypeRef, module);
}
+
+ var implicitOperator = module.TypeSystem.String.GetImplicitOperatorTo(targetTypeRef, module);
+
//Obvious Built-in conversions
if (targetTypeRef.Resolve().BaseType != null && targetTypeRef.Resolve().BaseType.FullName == "System.Enum")
yield return PushParsedEnum(targetTypeRef, str, node);
@@ -203,10 +206,13 @@ namespace Xamarin.Forms.Build.Tasks
context.Body.Method.Module.Import(typeof(decimal))
.Resolve()
.Methods.FirstOrDefault(
- md => md.IsConstructor && md.Parameters.Count == 1 && md.Parameters [0].ParameterType.FullName == "System.Int32");
+ md => md.IsConstructor && md.Parameters.Count == 1 && md.Parameters[0].ParameterType.FullName == "System.Int32");
var decimalctor = context.Body.Method.Module.Import(decimalctorinfo);
yield return Instruction.Create(OpCodes.Newobj, decimalctor);
}
+ } else if (implicitOperator != null) {
+ yield return Instruction.Create(OpCodes.Ldstr, node.Value as string);
+ yield return Instruction.Create(OpCodes.Call, module.Import(implicitOperator));
} else
yield return Instruction.Create(OpCodes.Ldnull);