annotate Jint.Runtime/VM/ScopeReference.cs @ 6:a6329b092499

Added scopes, function builder
author cin
date Wed, 30 Oct 2013 17:38:35 +0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
1 using System;
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
2
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
3 namespace Jint.Runtime.VM
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
4 {
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
5 public class ScopeReference: IReference
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
6 {
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
7 Frame m_frame;
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
8 int m_index;
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
9 public ScopeReference (Frame frame, int index)
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
10 {
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
11 if (frame == null)
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
12 throw new ArgumentNullException("frame");
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
13
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
14 m_index = index;
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
15 m_frame = frame;
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
16 }
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
17
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
18
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
19 #region IReference implementation
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
20 public T Get<T> ()
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
21 {
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
22 return m_frame.GetValue<T>(m_index);
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
23 }
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
24 public void Put<T> (T value)
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
25 {
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
26 m_frame.SetValue(m_index);
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
27 }
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
28 public void CopyTo (Frame frame, int dest)
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
29 {
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
30 m_frame[m_index].CopyTo(frame,dest);
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
31 }
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
32 #endregion
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
33 }
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
34 }
a6329b092499 Added scopes, function builder
cin
parents:
diff changeset
35