public void Visit(UnaryExpressionNode expression) { expression.Child.Accept(this); EmitComment("Unary operator " + expression.Operator); if (expression.Operator == Operator.Subtract) { Emit("neg"); } else { throw new Exception("Unsupported unary operator: " + expression.Operator); } }
/*statement-expression-factorized: | assignment-operator expresion statement-expresion-p | statement-expresion-p */ private ExpressionNode statement_expression_factorized(UnaryExpressionNode leftValue) { printIfDebug("statement_expression_factorized"); if (pass(assignmentOperatorOptions)) { var assignmentOperator = token; consumeToken(); var exp = expression(); // return statement_expression_p(new AssignExpressionNode(leftValue,assignmentOperator.type,exp)); return(new AssignExpressionNode(leftValue, assignmentOperator.type, exp, assignmentOperator)); } else { // return statement_expression_p(leftValue); return(leftValue); } }
public void Visit(UnaryExpressionNode expression) { expression.Child.Accept(this); EmitComment("Unary operator " + expression.Operator); if (expression.Operator == Operator.Subtract) Emit("ineg"); else throw new Exception("Unsupported unary operator: " + expression.Operator); }
public void Visit(UnaryExpressionNode expression) { }