22// The .NET Foundation licenses this file to you under the Apache 2.0 License.
33// See the LICENSE file in the project root for more information.
44
5- using MSAst = System . Linq . Expressions ;
5+ #nullable enable
66
7- using System ;
87using System . Diagnostics ;
98
109using IronPython . Runtime . Binding ;
1110
12- namespace IronPython . Compiler . Ast {
13- using Ast = MSAst . Expression ;
14- using AstUtils = Microsoft . Scripting . Ast . Utils ;
11+ using MSAst = System . Linq . Expressions ;
1512
13+ namespace IronPython . Compiler . Ast {
1614 public class UnaryExpression : Expression {
1715 public UnaryExpression ( PythonOperator op , Expression expression ) {
1816 Operator = op ;
17+ OperationKind = PythonOperatorToOperatorString ( op ) ;
18+ Expression = expression ;
19+ EndIndex = expression . EndIndex ;
20+ }
21+
22+ internal UnaryExpression ( PythonOperationKind op , Expression expression ) {
23+ OperationKind = op ;
1924 Expression = expression ;
2025 EndIndex = expression . EndIndex ;
2126 }
@@ -24,13 +29,10 @@ public UnaryExpression(PythonOperator op, Expression expression) {
2429
2530 public PythonOperator Operator { get ; }
2631
27- public override MSAst . Expression Reduce ( ) {
28- return GlobalParent . Operation (
29- typeof ( object ) ,
30- PythonOperatorToOperatorString ( Operator ) ,
31- Expression
32- ) ;
33- }
32+ internal PythonOperationKind OperationKind { get ; }
33+
34+ public override MSAst . Expression Reduce ( )
35+ => GlobalParent . Operation ( typeof ( object ) , OperationKind , Expression ) ;
3436
3537 public override void Walk ( PythonWalker walker ) {
3638 if ( walker . Walk ( this ) ) {
0 commit comments