本文整理汇总了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;
}
示例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);
}
示例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;
}
示例4: Visit
public virtual object Visit (BlockVariable blockVariableDeclaration)
{
return null;
}
示例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);
}
示例6: case_934
void case_934()
#line 6269 "cs-parser.jay"
{
yyVal = current_variable;
current_variable = null;
}
示例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;
}
示例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);
}
示例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;
}
示例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]));
}
示例11: case_1014
void case_1014()
#line 6794 "cs-parser.jay"
{
yyVal = current_variable;
current_variable = null;
}
示例12: case_952
void case_952()
#line 6376 "cs-parser.jay"
{
yyVal = current_variable;
current_variable = null;
}
示例13: case_949
void case_949()
#line 6348 "cs-parser.jay"
{
yyVal = current_variable;
current_variable = null;
}
示例14: case_977
void case_977()
#line 6561 "cs-parser.jay"
{
yyVal = current_variable;
current_variable = null;
}