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

Added scopes, function builder
author cin
date Wed, 30 Oct 2013 17:38:35 +0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Jint.Runtime/VM/ScopeReference.cs	Wed Oct 30 17:38:35 2013 +0400
@@ -0,0 +1,35 @@
+using System;
+
+namespace Jint.Runtime.VM
+{
+	public class ScopeReference: IReference
+	{
+		Frame m_frame;
+		int m_index;
+		public ScopeReference (Frame frame, int index)
+		{
+			if (frame == null)
+				throw new ArgumentNullException("frame");
+
+			m_index = index;
+			m_frame = frame;
+		}
+
+
+		#region IReference implementation
+		public T Get<T> ()
+		{
+			return m_frame.GetValue<T>(m_index);
+		}
+		public void Put<T> (T value)
+		{
+			m_frame.SetValue(m_index);
+		}
+		public void CopyTo (Frame frame, int dest)
+		{
+			m_frame[m_index].CopyTo(frame,dest);
+		}
+		#endregion
+	}
+}
+