コード例 #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()));
        }
コード例 #2
0
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var start = symbolGenerator.GetCurrentPosition();

            symbolGenerator
            .Write(_left)
            .Write(" + ")
            .Write(_right);
            return(start.BlockTo(symbolGenerator.GetCurrentPosition()));
        }
コード例 #3
0
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var location = symbolGenerator.GetCurrentPosition();

            symbolGenerator
            .Write(_arrayInstance)
            .Write(" [")
            .Write(_index)
            .Write("]");
            return(location.BlockTo(symbolGenerator.GetCurrentPosition()));
        }
コード例 #4
0
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var start = symbolGenerator.GetCurrentPosition();

            symbolGenerator
            .Write("if (")
            .Write(_predicate)
            .Write(")")
            .WriteNamedBlock("", _thenExpression);
            return(start.BlockTo(symbolGenerator.GetCurrentPosition()));
        }
コード例 #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));
        }
コード例 #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()));
        }
コード例 #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()));
        }
コード例 #8
0
        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()));
        }
コード例 #9
0
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var start = symbolGenerator.GetCurrentPosition();

            return(start.BlockTo(symbolGenerator
                                 .Write(string.Format("({0}) ", ExpressionType.FullName))
                                 .Write(Expression)
                                 .GetCurrentPosition()));
        }
コード例 #10
0
        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()));
        }
コード例 #11
0
        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));
        }
コード例 #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()));
        }
コード例 #13
0
        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()));
        }
コード例 #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()));
        }
コード例 #15
0
        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));
        }
コード例 #16
0
 internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
 {
     return(symbolGenerator.GetCurrentPosition().BlockTo(
                symbolGenerator.Write(string.Format("new {0} [", _elementType.FullName)).Write(_count).Write("]").GetCurrentPosition()));
 }
コード例 #17
0
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var positions = symbolGenerator.GetCurrentPosition();

            return(positions.BlockTo(positions));
        }
コード例 #18
0
        internal override CodeBlock WriteDebugCode(IMethodSymbolGenerator symbolGenerator)
        {
            var start = symbolGenerator.GetCurrentPosition();

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

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