Mercurial > pub > Jint1
comparison Jint.Runtime/VM/RuntimeContext.cs @ 5:cb13da6e3349
simple loop test
| author | cin |
|---|---|
| date | Mon, 28 Oct 2013 00:49:15 +0400 |
| parents | aced2ae9957f |
| children |
comparison
equal
deleted
inserted
replaced
| 4:1ae5b10f7a10 | 5:cb13da6e3349 |
|---|---|
| 18 | 18 |
| 19 public Box<T> BoxValue<T>(T value) { | 19 public Box<T> BoxValue<T>(T value) { |
| 20 return new Box<T>(value, this); | 20 return new Box<T>(value, this); |
| 21 } | 21 } |
| 22 | 22 |
| 23 object[] GetOrCreateOps(Type type) { | |
| 24 object[] ops; | |
| 25 if (!m_impls.TryGetValue(type, out ops)) | |
| 26 ops = m_impls[type] = new object[(int)Codes.MaxOp]; | |
| 27 return ops; | |
| 28 } | |
| 29 | |
| 23 public void DefineBinaryOperation<T>(Codes code, BinaryOperation<T> op) { | 30 public void DefineBinaryOperation<T>(Codes code, BinaryOperation<T> op) { |
| 24 object[] ops; | 31 object[] ops = GetOrCreateOps(typeof(T)); |
| 25 if (!m_impls.TryGetValue(typeof(T), out ops)) | 32 ops[(int)code] = op; |
| 26 ops = m_impls[typeof(T)] = new object[(int)Codes.MaxOp]; | 33 } |
| 27 | 34 |
| 28 ops[(int)code] = op; | 35 public void DefineCompareOperation<T>(CompareOperation<T> op) { |
| 36 object[] ops = GetOrCreateOps(typeof(T)); | |
| 37 ops[(int)Codes.Cmp] = op; | |
| 29 } | 38 } |
| 30 } | 39 } |
| 31 } | 40 } |
