예제 #1
0
        public override void ExitAssignmentExpression(CParser.AssignmentExpressionContext context)
        {
            if (context.assignmentExpression() != null)
            {
                // unaryExpression assignmentOperator assignmentExpression

                /*
                 *  assignmentOperator
                 *      :   '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|='
                 *      ;
                 */

                string operation = context.assignmentOperator().GetText();

                if (operation == "=")
                {
                    SafeCall(context, CExpression.BasicAssignmentOperator);
                }
                else if (operation == "*=")
                {
                    SafeCall(context, CExpression.MultiplicationAssignmentOperator);
                }
                else if (operation == "/=")
                {
                    SafeCall(context, CExpression.DivisionAssignmentOperator);
                }
                else if (operation == "%=")
                {
                    SafeCall(context, CExpression.ModuloAssignmentOperator);
                }
                else if (operation == "+=")
                {
                    SafeCall(context, CExpression.AdditionAssignmentOperator);
                }
                else if (operation == "-=")
                {
                    SafeCall(context, CExpression.SubtractionAssignmentOperator);
                }
                else if (operation == "<<=")
                {
                    SafeCall(context, CExpression.BitwiseLeftShiftAssignmentOperator);
                }
                else if (operation == ">>=")
                {
                    SafeCall(context, CExpression.BitwiseRightShiftAssignmentOperator);
                }
                else if (operation == "&=")
                {
                    SafeCall(context, CExpression.BitwiseAndAssignmentOperator);
                }
                else if (operation == "^=")
                {
                    SafeCall(context, CExpression.BitwiseXorAssignmentOperator);
                }
                else if (operation == "|=")
                {
                    SafeCall(context, CExpression.BitwiseOrAssignmentOperator);
                }
            }
        }
예제 #2
0
        protected ObjectDef EmitAssignmentExpression(CParser.AssignmentExpressionContext assignmentExpression)
        {
            ObjectDef returnObjectDef;

            if (assignmentExpression.conditionalExpression() != null)
            {
                returnObjectDef = EmitConditionalExpression(assignmentExpression.conditionalExpression());
            }
            else
            {
                returnObjectDef = null; // TODO: Emit assignment expressions
            }

            return(returnObjectDef);
        }