Пример #1
0
 protected override Expression VisitVelocityExpression(VelocityExpression node)
 {
     if (_symbolDocument != null)
     {
         var extension = node as VelocityExpression;
         if (extension != null && extension.SourceInfo != null && extension.SourceInfo != _currentSourceInfo)
         {
             _currentSourceInfo = extension.SourceInfo;
             return(Expression.Block(
                        Expression.DebugInfo(_symbolDocument, _currentSourceInfo.StartLine, _currentSourceInfo.StartColumn, _currentSourceInfo.EndLine, _currentSourceInfo.EndColumn),
                        Visit(node)
                        ));
         }
     }
     return(base.VisitVelocityExpression(node));
 }
        protected virtual Expression VisitVelocityExpression(VelocityExpression node)
        {
            switch (node.VelocityExpressionType)
            {
            case VelocityExpressionType.CoerceToBoolean:
                return(VisitCoerceToBoolean((CoerceToBooleanExpression)node));

            case VelocityExpressionType.CustomDirective:
                return(VisitCustomDirective((CustomDirectiveExpression)node));

            case VelocityExpressionType.Dictionary:
                return(VisitDictionary((DictionaryExpression)node));

            case VelocityExpressionType.DictionaryString:
                return(VisitDictionaryString((DictionaryStringExpression)node));

            case VelocityExpressionType.Directive:
                return(VisitDirective((Directive)node));

            case VelocityExpressionType.DirectiveWord:
                return(VisitDirectiveWord((DirectiveWord)node));

            case VelocityExpressionType.Foreach:
                return(VisitForeach((ForeachExpression)node));

            case VelocityExpressionType.GlobalVariable:
                return(VisitGlobalVariable((GlobalVariableExpression)node));

            case VelocityExpressionType.IndexInvocation:
                return(VisitIndexInvocation((IndexInvocationExpression)node));

            case VelocityExpressionType.IntegerRange:
                return(VisitIntegerRange((IntegerRangeExpression)node));

            case VelocityExpressionType.InterpolatedString:
                return(VisitInterpolatedString((InterpolatedStringExpression)node));

            case VelocityExpressionType.Binary:
                return(VisitBinaryOperation((BinaryOperationExpression)node));

            case VelocityExpressionType.MethodInvocation:
                return(VisitMethodInvocation((MethodInvocationExpression)node));

            case VelocityExpressionType.ObjectArray:
                return(VisitObjectArray((ObjectArrayExpression)node));

            case VelocityExpressionType.PropertyAccess:
                return(VisitPropertyAccess((PropertyAccessExpression)node));

            case VelocityExpressionType.Reference:
                return(VisitReference((ReferenceExpression)node));

            case VelocityExpressionType.RenderableExpression:
                return(VisitRenderableExpression((RenderableExpression)node));

            case VelocityExpressionType.RenderedBlock:
                return(VisitRenderedBlock((RenderedBlock)node));

            case VelocityExpressionType.SetDirective:
                return(VisitSetDirective((SetDirective)node));

            case VelocityExpressionType.SetMember:
                return(VisitSetMember((SetMemberExpression)node));

            case VelocityExpressionType.SetIndex:
                return(VisitSetIndex((SetIndexExpression)node));

            case VelocityExpressionType.TemplatedForeach:
                return(VisitTemplatedForEach((TemplatedForeachExpression)node));

            case VelocityExpressionType.Variable:
                return(VisitVariable((VariableExpression)node));

            case VelocityExpressionType.TemporaryVariableScope:
                return(VisitTemporaryVariableScope((TemporaryVariableScopeExpression)node));

            default:
                throw new InvalidOperationException($"Unexpected VelocityExpressionType: {node.VelocityExpressionType}");
            }
        }