当前位置: 首页>>代码示例>>C#>>正文


C# RenderContext.StartLine方法代码示例

本文整理汇总了C#中RenderContext.StartLine方法的典型用法代码示例。如果您正苦于以下问题:C# RenderContext.StartLine方法的具体用法?C# RenderContext.StartLine怎么用?C# RenderContext.StartLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RenderContext的用法示例。


在下文中一共展示了RenderContext.StartLine方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Render

 public override bool Render(RenderContext dest)
 {
     // Render the statement, need special handling to insert
     // a space if don't have a braced statement block
     dest.Append("do");
     if (Code.RenderIndented(dest))
         dest.Append(';');
     dest.StartLine();
     dest.Append("while(");
     Condition.Render(dest);
     dest.Append(')');
     return false;
 }
开发者ID:blyry,项目名称:MiniME,代码行数:13,代码来源:StatementDoWhile.cs

示例2: Render

        public override bool Render(RenderContext dest)
        {
            // Enter a new symbol scope since the exception variable
            // can be obfuscated
            dest.EnterScope(Scope);

            // Catch clause
            dest.StartLine();
            dest.Append("catch(");
            dest.Append(dest.Symbols.GetObfuscatedSymbol(ExceptionVariable));
            if (Condition != null)
            {
                dest.Append("if");
                Condition.Render(dest);
            }
            dest.Append(')');

            // Associated code
            Code.Render(dest);

            // Done
            dest.LeaveScope();
            return false;
        }
开发者ID:blyry,项目名称:MiniME,代码行数:24,代码来源:StatementTryCatchFinally.cs

示例3: Render

        public override bool Render(RenderContext dest)
        {
            if (Values.Count == 0)
            {
                dest.Append("{}");
                return true;
            }

            dest.Append('{');
            dest.Indent();
            for (var i = 0; i < Values.Count; i++)
            {
                if (i > 0)
                    dest.Append(',');

                dest.StartLine();

                // Key - if key is a valid identifier, don't quote it
                var kp = Values[i];
                if (kp.Key.GetType() == typeof(ast.ExprNodeIdentifier))
                {
                    dest.Append(dest.Members.GetObfuscatedSymbol(((ast.ExprNodeIdentifier)kp.Key).Name));
                }
                else if (kp.Key.GetType() == typeof(String) && Tokenizer.IsIdentifier((string)kp.Key) && !Tokenizer.IsKeyword((string)kp.Key))
                {
                    dest.Append((string)kp.Key);
                }
                else
                {
                    ExprNodeLiteral.RenderValue(dest, kp.Key);
                }

                // Value
                dest.Append(':');
                kp.Value.Render(dest);
            }
            dest.Unindent();
            dest.StartLine();
            dest.Append('}');
            return true;
        }
开发者ID:blyry,项目名称:MiniME,代码行数:41,代码来源:ExprNodeObjectLiteral.cs

示例4: Render

        public override bool Render(RenderContext dest)
        {
            // Statement
            dest.Append("switch(");
            TestExpression.Render(dest);
            dest.Append(')');
            dest.StartLine();

            // Opening brace
            dest.Append('{');

            // Cases
            dest.Indent();
            bool bNeedSemicolon=false;

            for (int i=0; i<Cases.Count; i++)
            {
                var c = Cases[i];

                // Separator
                if (bNeedSemicolon)
                    dest.Append(';');

                // `case` or `default`
                dest.StartLine();
                if (c.Value != null)
                {
                    dest.Append("case");
                    c.Value.Render(dest);
                    dest.Append(":");
                }
                else
                {
                    dest.Append("default:");
                }

                // Is there any code associated with this case?
                if (c.Code != null)
                {
                    bNeedSemicolon = c.Code.RenderIndented(dest);

                    // Check for no break between case blocks
                    if (c.Code.Content.Count > 0 && i!=Cases.Count-1)
                    {
                        if (!c.Code.Content[c.Code.Content.Count - 1].BreaksExecutionFlow())
                        {
                            dest.Compiler.RecordWarning(Cases[i+1].Code.Bookmark, "execution falls through to next case.   Insert a comment \"// fall through\" to disable this warning");
                        }
                    }
                }
                else
                {
                    bNeedSemicolon = false;
                }
            }

            // Close brace
            dest.Unindent();
            dest.StartLine();
            dest.Append("}");
            return false;
        }
开发者ID:blyry,项目名称:MiniME,代码行数:62,代码来源:StatementSwitch.cs

示例5: RenderIndented

        // Render this node in an indented block (if in formatted mode)
        public bool RenderIndented(RenderContext dest)
        {
            bool bIndent = false;

            if (dest.Compiler.Formatted)
            {
                bool Braces=(HasBraces == TriState.Yes) || (HasBraces == TriState.Maybe && Content.Count != 1);
                bIndent=!Braces;
            }

            if (bIndent)
            {
                dest.Indent();
                dest.StartLine();
                bool b = Render(dest);
                dest.Unindent();
                return b;
            }
            else
            {
                return Render(dest);
            }
        }
开发者ID:blyry,项目名称:MiniME,代码行数:24,代码来源:CodeBlock.cs

示例6: Render

        public override bool Render(RenderContext dest)
        {
            // some statement blocks require braces, even if they only
            // contain a single statement

            // Opening brace
            if (WillRenderBraces)
            {
                dest.StartLine();
                dest.Append('{');
                dest.Indent();
                dest.StartLine();
            }

            // Render each statement, optionally putting a brace between them
            bool bNeedSemicolon = false;
            bool bUnreachable = false;
            for (var i=0; i<Content.Count; i++)
            {
                var s = Content[i];

                // Unreachable code?
                if (bUnreachable)
                {
                    if (!s.IsDeclarationOnly())
                    {
                        dest.Compiler.RecordWarning(Content[i].Bookmark, "unreachable code");
                        bUnreachable = false;
                    }
                }

                // Pending semicolon?
                if (bNeedSemicolon)
                    dest.Append(';');

                if (i>0)
                    dest.StartLine();

                // Get the next statement and render it
                bNeedSemicolon=s.Render(dest);

                bUnreachable |= s.BreaksExecutionFlow();

                // In formatted mode, append the terminating semicolon immediately
                if (bNeedSemicolon && dest.Compiler.Formatted)
                {
                    dest.Append(';');
                    bNeedSemicolon = false;
                }
            }

            // Closing brace
            if (WillRenderBraces)
            {
                dest.Unindent();
                dest.StartLine();
                dest.Append('}');
                return false;
            }

            return bNeedSemicolon;
        }
开发者ID:blyry,项目名称:MiniME,代码行数:62,代码来源:CodeBlock.cs

示例7: Render

        public override bool Render(RenderContext dest)
        {
            // Statement
            dest.Append("if(");
            Condition.Render(dest);
            dest.Append(")");

            // True block
            bool retv;
            if (CheckForHangingElse())
            {
                dest.StartLine();
                dest.Append("{");
                TrueStatement.RenderIndented(dest);
                dest.StartLine();
                dest.Append("}");
                retv = false;
            }
            else
            {
                retv = TrueStatement.RenderIndented(dest);
            }

            // False block
            if (FalseStatement != null)
            {
                if (retv)
                    dest.Append(';');

                dest.StartLine();

                dest.Append("else");

                retv = FalseStatement.RenderIndented(dest);
            }

            return retv;
        }
开发者ID:blyry,项目名称:MiniME,代码行数:38,代码来源:StatementIfElse.cs


注:本文中的RenderContext.StartLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。