Exemplo n.º 1
0
        private void SetBinaryOperator(string operatorName)
        {
            var secondVar = _evaluator.Pop();
            var firstVar  = _evaluator.Pop();

            var result = SetNewVReg();
            var assign = new BinaryOperator(operatorName)
            {
                AssignedTo = result,
                Left       = firstVar,
                Right      = secondVar
            };

            result.FixedType = assign.ComputedType();
            AddOperation(assign);
        }
        private void SetBinaryOperator(string operatorName, EvaluatorStack evaluator)
        {
            var secondVar = evaluator.Stack.Pop();
            var firstVar  = evaluator.Stack.Pop();
            var addValue  = new BinaryOperator(operatorName)
            {
                Left  = firstVar,
                Right = secondVar
            };
            var result = SetNewVReg(evaluator);

            result.FixedType = addValue.ComputedType();
            var assign = new Assignment()
            {
                Left  = result,
                Right = addValue
            };

            AddOperation(SimpleOperations.LocalOperation.Kinds.Operator, assign);
        }