Mercurial > pub > Jint1
comparison Jint.Runtime/VM2/RuntimeContext.cs @ 2:4aed85a1f558
implemented simple vm2
author | cin |
---|---|
date | Fri, 25 Oct 2013 15:52:16 +0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1:033ebe7432d5 | 2:4aed85a1f558 |
---|---|
1 using System; | |
2 using System.Collections.Generic; | |
3 | |
4 namespace Jint.Runtime.VM2 | |
5 { | |
6 using OpCodes; | |
7 | |
8 public class RuntimeContext | |
9 { | |
10 Dictionary<Type, Operation[]> m_bindings; | |
11 public RuntimeContext () | |
12 { | |
13 m_bindings = new Dictionary<Type, Operation[]>(); | |
14 m_bindings[typeof(int)] = new Operation[] { | |
15 (args) => {return null;}, | |
16 (args) => { | |
17 return (int)args[0]+(int)args[1]; | |
18 } | |
19 }; | |
20 } | |
21 | |
22 public Box PackValue(object value) { | |
23 return new Box (value,m_bindings[value.GetType()]); | |
24 } | |
25 } | |
26 } | |
27 |