aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/CompilerServices/CompilerServices.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-12-22 19:38:49 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-12-22 19:38:49 +0100
commit20d9e145a5ce8e60996145f7f030652eb9ce7165 (patch)
tree43b5b7947390e2b0a08122d10e50f80c088399c2 /src/CompilerServices/CompilerServices.cs
parent15092ce68614c7bc0acf968daf3c936f6504c42f (diff)
New property binding, init emitted in ctx.
modifié : src/CompilerServices/CompilerServices.cs modifié : src/IML/Context.cs modifié : src/Instantiator.cs
Diffstat (limited to 'src/CompilerServices/CompilerServices.cs')
-rw-r--r--src/CompilerServices/CompilerServices.cs19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/CompilerServices/CompilerServices.cs b/src/CompilerServices/CompilerServices.cs
index de49d32d..7dcfd972 100644
--- a/src/CompilerServices/CompilerServices.cs
+++ b/src/CompilerServices/CompilerServices.cs
@@ -667,15 +667,22 @@ namespace Crow
return null;
}
public static void emitGetInstance (ILGenerator il, NodeAddress orig, NodeAddress dest){
- if (orig.Count < dest.Count) {
- for (int i = orig.Count - 1; i < dest.Count - 1; i++)
- emitGetChild (il, dest [i].CrowType, dest [i + 1].Index);
- } else {
- for (int j = dest.Count; j < orig.Count; j++)
- il.Emit (OpCodes.Callvirt, typeof(ILayoutable).GetProperty ("Parent").GetGetMethod ());
+ int ptr = 0;
+ while (orig [ptr] == dest [ptr]) {
+ ptr++;
+ if (ptr == orig.Count || ptr == dest.Count)
+ break;
+ }
+ for (int i = 0; i < orig.Count - ptr; i++)
+ il.Emit (OpCodes.Callvirt, typeof(ILayoutable).GetProperty ("Parent").GetGetMethod ());
+ while (ptr < dest.Count) {
+ emitGetChild (il, dest [ptr-1].CrowType, dest [ptr].Index);
+ ptr++;
}
}
public static void emitGetInstance (ILGenerator il, NodeAddress dest){
+ if (dest == null)
+ return;
for (int i = 0; i < dest.Count - 1; i++)
emitGetChild (il, dest [i].CrowType, dest [i + 1].Index);
}