aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/IML
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-11-11 11:09:23 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-11-11 11:09:23 +0100
commit7308ca2173ccb4049d986bb08e8d3d08fca58b4e (patch)
treec05d2bd403eb21f7b558aa6d983b6c6986bb7c36 /src/IML
parente93ebc73fdf0e09b3391336a5697794593f5669e (diff)
new instanciator class without IML.Reader, Context class will handle temorary parsing structures
Diffstat (limited to 'src/IML')
-rw-r--r--src/IML/Context.cs26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/IML/Context.cs b/src/IML/Context.cs
index 2b505e06..e5bad2d4 100644
--- a/src/IML/Context.cs
+++ b/src/IML/Context.cs
@@ -20,7 +20,9 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Collections.Generic;
+using System.Reflection;
using System.Reflection.Emit;
+using System.Xml;
namespace Crow.IML
{
@@ -29,6 +31,10 @@ namespace Crow.IML
/// </summary>
public class Context
{
+ public XmlTextReader reader = null;
+ public Type RootType = null;
+ public Node CurrentNode = null;
+ public DynamicMethod dm = null;
public ILGenerator il = null;
//public SubNodeType curSubNodeType;
public Stack<Node> nodesStack = new Stack<Node> ();
@@ -36,8 +42,26 @@ namespace Crow.IML
public Dictionary<string, string> Names = new Dictionary<string, string> ();
public Dictionary<string, Dictionary<string, MemberAddress>> PropertyBindings = new Dictionary<string, Dictionary<string, MemberAddress>> ();
- public Context ()
+ public Context (Type rootType)
{
+ RootType = rootType;
+ dm = new DynamicMethod ("dyn_instantiator",
+ MethodAttributes.Family | MethodAttributes.FamANDAssem | MethodAttributes.NewSlot,
+ CallingConventions.Standard,
+ typeof (void), new Type [] { typeof (object), typeof (Interface) }, RootType, true);
+ il = dm.GetILGenerator (256);
+
+ initILGen ();
+ }
+ void initILGen ()
+ {
+ il.DeclareLocal (typeof (GraphicObject));
+ il.Emit (OpCodes.Nop);
+ //set local GraphicObject to root object passed as 1st argument
+ il.Emit (OpCodes.Ldarg_0);
+ il.Emit (OpCodes.Stloc_0);
+ CompilerServices.emitSetCurInterface (il);
}
+
}
} \ No newline at end of file