Example #1
0
 protected override Expression VisitMethodCall(MethodCallExpression m)
 {
     if (m.IsContentIndexer())
     {
         Expression obj = Visit(m.Object);
         return(Expression.Call(obj, m.Method, m.Arguments[0]));
     }
     if (Iterator == null && m.IsForEachMethod())
     {
         Iterator = m.Arguments[1].RemoveCastToObject();
         return(m.Arguments[0]);
     }
     return(base.VisitMethodCall(m));
 }
Example #2
0
 protected override Expression VisitMethodCall(MethodCallExpression m)
 {
     if (!_scopeFound)
     {
         if (m.IsContentIndexer())
         {
             _currentScopeIndexer = m;
             var        finder = new ScopedForEachFinder();
             Expression rewrittenIndexerChild = finder.FindIterator(m.Arguments[0]);
             if (finder.Iterator != null)
             {
                 _scopeFound    = true;
                 ScopeToRewrite = _currentScopeIndexer;
                 HtmlBuilder    = rewrittenIndexerChild;
                 Iterator       = finder.Iterator;
             }
         }
     }
     return(base.VisitMethodCall(m));
 }