Exemplo n.º 1
0
        public override void Compile(ByteCode bc)
        {
            m_BaseExp.Compile(bc);

            if (m_Name != null)
            {
                bc.Emit_Index(m_Name, true);
            }
            else if (m_IndexExp is LiteralExpression lit && lit.Value.Type == DataType.String)
            {
                bc.Emit_Index(lit.Value.String);
            }
Exemplo n.º 2
0
        public override void Compile(ByteCode bc)
        {
            m_BaseExp.Compile(bc);

            if (m_IndexExp is LiteralExpression)
            {
                LiteralExpression lit = (LiteralExpression)m_IndexExp;
                bc.Emit_Index(lit.Value);
            }
            else
            {
                m_IndexExp.Compile(bc);
                bc.Emit_Index();
            }
        }
        public override void Compile(ByteCode bc)
        {
            _function.Compile(bc);

            int argslen = _arguments.Count;

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

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

            if (!string.IsNullOrEmpty(_name))
            {
                bc.Emit_ThisCall(argslen, _debugErr);
            }
            else
            {
                bc.Emit_Call(argslen, _debugErr);
            }
        }
Exemplo n.º 4
0
        public override void Compile(ByteCode bc)
        {
            _baseExp.Compile(bc);

            if (_name != null)
            {
                bc.Emit_Index(DynValue.NewString(_name), true);
            }
            else if (_indexExp is LiteralExpression lit)
            {
                bc.Emit_Index(lit.Value);
            }
            else
            {
                _indexExp.Compile(bc);
                bc.Emit_Index(isExpList: (_indexExp is ExprListExpression));
            }
        }
Exemplo n.º 5
0
        public override void Compile(ByteCode bc)
        {
            m_BaseExp.Compile(bc);

            if (m_Name != null)
            {
                bc.Emit_Index(DynValue.NewString(m_Name), true);
            }
            else if (m_IndexExp is LiteralExpression)
            {
                LiteralExpression lit = (LiteralExpression)m_IndexExp;
                bc.Emit_Index(lit.Value);
            }
            else
            {
                m_IndexExp.Compile(bc);
                bc.Emit_Index(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);
        }