view Jint.Runtime/VM2/RuntimeContext.cs @ 2:4aed85a1f558

implemented simple vm2
author cin
date Fri, 25 Oct 2013 15:52:16 +0400
parents
children
line wrap: on
line source

using System;
using System.Collections.Generic;

namespace Jint.Runtime.VM2
{
	using OpCodes;

	public class RuntimeContext
	{
		Dictionary<Type, Operation[]> m_bindings;
		public RuntimeContext ()
		{
			m_bindings = new Dictionary<Type, Operation[]>();
			m_bindings[typeof(int)] = new Operation[] {
				(args) => {return null;},
				(args) => {
					return (int)args[0]+(int)args[1];
				}
			};
		}

		public Box PackValue(object value) {
			return new Box (value,m_bindings[value.GetType()]);
		}
	}
}