Exemple #1
0
        protected override void _Exec(Frame frame)
        {
            if (is_global)
            {
                frame.AddGlobalName(name.m_string);
            }
            else
            {
                frame.AddLocalName(name.m_string);
            }
            var fn = func_body.GetOneResult(frame);

            frame.Write(name.m_string, fn);
        }
Exemple #2
0
        protected override void _Exec(Frame frame)
        {
            var fn = func_body.GetOneResult(frame);

            if (func_name.names.Count == 1)
            {
                frame.Write(func_name.names[0].m_string, fn);
            }
            else
            {
                var names = func_name.names;
                var obj   = frame.Read(names[0].m_string);
                if (obj == null)
                {
                    obj = frame.Write(names[0].m_string, new Table());
                }
                if (obj is Table == false)
                {
                    throw frame.NewRunException(line, $"{names[0].m_string} is not Table which expect to be");
                }
                Table t = obj as Table;
                for (int i = 1; i < names.Count - 1; i++)
                {
                    var tt = t.Get(names[i].m_string);
                    if (tt == null)
                    {
                        tt = t.Set(names[i].m_string, new Table());
                    }
                    if (tt is Table == false)
                    {
                        throw frame.NewRunException(names[i].m_line, $"expect {names[i].m_string} to be a IGetSet");
                    }
                    t = tt as Table;
                }
                t.Set(names[names.Count - 1].m_string, fn);
            }
        }