• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# DoWhileStatement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DoWhileStatement的典型用法代码示例。如果您正苦于以下问题:C# DoWhileStatement类的具体用法?C# DoWhileStatement怎么用?C# DoWhileStatement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DoWhileStatement类属于命名空间,在下文中一共展示了DoWhileStatement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: VisitDoWhileStatement

		public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement)
		{
            var token = CreateBlock(string.Format("while ({0})", doWhileStatement.Condition.GetText()), SDNodeRole.DoWhileLoop);
            _tokenList.Add(token);

            VisitChildren(token.Statements, doWhileStatement.EmbeddedStatement);
		}
开发者ID:JoeHosman,项目名称:sharpDox,代码行数:7,代码来源:MethodVisitor.cs


示例2: ConvertToWhileLoop

		static void ConvertToWhileLoop(Script script, DoWhileStatement originalStatement)
		{
			script.Replace(originalStatement, new WhileStatement {
				Condition = originalStatement.Condition.Clone(),
				EmbeddedStatement = originalStatement.EmbeddedStatement.Clone()
			});
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:7,代码来源:ConvertDoWhileToWhileLoopAction.cs


示例3: ApplyAction

		void ApplyAction(Script script, WhileStatement statement) {
			var doWhile = new DoWhileStatement {
				Condition = statement.Condition.Clone(),
				EmbeddedStatement = statement.EmbeddedStatement.Clone()
			};

			script.Replace(statement, doWhile);
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:8,代码来源:ConvertWhileToDoWhileLoopAction.cs


示例4: VisitDoWhileStatement

 public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement)
 {
     bool oldIsInsideLoop = _isInsideLoop;
     try {
         _isInsideLoop = true;
         base.VisitDoWhileStatement(doWhileStatement);
     }
     finally {
         _isInsideLoop = oldIsInsideLoop;
     }
 }
开发者ID:JimmyJune,项目名称:SaltarelleCompiler,代码行数:11,代码来源:VariableGatherer.cs


示例5: VisitDoWhileStatement

 public override object VisitDoWhileStatement(DoWhileStatement doWhileStatement, object data)
 {
     if (doWhileStatement.EmbeddedStatement is BlockStatement)
     {
         foreach (Statement innerstatement in (BlockStatement)doWhileStatement.EmbeddedStatement)
         {
             if (innerstatement is WhileStatement || innerstatement is DoWhileStatement)
                 UnlockWith(doWhileStatement);
         }
     }
     return base.VisitDoWhileStatement(doWhileStatement, data);
 }
开发者ID:cohenw,项目名称:strokes,代码行数:12,代码来源:NestedWhileStatementAchievement.cs


示例6: ReplaceJump

        static BlockStatement ReplaceJump(JumpStatement jump, BlockStatement block)
        {
            if (jump.StartOffset < block.StartOffset)
                throw new ArgumentOutOfRangeException("jump", "jump should be inside the given block");
            if (jump.JumpOffset > block.EndOffset)
                throw new ArgumentOutOfRangeException("jump", "jump should be inside the given block");

            var newBlock = new BlockStatement();
            var doWhileStatement = new DoWhileStatement(jump.Condition, new BlockStatement()){ StartOffset = jump.StartOffset, EndOffset = jump.JumpOffset };
            var inside = false;
            foreach (var statement in block)
            {
                if (statement.StartOffset == jump.JumpOffset)
                {                    
                    ((BlockStatement)doWhileStatement.Statement).AddStatement(statement);
                    inside = true;
                }
                else if (statement.StartOffset == jump.StartOffset)
                {
                    if (doWhileStatement == null)
                        throw new InvalidOperationException("DoWhileStatement can't be null");
                    newBlock.AddStatement(doWhileStatement);
                    doWhileStatement = null;
                    inside = false;
                }
                else if (inside)
                {
                    ((BlockStatement)doWhileStatement.Statement).AddStatement(statement);
                }
                else
                {
                    var lastStatement = newBlock.LastOrDefault();
                    if (lastStatement != null && lastStatement.EndOffset > statement.StartOffset)
                    {
                        throw new NotSupportedException("invalid Statement");
                    }
                    newBlock.AddStatement(statement);
                }
            }
            return newBlock;
        }
开发者ID:scemino,项目名称:nscumm,代码行数:41,代码来源:ReplaceJumpToWhile.cs


示例7: Visit

 public void Visit(DoWhileStatement expression)
 {
     outStream.WriteLine("do {");
     expression.Statement.Accept(this);
     outStream.WriteLine();
     outStream.Write("} while (");
     expression.Condition.Accept(this);
     outStream.Write(")");
 }
开发者ID:reshadi2,项目名称:mcjs,代码行数:9,代码来源:AstWriter.cs


示例8: ParseDoWhile

 private Statement ParseDoWhile(TokenSet followers)
   //^ requires this.currentToken == Token.Do;
   //^ ensures followers[this.currentToken] || this.currentToken == Token.EndOfFile;
 {
   SourceLocationBuilder slb = new SourceLocationBuilder(this.scanner.SourceLocationOfLastScannedToken);
   this.GetNextToken();
   Statement body = this.ParseStatement(followers|Token.While);
   if (body is EmptyStatement)
     this.HandleError(body.SourceLocation, Error.PossibleMistakenNullStatement);
   this.Skip(Token.While);
   Expression condition = this.ParseParenthesizedExpression(false, followers|Token.Semicolon);
   DoWhileStatement result = new DoWhileStatement(body, condition, slb);
   this.SkipSemiColon(followers);
   return result;
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:15,代码来源:Parser.cs


示例9: VisitDoWhileStatement

		public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement)
		{
			PlaceOnNewLine(policy.PlaceWhileOnNewLine, doWhileStatement.WhileToken);
			FixEmbeddedStatment(policy.StatementBraceStyle, policy.WhileBraceForcement, doWhileStatement.EmbeddedStatement);
		}
开发者ID:txdv,项目名称:monodevelop,代码行数:5,代码来源:AstFormattingVisitor.cs


示例10: VisitDoWhileStatement

 public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement)
 {
     if (findReturn)
     {
         base.VisitDoWhileStatement(doWhileStatement);
     }
 }
开发者ID:TinkerWorX,项目名称:Bridge,代码行数:7,代码来源:LambdaVisitor.cs


示例11: VisitDoWhileStatement

 public void VisitDoWhileStatement(DoWhileStatement doWhileStatement)
 {
     VisitExpression(doWhileStatement.Condition);
     VisitStatement(doWhileStatement.Body);
 }
开发者ID:xuld,项目名称:DocPlus,代码行数:5,代码来源:DocAstVistor.cs


示例12: VisitDoWhileStatement

 public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement)
 {
     new DoWhileBlock(this, doWhileStatement).Emit();
 }
开发者ID:yindongfei,项目名称:bridge.lua,代码行数:4,代码来源:Emitter.Visitor.cs


示例13: VisitDoWhileStatement

			public override void VisitDoWhileStatement (DoWhileStatement doWhileStatement)
			{
				base.VisitDoWhileStatement (doWhileStatement);

				CheckCondition (doWhileStatement.Condition);
			}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:6,代码来源:ConstantConditionIssue.cs


示例14: VisitDoWhileStatement

		public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement) {
			var body = CreateInnerCompiler().Compile(doWhileStatement.EmbeddedStatement);
			var compiledCondition = CompileExpression(doWhileStatement.Condition, CompileExpressionFlags.ReturnValueIsImportant);
			if (compiledCondition.AdditionalStatements.Count > 0)
				body = JsStatement.Block(body.Statements.Concat(compiledCondition.AdditionalStatements));
			_result.Add(JsStatement.DoWhile(compiledCondition.Expression, body));
		}
开发者ID:chenxustu1,项目名称:SaltarelleCompiler,代码行数:7,代码来源:StatementCompiler.cs


示例15: VisitDoWhileStatement

		public virtual void VisitDoWhileStatement (DoWhileStatement doWhileStatement)
		{
			VisitChildren (doWhileStatement);
		}
开发者ID:modulexcite,项目名称:ICSharpCode.Decompiler-retired,代码行数:4,代码来源:DepthFirstAstVisitor.cs


示例16: Visit

			public override object Visit (Do doStatement)
			{
				var result = new DoWhileStatement ();
				var location = LocationsBag.GetLocations (doStatement);
				result.AddChild (new CSharpTokenNode (Convert (doStatement.loc), "do".Length), DoWhileStatement.DoKeywordRole);
				result.AddChild ((MonoDevelop.CSharp.Ast.Statement)doStatement.EmbeddedStatement.Accept (this), WhileStatement.Roles.EmbeddedStatement);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[0]), "while".Length), DoWhileStatement.WhileKeywordRole);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), DoWhileStatement.Roles.LPar);
				result.AddChild ((MonoDevelop.CSharp.Ast.Expression)doStatement.expr.Accept (this), DoWhileStatement.Roles.Condition);
				if (location != null) {
					result.AddChild (new CSharpTokenNode (Convert (location[2]), 1), DoWhileStatement.Roles.RPar);
					result.AddChild (new CSharpTokenNode (Convert (location[3]), 1), DoWhileStatement.Roles.Semicolon);
				}
				
				return result;
			}
开发者ID:sandyarmstrong,项目名称:monodevelop,代码行数:18,代码来源:CSharpParser.cs


示例17: GenerateDoWhileStatement

        /// <summary>
        ///     Generates the code for a DoWhileStatement node.
        /// </summary>
        /// <param name="dws">The DoWhileStatement node.</param>
        /// <returns>String containing C# code for DoWhileStatement dws.</returns>
        private string GenerateDoWhileStatement(DoWhileStatement dws)
        {
            StringBuilder retVal = new StringBuilder();

            retVal.Append(GenerateIndentedLine("do", dws));
            if (IsParentEnumerable)
            {
                retVal.Append(GenerateLine("{")); // SLAM!
                retVal.Append(GenerateLine("if (CheckSlice()) yield return null;"));
            }

            // CompoundStatement handles indentation itself but we need to do it
            // otherwise.
            bool indentHere = dws.kids.Top is Statement;
            if (indentHere) m_braceCount++;
            retVal.Append(GenerateNode((SYMBOL) dws.kids.Pop()));
            if (indentHere) m_braceCount--;

            if (IsParentEnumerable)
                retVal.Append(GenerateLine("}"));

            bool marc = FuncCallsMarc();

            //Forces all functions to use MoveNext() instead of .Current, as it never changes otherwise, and the loop runs infinitely

            m_isInEnumeratedDeclaration = true;

            retVal.Append(GenerateIndented("while (", dws));
            retVal.Append(GenerateNode((SYMBOL) dws.kids.Pop()));
            retVal.Append(GenerateLine(");"));

            m_isInEnumeratedDeclaration = false; //End above

            return DumpFunc(marc) + retVal.ToString() + DumpAfterFunc(marc);
        }
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:40,代码来源:CSCodeGenerator.cs


示例18: Visit

 public virtual void Visit(DoWhileStatement node)
 {
     DefaultVisit(node);
 }
开发者ID:scemino,项目名称:nscumm,代码行数:4,代码来源:DefaultVisitor.cs


示例19: VisitDoWhileStatement

        public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement)
        {
            this.loopLevel++;

            doWhileStatement.EmbeddedStatement = GetLoopBlock (doWhileStatement.EmbeddedStatement);

            base.VisitDoWhileStatement (doWhileStatement);

            this.loopLevel--;
        }
开发者ID:ermau,项目名称:Instant,代码行数:10,代码来源:InstrumentingRewriter.cs


示例20: DoWhileBlock

 public DoWhileBlock(IEmitter emitter, DoWhileStatement doWhileStatement)
     : base(emitter, doWhileStatement)
 {
     this.Emitter = emitter;
     this.DoWhileStatement = doWhileStatement;
 }
开发者ID:yindongfei,项目名称:bridge.lua,代码行数:6,代码来源:DoWhileBlock.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DoWorkEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# DoStatementSyntax类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap