Пример #1
0
		public override void Compile(Execution.VM.ByteCode bc)
		{
			m_Function.Compile(bc);

			int argslen = m_Arguments.Count;

			if (!string.IsNullOrEmpty(m_Name))
			{
				bc.Emit_Copy(0);
				bc.Emit_Index(DynValue.NewString(m_Name), true);
				bc.Emit_Swap(0, 1);
				++argslen;
			}

			for (int i = 0; i < m_Arguments.Count; i++)
				m_Arguments[i].Compile(bc);

			if (!string.IsNullOrEmpty(m_Name))
			{
				bc.Emit_ThisCall(argslen, m_DebugErr);
			}
			else
			{
				bc.Emit_Call(argslen, m_DebugErr);
			}
		}
		private int SetMethod(Execution.VM.ByteCode bc)
		{
			int cnt = 0;

			cnt += bc.Emit_Load(m_FuncSymbol);

			foreach (string str in m_TableAccessors)
			{
				bc.Emit_Index(DynValue.NewString(str), true);
				cnt += 1;
			}

			bc.Emit_IndexSet(0, 0, DynValue.NewString(m_MethodName), true);

			return 1 + cnt;
		}