aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/IML
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-12-14 01:03:55 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-12-14 01:03:55 +0100
commitbdd6f9a1db93cbe52ad35e17d909fd8eb28368d5 (patch)
tree60bc66251dca0567cc38c894628378b8b0225141 /src/IML
parentc30725eb225c84682bc58124f7a7769db531bc69 (diff)
Template binding instantiation, dynamic event handler emition.
intermediate save. modifié : src/CompilerServices/CompilerServices.cs modifié : src/IML/Context.cs modifié : src/IML/Node.cs modifié : src/IML/NodeAddress.cs modifié : src/Instantiator.cs
Diffstat (limited to 'src/IML')
-rw-r--r--src/IML/Context.cs17
-rw-r--r--src/IML/Node.cs21
-rw-r--r--src/IML/NodeAddress.cs2
3 files changed, 18 insertions, 22 deletions
diff --git a/src/IML/Context.cs b/src/IML/Context.cs
index 965d0062..4f9ba30d 100644
--- a/src/IML/Context.cs
+++ b/src/IML/Context.cs
@@ -38,7 +38,6 @@ namespace Crow.IML
{
public XmlTextReader reader = null;
public Type RootType = null;
- public int CurrentIndex = 0;
public DynamicMethod dm = null;
public ILGenerator il = null;
@@ -46,7 +45,6 @@ namespace Crow.IML
public NodeStack nodesStack = new NodeStack ();
public Dictionary<string, List<NodeAddress>> Names = new Dictionary<string, List<NodeAddress>>();
- public Dictionary<string, Dictionary<string, MemberAddress>> PropertyBindings = new Dictionary<string, Dictionary<string, MemberAddress>> ();
public Dictionary<NodeAddress, Dictionary<string, List<MemberAddress>>> Bindings =
new Dictionary<NodeAddress, Dictionary<string, List<MemberAddress>>>();
@@ -75,21 +73,6 @@ namespace Crow.IML
get { return nodesStack.Peek().CrowType; }
}
- public MethodInfo CurrentAddMethod {
- get {
- if (typeof (Group).IsAssignableFrom (CurrentNodeType))
- return CompilerServices.miAddChild;
- if (typeof (Container).IsAssignableFrom (CurrentNodeType))
- return CompilerServices.miSetChild;
- if (typeof (TemplatedContainer).IsAssignableFrom (CurrentNodeType))
- return CurrentIndex < 0 ? CompilerServices.miLoadTmp : CompilerServices.miSetContent;
- if (typeof (TemplatedGroup).IsAssignableFrom (CurrentNodeType))
- return CurrentIndex < 0 ? CompilerServices.miLoadTmp : CompilerServices.miAddItem;
- if (typeof (TemplatedControl).IsAssignableFrom (CurrentNodeType))
- return CompilerServices.miLoadTmp;
- return null;
- }
- }
void initILGen ()
{
il.DeclareLocal (typeof (GraphicObject));
diff --git a/src/IML/Node.cs b/src/IML/Node.cs
index 14cffdb2..a9e9bb80 100644
--- a/src/IML/Node.cs
+++ b/src/IML/Node.cs
@@ -26,14 +26,13 @@ using System.Collections.Generic;
namespace Crow.IML
{
/// <summary>
- /// IML Node are the elements of the interface XML,
+ /// IML Node are defined with a type and the index in the parent,
/// </summary>
public struct Node
{
+ /// <summary> Current node type</summary>
public Type CrowType;
- /// <summary>
- /// Indexer for group child, -1 for template
- /// </summary>
+ /// <summary> Index in parent, -1 for template</summary>
public int Index;
public Node (Type crowType, int _index = 0)
@@ -42,6 +41,20 @@ namespace Crow.IML
Index = _index;
}
+ public MethodInfo GetAddMethod(int childIdx){
+ if (typeof (Group).IsAssignableFrom (CrowType))
+ return CompilerServices.miAddChild;
+ if (typeof (Container).IsAssignableFrom (CrowType))
+ return CompilerServices.miSetChild;
+ if (typeof (TemplatedContainer).IsAssignableFrom (CrowType))
+ return childIdx < 0 ? CompilerServices.miLoadTmp : CompilerServices.miSetContent;
+ if (typeof (TemplatedGroup).IsAssignableFrom (CrowType))
+ return childIdx < 0 ? CompilerServices.miLoadTmp : CompilerServices.miAddItem;
+ if (typeof (TemplatedControl).IsAssignableFrom (CrowType))
+ return CompilerServices.miLoadTmp;
+ return null;
+ }
+
#region Equality Compare
public override bool Equals (object obj)
{
diff --git a/src/IML/NodeAddress.cs b/src/IML/NodeAddress.cs
index 1c907ec1..460998da 100644
--- a/src/IML/NodeAddress.cs
+++ b/src/IML/NodeAddress.cs
@@ -31,7 +31,7 @@ namespace Crow.IML
public NodeAddress (Node[] nodes) : base(nodes) {
}
- public Type NodeType { get { return this[this.Count -1].CrowType; }}
+ public Type NodeType { get { return Count == 0 ? null : this[this.Count -1].CrowType; }}
public override bool Equals (object obj)
{