// AnalyzeEltExpr returns and Expression for accessing an element of an // aggregate structure. This also works for .NET objs with indexer Item // properties. We handle analyzing Elt for assignment in AnalyzeAssignExpr. // public static Expression AnalyzeEltExpr(SymplEltExpr expr, AnalysisScope scope) { List <Expression> args = new List <Expression>(); args.Add(AnalyzeExpr(expr.ObjectExpr, scope)); args.AddRange(expr.Indexes.Select(e => AnalyzeExpr(e, scope))); return(Expression.Dynamic( scope.GetRuntime().GetGetIndexBinder( new CallInfo(expr.Indexes.Length)), typeof(object), args )); }
// AnalyzeEltExpr returns and Expression for accessing an element of an // aggregate structure. This also works for .NET objs with indexer Item // properties. We handle analyzing Elt for assignment in AnalyzeAssignExpr. // public static Expression AnalyzeEltExpr(SymplEltExpr expr, AnalysisScope scope) { List<Expression> args = new List<Expression>(); args.Add(AnalyzeExpr(expr.ObjectExpr, scope)); args.AddRange(expr.Indexes.Select(e => AnalyzeExpr(e, scope))); return Expression.Dynamic( scope.GetRuntime().GetGetIndexBinder( new CallInfo(expr.Indexes.Length)), typeof(object), args ); }