diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2017-01-23 21:59:14 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2017-01-23 21:59:14 +0100 |
| commit | a84e509116b46aa1a98e80460e6a82e2056b9475 (patch) | |
| tree | 6db39d47acd9443f9c2681e4c2cc16084486846d /src/CompilerServices/CompilerServices.cs | |
| parent | fb73ce236b57ee5a58f498c3c4236e003436d921 (diff) | |
debug new dynEvent handler
Diffstat (limited to 'src/CompilerServices/CompilerServices.cs')
| -rw-r--r-- | src/CompilerServices/CompilerServices.cs | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/CompilerServices/CompilerServices.cs b/src/CompilerServices/CompilerServices.cs index dc2f7a1c..31b29fb2 100644 --- a/src/CompilerServices/CompilerServices.cs +++ b/src/CompilerServices/CompilerServices.cs @@ -270,13 +270,17 @@ namespace Crow destType =(miDest as FieldInfo).FieldType; if (value != null) { - origType = value.GetType (); - if (destType.IsAssignableFrom (origType)) - convertedVal = Convert.ChangeType (value, destType); - else if (origType.IsPrimitive & destType.IsPrimitive) - convertedVal = GetConvertMethod (destType).Invoke (null, new Object[] { value }); - else - convertedVal = getImplicitOp (origType, destType).Invoke (value, null); + if (destType == TObject)//TODO: check that test of destType is not causing problems + convertedVal = value; + else { + origType = value.GetType (); + if (destType.IsAssignableFrom (origType)) + convertedVal = Convert.ChangeType (value, destType); + else if (origType.IsPrimitive & destType.IsPrimitive) + convertedVal = GetConvertMethod (destType).Invoke (null, new Object[] { value }); + else + convertedVal = getImplicitOp (origType, destType).Invoke (value, null); + } } if (miDest.MemberType == MemberTypes.Property) @@ -663,7 +667,10 @@ namespace Crow #region RIGHT OPERANDES if (rop.IsStringConstant){ il.Emit (OpCodes.Ldstr, rop.Tokens[0]); - lop.emitSetProperty (il, cancelFinalSet); + lop.emitSetProperty (il); + }else if (rop.IsSingleName && rop.Tokens[0] == "this"){ + il.Emit (OpCodes.Ldarg_0); //load sender ref onto the stack, the current node + lop.emitSetProperty (il); }else if (rop.LevelsUp ==0 && !string.IsNullOrEmpty(rop.Tokens[0])) {//parsable constant depending on lop type //if left operand is member of current node, it's easy to fetch type, else we should use reflexion in msil if (lopPI == null){//accept GraphicObj members, but it's restricive @@ -685,9 +692,11 @@ namespace Crow //emit left operand assignment il.Emit (OpCodes.Callvirt, lopPI.GetSetMethod()); } else {//tree parsing and propert gets - rop.emitGetTarget (il, cancel); - rop.emitGetProperty (il, cancel); - lop.emitSetProperty (il, cancelFinalSet); + il.Emit (OpCodes.Ldarg_0); //load sender ref onto the stack, the current node + + rop.emitGetTarget (il, cancelFinalSet); + rop.emitGetProperty (il, cancelFinalSet); + lop.emitSetProperty (il); } #endregion |