Skip to content

Commit

Permalink
Methods removed
Browse files Browse the repository at this point in the history
  • Loading branch information
ackava committed Feb 11, 2025
1 parent 36887bb commit 1cf9ab4
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 92 deletions.
108 changes: 54 additions & 54 deletions YantraJS.Core/LinqExpressions/JSPropertyBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using YantraJS.Core;

namespace YantraJS.ExpHelper
{
public class JSPropertyBuilder
{
private static Type type = typeof(JSProperty);

private static ConstructorInfo _New =
type.GetConstructors().FirstOrDefault();

private static FieldInfo _Attributes =
type.InternalField(nameof(Core.JSProperty.Attributes));

private static FieldInfo _Key =
type.InternalField(nameof(Core.JSProperty.key));

private static FieldInfo _Get =
type.InternalField(nameof(Core.JSProperty.get));

private static FieldInfo _Value =
type.InternalField(nameof(Core.JSProperty.value));

public static Expression Value(Expression key, Expression value)
{
return Expression.MemberInit(Expression.New(typeof(Core.JSProperty)),
Expression.Bind(_Key, key),
Expression.Bind(_Value, value),
Expression.Bind(_Attributes, Expression.Constant(JSPropertyAttributes.EnumerableConfigurableValue))
);
}

public static Expression Property(Expression key, Expression getter, Expression setter)
{
getter = getter == null
? (Expression)Expression.Constant(null, typeof(Core.JSFunction))
: Expression.Convert(getter, typeof(Core.JSFunction));
setter = setter == null
? (Expression)Expression.Constant(null, typeof(Core.JSFunction))
: Expression.Convert(setter, typeof(Core.JSFunction));
return Expression.MemberInit(Expression.New(typeof(Core.JSProperty)),
Expression.Bind(_Key, key),
Expression.Bind(_Get, getter),
Expression.Bind(_Value, setter),
Expression.Bind(_Attributes, Expression.Constant(JSPropertyAttributes.EnumerableConfigurableReadonlyProperty))
);
}

}
}
//using System;
//using System.Linq;
//using System.Linq.Expressions;
//using System.Reflection;
//using YantraJS.Core;

//namespace YantraJS.ExpHelper
//{
// public class JSPropertyBuilder
// {
// private static Type type = typeof(JSProperty);

// private static ConstructorInfo _New =
// type.GetConstructors().FirstOrDefault();

// private static FieldInfo _Attributes =
// type.InternalField(nameof(Core.JSProperty.Attributes));

// private static FieldInfo _Key =
// type.InternalField(nameof(Core.JSProperty.key));

// private static FieldInfo _Get =
// type.InternalField(nameof(Core.JSProperty.get));

// private static FieldInfo _Value =
// type.InternalField(nameof(Core.JSProperty.value));

// public static Expression Value(Expression key, Expression value)
// {
// return Expression.MemberInit(Expression.New(typeof(Core.JSProperty)),
// Expression.Bind(_Key, key),
// Expression.Bind(_Value, value),
// Expression.Bind(_Attributes, Expression.Constant(JSPropertyAttributes.EnumerableConfigurableValue))
// );
// }

// public static Expression Property(Expression key, Expression getter, Expression setter)
// {
// getter = getter == null
// ? (Expression)Expression.Constant(null, typeof(Core.JSFunction))
// : Expression.Convert(getter, typeof(Core.JSFunction));
// setter = setter == null
// ? (Expression)Expression.Constant(null, typeof(Core.JSFunction))
// : Expression.Convert(setter, typeof(Core.JSFunction));
// return Expression.MemberInit(Expression.New(typeof(Core.JSProperty)),
// Expression.Bind(_Key, key),
// Expression.Bind(_Get, getter),
// Expression.Bind(_Value, setter),
// Expression.Bind(_Attributes, Expression.Constant(JSPropertyAttributes.EnumerableConfigurableReadonlyProperty))
// );
// }

// }
//}
76 changes: 38 additions & 38 deletions YantraJS.Core/LinqExpressions/JSTemplateArrayBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using YantraJS.Core.Extensions;
//using System;
//using System.Collections.Generic;
//using System.Linq.Expressions;
//using System.Reflection;
//using System.Text;
//using YantraJS.Core.Extensions;

using Exp = YantraJS.Expressions.YExpression;
using Expression = YantraJS.Expressions.YExpression;
using ParameterExpression = YantraJS.Expressions.YParameterExpression;
using LambdaExpression = YantraJS.Expressions.YLambdaExpression;
using LabelTarget = YantraJS.Expressions.YLabelTarget;
using SwitchCase = YantraJS.Expressions.YSwitchCaseExpression;
using GotoExpression = YantraJS.Expressions.YGoToExpression;
using TryExpression = YantraJS.Expressions.YTryCatchFinallyExpression;
using YantraJS.Expressions;
using YantraJS.Core.LambdaGen;
//using Exp = YantraJS.Expressions.YExpression;
//using Expression = YantraJS.Expressions.YExpression;
//using ParameterExpression = YantraJS.Expressions.YParameterExpression;
//using LambdaExpression = YantraJS.Expressions.YLambdaExpression;
//using LabelTarget = YantraJS.Expressions.YLabelTarget;
//using SwitchCase = YantraJS.Expressions.YSwitchCaseExpression;
//using GotoExpression = YantraJS.Expressions.YGoToExpression;
//using TryExpression = YantraJS.Expressions.YTryCatchFinallyExpression;
//using YantraJS.Expressions;
//using YantraJS.Core.LambdaGen;

namespace YantraJS.Core.LinqExpressions
{
public static class JSTemplateArrayBuilder
{
//namespace YantraJS.Core.LinqExpressions
//{
// public static class JSTemplateArrayBuilder
// {

//public static Type type = typeof(JSTemplateArray);
// //public static Type type = typeof(JSTemplateArray);

//private static MethodInfo _new =
// type.PublicMethod(nameof(JSTemplateArray.New), typeof(string[]), typeof(string[]), typeof(JSValue[]));
// //private static MethodInfo _new =
// // type.PublicMethod(nameof(JSTemplateArray.New), typeof(string[]), typeof(string[]), typeof(JSValue[]));

//public static Expression New(IList<Expression> cooked, IList<Expression> raw, IList<Expression> args)
//{
// //public static Expression New(IList<Expression> cooked, IList<Expression> raw, IList<Expression> args)
// //{

// var c = Expression.NewArrayInit(typeof(string), cooked);
// var r = Expression.NewArrayInit(typeof(string), raw);
// var v = Expression.NewArrayInit(typeof(JSValue), args);
// // return Expression.Call(null, _new, c, r, v);
// return NewLambdaExpression.StaticCallExpression<JSValue>(
// () => () => JSTemplateArray.New(null as string[],null as string[], null as JSValue[])
// ,c
// ,r
// ,v
// );
//}
// // var c = Expression.NewArrayInit(typeof(string), cooked);
// // var r = Expression.NewArrayInit(typeof(string), raw);
// // var v = Expression.NewArrayInit(typeof(JSValue), args);
// // // return Expression.Call(null, _new, c, r, v);
// // return NewLambdaExpression.StaticCallExpression<JSValue>(
// // () => () => JSTemplateArray.New(null as string[],null as string[], null as JSValue[])
// // ,c
// // ,r
// // ,v
// // );
// //}

}
}
// }
//}

0 comments on commit 1cf9ab4

Please sign in to comment.