annotate Jint.Runtime/VM/RuntimeContext.cs @ 0:e113095f1de0

initial commit, proof of concept
author cin
date Wed, 23 Oct 2013 13:24:57 +0400
parents
children aced2ae9957f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
1 using System;
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
2 using System.Collections.Generic;
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
3
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
4 namespace Jint.Runtime.VM
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
5 {
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
6 public class RuntimeContext
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
7 {
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
8 Dictionary<Type,object> m_binders;
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
9
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
10 public RuntimeContext ()
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
11 {
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
12 m_binders = new Dictionary<Type,object> ();
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
13 m_binders.Add (typeof(int), new IntegerBinder ());
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
14 }
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
15
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
16 public Box<T> BoxValue<T>(T value) {
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
17 return new Box<T> (value, GetBinder<T> ());
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
18 }
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
19
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
20 public IBinder<T> GetBinder<T>() {
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
21 return (IBinder<T>) m_binders [typeof(T)];
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
22 }
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
23 }
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
24 }
e113095f1de0 initial commit, proof of concept
cin
parents:
diff changeset
25