public void CompileAssignment(ByteCode bc, int stackofs, int tupleidx)
        {
            m_BaseExp.Compile(bc);

            if (m_IndexExp is LiteralExpression)
            {
                LiteralExpression lit = (LiteralExpression)m_IndexExp;
                bc.Emit_IndexSet(stackofs, tupleidx, lit.Value);
            }
            else
            {
                m_IndexExp.Compile(bc);
                bc.Emit_IndexSet(stackofs, tupleidx);
            }
        }
        public void CompileAssignment(ByteCode bc, int stackofs, int tupleidx)
        {
            _baseExp.Compile(bc);

            if (_name != null)
            {
                bc.Emit_IndexSet(stackofs, tupleidx, DynValue.NewString(_name), true);
            }
            else if (_indexExp is LiteralExpression lit)
            {
                bc.Emit_IndexSet(stackofs, tupleidx, lit.Value);
            }
            else
            {
                _indexExp.Compile(bc);
                bc.Emit_IndexSet(stackofs, tupleidx, isExpList: (_indexExp is ExprListExpression));
            }
        }
Example #3
0
        public void CompileAssignment(ByteCode bc, int stackofs, int tupleidx)
        {
            m_BaseExp.Compile(bc);

            if (m_Name != null)
            {
                bc.Emit_IndexSet(stackofs, tupleidx, DynValue.NewString(m_Name), isNameIndex: true);
            }
            else if (m_IndexExp is LiteralExpression)
            {
                LiteralExpression lit = (LiteralExpression)m_IndexExp;
                bc.Emit_IndexSet(stackofs, tupleidx, lit.Value);
            }
            else
            {
                m_IndexExp.Compile(bc);
                bc.Emit_IndexSet(stackofs, tupleidx, isExpList: (m_IndexExp is ExprListExpression));
            }
        }
        private int SetMethod(ByteCode bc)
        {
            int cnt = 0;

            cnt += bc.Emit_Load(_funcSymbol);

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

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

            return(1 + cnt);
        }