本文整理汇总了C#中Mono.CSharp.Yield类的典型用法代码示例。如果您正苦于以下问题:C# Yield类的具体用法?C# Yield怎么用?C# Yield使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Yield类属于Mono.CSharp命名空间,在下文中一共展示了Yield类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
public override object Visit (Yield yieldStatement)
{
var result = new YieldStatement ();
var location = LocationsBag.GetLocations (yieldStatement);
result.AddChild (new CSharpTokenNode (Convert (yieldStatement.loc), "yield".Length), YieldStatement.YieldKeywordRole);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), "return".Length), YieldStatement.ReturnKeywordRole);
if (yieldStatement.Expr != null)
result.AddChild ((INode)yieldStatement.Expr.Accept (this), YieldStatement.Roles.Expression);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[1]), ";".Length), YieldStatement.Roles.Semicolon);
return result;
}
示例2: case_907
void case_907()
#line 6040 "cs-parser.jay"
{
Error_SyntaxError (yyToken);
var lt = (LocatedToken) yyVals[-3+yyTop];
string s = lt.Value;
if (s != "yield"){
report.Error (1003, lt.Location, "; expected");
} else if (yyVals[-1+yyTop] == null) {
report.Error (1627, GetLocation (yyVals[0+yyTop]), "Expression expected after yield return");
} else if (lang_version == LanguageVersion.ISO_1){
FeatureIsNotAvailable (lt.Location, "iterators");
}
current_block.Explicit.RegisterIteratorYield ();
yyVal = new Yield ((Expression) yyVals[-1+yyTop], lt.Location);
lbag.AddStatement (yyVal, GetLocation (yyVals[-2+yyTop]));
}
示例3: Visit
public virtual object Visit (Yield yieldStatement)
{
return null;
}
示例4: case_824
void case_824()
#line 5226 "cs-parser.jay"
{
var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop];
string s = lt.Value;
if (s != "yield"){
Report.Error (1003, lt.Location, "; expected");
} else if (yyVals[-1+yyTop] == null) {
Report.Error (1627, GetLocation (yyVals[0+yyTop]), "Expression expected after yield return");
} else if (RootContext.Version == LanguageVersion.ISO_1){
Report.FeatureIsNotAvailable (lt.Location, "iterators");
}
current_block.ParametersBlock.TopBlock.IsIterator = true;
yyVal = new Yield ((Expression) yyVals[-1+yyTop], lt.Location);
lbag.AddStatement (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop]));
}
示例5: yyparse
//.........这里部分代码省略.........
break;
case 793:
#line 5089 "cs-parser.jay"
{
yyVal = new GotoDefault (GetLocation (yyVals[-2+yyTop]));
}
break;
case 794:
#line 5096 "cs-parser.jay"
{
yyVal = new Return ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop]));
}
break;
case 795:
#line 5103 "cs-parser.jay"
{
yyVal = new Throw ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop]));
}
break;
case 796:
#line 5110 "cs-parser.jay"
{
var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop];
string s = lt.Value;
if (s != "yield"){
Report.Error (1003, lt.Location, "; expected");
yyVal = null;
}
if (RootContext.Version == LanguageVersion.ISO_1){
Report.FeatureIsNotAvailable (lt.Location, "yield statement");
yyVal = null;
}
current_block.Toplevel.IsIterator = true;
yyVal = new Yield ((Expression) yyVals[-1+yyTop], lt.Location);
}
break;
case 797:
#line 5125 "cs-parser.jay"
{
Report.Error (1627, GetLocation (yyVals[-1+yyTop]), "Expression expected after yield return");
yyVal = null;
}
break;
case 798:
#line 5130 "cs-parser.jay"
{
var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop];
string s = lt.Value;
if (s != "yield"){
Report.Error (1003, lt.Location, "; expected");
yyVal = null;
}
if (RootContext.Version == LanguageVersion.ISO_1){
Report.FeatureIsNotAvailable (lt.Location, "yield statement");
yyVal = null;
}
current_block.Toplevel.IsIterator = true;
yyVal = new YieldBreak (lt.Location);
}
break;
case 801:
#line 5154 "cs-parser.jay"
{
yyVal = new TryCatch ((Block) yyVals[-1+yyTop], (List<Catch>) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]), false);
}
示例6: yyparse
//.........这里部分代码省略.........
{
yyVal = new GotoDefault (GetLocation (yyVals[-2+yyTop]));
lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop]));
}
break;
case 854:
#line 5686 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new Return ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop]));
lbag.AddStatement (yyVal, GetLocation (yyVals[0+yyTop]));
}
break;
case 855:
#line 5694 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new Throw ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop]));
lbag.AddStatement (yyVal, GetLocation (yyVals[0+yyTop]));
}
break;
case 856:
#line 5702 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop];
string s = lt.Value;
if (s != "yield"){
report.Error (1003, lt.Location, "; expected");
} else if (yyVals[-1+yyTop] == null) {
report.Error (1627, GetLocation (yyVals[0+yyTop]), "Expression expected after yield return");
} else if (lang_version == LanguageVersion.ISO_1){
FeatureIsNotAvailable (lt.Location, "iterators");
}
current_block.ParametersBlock.TopBlock.IsIterator = true;
yyVal = new Yield ((Expression) yyVals[-1+yyTop], lt.Location);
lbag.AddStatement (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop]));
}
break;
case 857:
#line 5718 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop];
string s = lt.Value;
if (s != "yield"){
report.Error (1003, lt.Location, "; expected");
} else if (lang_version == LanguageVersion.ISO_1){
FeatureIsNotAvailable (lt.Location, "iterators");
}
current_block.ParametersBlock.TopBlock.IsIterator = true;
yyVal = new YieldBreak (lt.Location);
lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop]));
}
break;
case 860:
#line 5740 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new TryCatch ((Block) yyVals[-1+yyTop], (List<Catch>) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]), false);
}
break;
case 861:
#line 5744 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new TryFinally ((Statement) yyVals[-2+yyTop], (Block) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop]));
lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]));
}
break;