Exemple #1
0
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var start = symbolGenerator.GetCurrentPosition();

            if (ExpressionType == typeof(void))
            {
                symbolGenerator
                .Write("if (")
                .Write(_predicate)
                .Write(")")
                .WriteNamedBlock("", _thenExpression)
                .Write("else ")
                .WriteNamedBlock("", _elseExpression);
            }
            else
            {
                symbolGenerator
                .Write("(")
                .Write(_predicate)
                .Write(") ? ")
                .Write(_thenExpression)
                .Write(" : ")
                .Write(_elseExpression);
            }
            return(start.BlockTo(symbolGenerator.GetCurrentPosition()));
        }
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var start = symbolGenerator.GetCurrentPosition();

            symbolGenerator
            .Write(_left)
            .Write(" + ")
            .Write(_right);
            return(start.BlockTo(symbolGenerator.GetCurrentPosition()));
        }
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var location = symbolGenerator.GetCurrentPosition();

            symbolGenerator
            .Write(_arrayInstance)
            .Write(" [")
            .Write(_index)
            .Write("]");
            return(location.BlockTo(symbolGenerator.GetCurrentPosition()));
        }
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var start = symbolGenerator.GetCurrentPosition();

            symbolGenerator
            .Write("if (")
            .Write(_predicate)
            .Write(")")
            .WriteNamedBlock("", _thenExpression);
            return(start.BlockTo(symbolGenerator.GetCurrentPosition()));
        }
Exemple #5
0
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var begin = symbolGenerator.GetCurrentPosition();

            symbolGenerator
            .Write("{")
            .EnterScope();

            for (int index = 0; index < _expressions.Length; index++)
            {
                if (index + 1 < _expressions.Length)
                {
                    symbolGenerator.Write(_expressions[index]).WriteStatementEnd("");
                }
                else
                {
                    symbolGenerator.Write("return ").Write(_expressions[index]).Write(";");
                }
            }

            var end = symbolGenerator
                      .LeaveScope()
                      .Write("}")
                      .GetCurrentPosition();

            return(begin.BlockTo(end));
        }
Exemple #6
0
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            symbolGenerator.Write("catch");
            if (_exceptionType == null)
            {
                return(symbolGenerator.GetCurrentPosition().BlockTo(symbolGenerator.GetCurrentPosition()));
            }
            symbolGenerator.Write(" (");
            var begin = symbolGenerator.GetCurrentPosition();

            symbolGenerator.Write(_exceptionType.FullName);
            if (_exceptionVariable != null)
            {
                symbolGenerator.Write(" " + _exceptionVariable.Name);
            }
            return(begin.BlockTo(symbolGenerator.Write(")").GetCurrentPosition()));
        }
Exemple #7
0
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var start = symbolGenerator.GetCurrentPosition();

            symbolGenerator.WriteNamedBlock("try", _tryExpression);

            foreach (var catchBlock in _catchBlocks)
            {
                catchBlock.WriteDebugCode(symbolGenerator);
            }

            if (_finallyExpression != null)
            {
                symbolGenerator.WriteNamedBlock("finally", _finallyExpression);
            }
            return(start.BlockTo(symbolGenerator.GetCurrentPosition()));
        }
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var begin = symbolGenerator.GetCurrentPosition();

            if (ExpressionType == typeof(string))
            {
                symbolGenerator.Write(DumpStringValue());
            }
            else if (ExpressionType == typeof(Type))
            {
                symbolGenerator.Write(string.Format("typeof({0})", _value));
            }
            else
            {
                symbolGenerator.Write(string.Format(CultureInfo.InvariantCulture, "{0}", _value));
            }
            return(begin.BlockTo(symbolGenerator.GetCurrentPosition()));
        }
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var start = symbolGenerator.GetCurrentPosition();

            return(start.BlockTo(symbolGenerator
                                 .Write(string.Format("({0}) ", ExpressionType.FullName))
                                 .Write(Expression)
                                 .GetCurrentPosition()));
        }
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var start = symbolGenerator.GetCurrentPosition();

            symbolGenerator.Write(string.Format("{0} {1}", _variable.VariableType.FullName, _variable.Name));
            if (_initialValue != null)
            {
                symbolGenerator.Write(" = ").Write(_initialValue);
            }
            return(start.BlockTo(symbolGenerator.Write(";").GetCurrentPosition()));
        }
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var begin = symbolGenerator.GetCurrentPosition();
            var end   = symbolGenerator
                        .Write(_arrayInstance)
                        .Write(" [")
                        .Write(_index)
                        .Write("] = ")
                        .Write(_value)
                        .Write(";")
                        .GetCurrentPosition();

            return(begin.BlockTo(end));
        }
Exemple #12
0
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var start = symbolGenerator.GetCurrentPosition();

            if (_value != null)
            {
                symbolGenerator.Write("return ").Write(_value);
            }
            else
            {
                symbolGenerator.Write("return");
            }
            return(start.BlockTo(symbolGenerator.Write(";").GetCurrentPosition()));
        }
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var begin = symbolGenerator.GetCurrentPosition();

            if (_instance != null)
            {
                symbolGenerator.Write(_instance);
            }
            symbolGenerator.Write(GetMethodCodeHeader());
            for (int i = 0; i < _arguments.Length; ++i)
            {
                symbolGenerator.Write(_arguments[i]);
                if (i + 1 < _arguments.Length)
                {
                    symbolGenerator.Write(", ");
                }
            }
            symbolGenerator.Write(")");
            if (ExpressionType == typeof(void))
            {
                return(begin.BlockTo(symbolGenerator.Write(";").GetCurrentPosition()));
            }
            return(begin.BlockTo(symbolGenerator.GetCurrentPosition()));
        }
Exemple #14
0
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var start = symbolGenerator.GetCurrentPosition();

            symbolGenerator.Write(string.Format("new {0}(", ExpressionType.FullName));
            for (int i = 0; i < _arguments.Length; i++)
            {
                symbolGenerator.Write(_arguments[i]);
                if (i + 1 < _arguments.Length)
                {
                    symbolGenerator.Write(", ");
                }
            }
            return(start.BlockTo(symbolGenerator.Write(")").GetCurrentPosition()));
        }
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            if (_instance != null)
            {
                symbolGenerator.Write(_instance);
            }
            var start = symbolGenerator.GetCurrentPosition();
            var end   = symbolGenerator
                        .Write(string.Format("{0}.{1} = ", (_instance == null) ? _fieldInfo.DeclaringType.FullName : string.Empty, _fieldInfo.Name))
                        .Write(_value)
                        .Write(";")
                        .GetCurrentPosition();

            return(start.BlockTo(end));
        }
 internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
 {
     return(symbolGenerator.GetCurrentPosition().BlockTo(
                symbolGenerator.Write(string.Format("new {0} [", _elementType.FullName)).Write(_count).Write("]").GetCurrentPosition()));
 }
Exemple #17
0
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var positions = symbolGenerator.GetCurrentPosition();

            return(positions.BlockTo(positions));
        }
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var start = symbolGenerator.GetCurrentPosition();

            return(start.BlockTo(symbolGenerator.Write(_variable.Name).Write(" = ").Write(_value).Write(";").GetCurrentPosition()));
        }
Exemple #19
0
 internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
 {
     return(symbolGenerator.GetCurrentPosition().BlockTo(symbolGenerator.Write("null").GetCurrentPosition()));
 }
Exemple #20
0
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var begin = symbolGenerator.GetCurrentPosition();

            return(begin.BlockTo(symbolGenerator.Write(_left).Write(GetDumpSymbol()).Write(_right).GetCurrentPosition()));
        }
 internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
 {
     return(symbolGenerator.GetCurrentPosition().BlockTo(symbolGenerator.Write("throw ").Write(_expression).Write(";").GetCurrentPosition()));
 }
 internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
 {
     return(symbolGenerator.GetCurrentPosition().BlockTo(symbolGenerator.WriteNamedBlock("while (true)", _loop).GetCurrentPosition()));
 }
 internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
 {
     return(symbolGenerator.GetCurrentPosition().BlockTo(symbolGenerator.Write(string.Format("p{0}", _parameterId)).GetCurrentPosition()));
 }