@@ -37,8 +37,8 @@ public class JSValueBuilder
3737 //private static MethodInfo _StrictEqualsLiteralString
3838 // = type.PublicMethod(nameof(JSValue.StrictEqualsLiteral), typeof(string));
3939
40- private static MethodInfo _Negate
41- = type . PublicMethod ( nameof ( JSValue . Negate ) ) ;
40+ // private static MethodInfo _Negate
41+ // = type.PublicMethod(nameof(JSValue.Negate));
4242
4343 public static Expression AddString ( Expression target , Expression @string )
4444 {
@@ -141,16 +141,17 @@ public static Expression PrototypeChain(Expression exp)
141141
142142 public static Expression Negate ( Expression exp )
143143 {
144- return Expression . Call ( exp , _Negate ) ;
144+ // return Expression.Call(exp, _Negate);
145+ return exp . CallExpression < JSValue , JSValue > ( ( ) => ( x ) => x . Negate ( ) ) ;
145146 }
146147
147148 public static Expression Power ( Expression left , Expression right ) {
148149 // return Expression.Call(left, _Power, right);
149150 return left . CallExpression < JSValue , JSValue , JSValue > ( ( ) => ( x , a ) => x . Power ( a ) , right ) ;
150151 }
151152
152- private static PropertyInfo _BooleanValue =
153- type . Property ( nameof ( JSValue . BooleanValue ) ) ;
153+ // private static PropertyInfo _BooleanValue =
154+ // type.Property(nameof(JSValue.BooleanValue));
154155 public static Expression BooleanValue ( Expression exp )
155156 {
156157 if ( exp . NodeType == Expressions . YExpressionType . Conditional && exp is YConditionalExpression ce )
@@ -168,16 +169,18 @@ public static Expression BooleanValue(Expression exp)
168169 {
169170 return YExpression . Constant ( false ) ;
170171 }
171- return Expression . Property ( exp , _BooleanValue ) ;
172+ // return Expression.Property(exp, _BooleanValue);
173+ return exp . PropertyExpression < JSValue , bool > ( ( ) => ( x ) => x . BooleanValue ) ;
172174 }
173175
174176
175- private static MethodInfo _Add =
176- type . InternalMethod ( nameof ( Core . JSValue . AddValue ) , typeof ( JSValue ) ) ;
177+ // private static MethodInfo _Add =
178+ // type.InternalMethod(nameof(Core.JSValue.AddValue), typeof(JSValue));
177179
178180 public static Expression Add ( Expression target , Expression value )
179181 {
180- return Expression . Call ( target , _Add , value ) ;
182+ // return Expression.Call(target, _Add, value);
183+ return target . CallExpression < JSValue , JSValue , JSValue > ( ( ) => ( x , a ) => x . AddValue ( a ) , value ) ;
181184 }
182185
183186 private static MethodInfo _TypeOf =
@@ -390,6 +393,7 @@ internal static MethodInfo _CreateInstance
390393 public static Expression CreateInstance ( Expression target , Expression args )
391394 {
392395 return Expression . Call ( target , _CreateInstance , args ) ;
396+ // return target.CallExpression<JSValue, JSValue>(() => (x) => x.CreateInstance())
393397 }
394398
395399 internal static MethodInfo StaticEquals
@@ -520,14 +524,14 @@ public static Expression GetAllKeys(Expression target)
520524 ;
521525 }
522526
523- private static MethodInfo _ConvertTo =
524- type . InternalMethod ( nameof ( JSValue . TryConvertTo ) , typeof ( Type ) , typeof ( object ) . MakeByRefType ( ) ) ;
527+ // private static MethodInfo _ConvertTo =
528+ // type.InternalMethod(nameof(JSValue.TryConvertTo), typeof(Type), typeof(object).MakeByRefType());
525529
526- private static MethodInfo _ForceConvert =
527- type . PublicMethod ( nameof ( JSValue . ForceConvert ) , typeof ( Type ) ) ;
530+ // private static MethodInfo _ForceConvert =
531+ // type.PublicMethod(nameof(JSValue.ForceConvert), typeof(Type));
528532
529- private static MethodInfo _Convert =
530- type . InternalMethod ( nameof ( JSValue . Convert ) , typeof ( Type ) , typeof ( object ) ) ;
533+ // private static MethodInfo _Convert =
534+ // type.InternalMethod(nameof(JSValue.Convert), typeof(Type), typeof(object));
531535
532536 //public static Expression Convert(Expression jsValue, Type type, Expression defaultValue)
533537 //{
0 commit comments