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


C# BlockVariable类代码示例

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


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

示例1: Visit

			public override object Visit(BlockVariable blockVariableDeclaration)
			{
				var result = new VariableDeclarationStatement();
				result.AddChild(ConvertToType(blockVariableDeclaration.TypeExpression), Roles.Type);
				
				var varInit = new VariableInitializer();
				var location = LocationsBag.GetLocations(blockVariableDeclaration);
				varInit.AddChild(Identifier.Create(blockVariableDeclaration.Variable.Name, Convert(blockVariableDeclaration.Variable.Location)), Roles.Identifier);
				if (blockVariableDeclaration.Initializer != null) {
					if (location != null && location.Count > 0)
						varInit.AddChild(new CSharpTokenNode(Convert(location [0]), Roles.Assign), Roles.Assign);
					varInit.AddChild((Expression)blockVariableDeclaration.Initializer.Accept(this), Roles.Expression);
				}
				
				result.AddChild(varInit, Roles.Variable);
				
				if (blockVariableDeclaration.Declarators != null) {
					foreach (var decl in blockVariableDeclaration.Declarators) {
						var loc = LocationsBag.GetLocations(decl);
						var init = new VariableInitializer();
						if (loc != null && loc.Count > 0)
							result.AddChild(new CSharpTokenNode(Convert(loc [0]), Roles.Comma), Roles.Comma);
						init.AddChild(Identifier.Create(decl.Variable.Name, Convert(decl.Variable.Location)), Roles.Identifier);
						if (decl.Initializer != null) {
							if (loc != null && loc.Count > 1)
								init.AddChild(new CSharpTokenNode(Convert(loc [1]), Roles.Assign), Roles.Assign);
							init.AddChild((Expression)decl.Initializer.Accept(this), Roles.Expression);
						}
						result.AddChild(init, Roles.Variable);
					}
				}
				if (location != null && (blockVariableDeclaration.Initializer == null || location.Count > 1))
					result.AddChild(new CSharpTokenNode(Convert(location [location.Count - 1]), Roles.Semicolon), Roles.Semicolon);
				return result;
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:35,代码来源:CSharpParser.cs

示例2: case_873

void case_873()
#line 5818 "cs-parser.jay"
{
		var lt = (LocatedToken) yyVals[0+yyTop];
		var li = new LocalVariable (current_block, lt.Value, lt.Location);
		current_block.AddLocalName (li);
		current_variable = new BlockVariable ((FullNamedExpression) yyVals[-1+yyTop], li);
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:8,代码来源:cs-parser.cs

示例3: end_anonymous

/*
 * Completes the anonymous method processing, if lambda_expr is null, this
 * means that we have a Statement instead of an Expression embedded 
 */
AnonymousMethodExpression end_anonymous (ParametersBlock anon_block)
{
	AnonymousMethodExpression retval;

	if (async_block)
		anon_block.IsAsync = true;

	current_anonymous_method.Block = anon_block;
	retval = current_anonymous_method;

	async_block = (bool) oob_stack.Pop ();
	current_variable = (BlockVariable) oob_stack.Pop ();
	current_local_parameters = (ParametersCompiled) oob_stack.Pop ();
	current_anonymous_method = (AnonymousMethodExpression) oob_stack.Pop ();

	return retval;
}
开发者ID:segaman,项目名称:NRefactory,代码行数:21,代码来源:cs-parser.cs

示例4: Visit

		public virtual object Visit (BlockVariable blockVariableDeclaration)
		{
			return null;
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:4,代码来源:visit.cs

示例5: case_933

void case_933()
#line 6259 "cs-parser.jay"
{
	    start_block (GetLocation (yyVals[-2+yyTop]));
	    
		current_block.IsCompilerGenerated = true;
		var lt = (LocatedToken) yyVals[0+yyTop];
		var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.UsingVariable | LocalVariable.Flags.Used, lt.Location);
		current_block.AddLocalName (li);
		current_variable = new Using.VariableDeclaration ((FullNamedExpression) yyVals[-1+yyTop], li);
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:11,代码来源:cs-parser.cs

示例6: case_934

void case_934()
#line 6269 "cs-parser.jay"
{
		yyVal = current_variable;	  
		current_variable = null;
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:6,代码来源:cs-parser.cs

示例7: case_874

void case_874()
#line 5825 "cs-parser.jay"
{
		yyVal = current_variable;
		if (yyVals[-1+yyTop] != null)
			lbag.AddLocation (current_variable, PopLocation ());

		current_variable = null;
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:9,代码来源:cs-parser.cs

示例8: case_800

void case_800()
#line 5388 "cs-parser.jay"
{
		var lt = (LocatedToken) yyVals[0+yyTop];
		var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.Constant, lt.Location);
		current_block.AddLocalName (li);
		current_variable = new BlockConstant ((FullNamedExpression) yyVals[-1+yyTop], li);
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:8,代码来源:cs-parser.cs

示例9: case_801

void case_801()
#line 5395 "cs-parser.jay"
{
		if (current_variable.Initializer != null) {
			lbag.AddLocation (current_variable, GetLocation (yyVals[-6+yyTop]), savedLocation, GetLocation (yyVals[0+yyTop]));
		} else {
			lbag.AddLocation (current_variable, GetLocation (yyVals[-6+yyTop]), GetLocation (yyVals[0+yyTop]));
		}
		yyVal = current_variable;;
		current_variable = null;
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:11,代码来源:cs-parser.cs

示例10: case_799

void case_799()
#line 5379 "cs-parser.jay"
{
		yyVal = current_variable;
		current_variable = null;
		if (yyVals[-2+yyTop] != null)
			lbag.AddLocation (yyVal, PopLocation (), GetLocation (yyVals[0+yyTop]));
		else
			lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop]));
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:10,代码来源:cs-parser.cs

示例11: case_1014

void case_1014()
#line 6794 "cs-parser.jay"
{
		yyVal = current_variable;	  
		current_variable = null;
	  }
开发者ID:furesoft,项目名称:NRefactory,代码行数:6,代码来源:cs-parser.cs

示例12: case_952

void case_952()
#line 6376 "cs-parser.jay"
{
		yyVal = current_variable;	  
		current_variable = null;
	  }
开发者ID:fanyjie,项目名称:SharpDevelop,代码行数:6,代码来源:cs-parser.cs

示例13: case_949

void case_949()
#line 6348 "cs-parser.jay"
{
		yyVal = current_variable;
		current_variable = null;
	  }
开发者ID:fanyjie,项目名称:SharpDevelop,代码行数:6,代码来源:cs-parser.cs

示例14: case_977

void case_977()
#line 6561 "cs-parser.jay"
{
		yyVal = current_variable;	  
		current_variable = null;
	  }
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:6,代码来源:cs-parser.cs


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