6
|
1 using System;
|
|
2
|
|
3 namespace Jint.Runtime.VM
|
|
4 {
|
|
5 public class ScopeReference: IReference
|
|
6 {
|
|
7 Frame m_frame;
|
|
8 int m_index;
|
|
9 public ScopeReference (Frame frame, int index)
|
|
10 {
|
|
11 if (frame == null)
|
|
12 throw new ArgumentNullException("frame");
|
|
13
|
|
14 m_index = index;
|
|
15 m_frame = frame;
|
|
16 }
|
|
17
|
|
18
|
|
19 #region IReference implementation
|
|
20 public T Get<T> ()
|
|
21 {
|
|
22 return m_frame.GetValue<T>(m_index);
|
|
23 }
|
|
24 public void Put<T> (T value)
|
|
25 {
|
|
26 m_frame.SetValue(m_index);
|
|
27 }
|
|
28 public void CopyTo (Frame frame, int dest)
|
|
29 {
|
|
30 m_frame[m_index].CopyTo(frame,dest);
|
|
31 }
|
|
32 #endregion
|
|
33 }
|
|
34 }
|
|
35
|