本文整理汇总了C#中Mono.CSharp.SwitchLabel类的典型用法代码示例。如果您正苦于以下问题:C# SwitchLabel类的具体用法?C# SwitchLabel怎么用?C# SwitchLabel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SwitchLabel类属于Mono.CSharp命名空间,在下文中一共展示了SwitchLabel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: case_850
void case_850()
#line 5674 "cs-parser.jay"
{
Error_SyntaxError (yyToken);
yyVal = new SwitchLabel ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop]));
}
开发者ID:segaman,项目名称:NRefactory,代码行数:6,代码来源:cs-parser.cs示例2: Visit
public override object Visit(SwitchLabel switchLabel)
{
var newLabel = new CaseLabel();
if (!switchLabel.IsDefault) {
newLabel.AddChild(new CSharpTokenNode(Convert(switchLabel.Location), CaseLabel.CaseKeywordRole), CaseLabel.CaseKeywordRole);
if (switchLabel.Label != null)
newLabel.AddChild((Expression)switchLabel.Label.Accept(this), Roles.Expression);
var colonLocation = LocationsBag.GetLocations(switchLabel);
if (colonLocation != null)
newLabel.AddChild(new CSharpTokenNode(Convert(colonLocation [0]), Roles.Colon), Roles.Colon);
} else {
newLabel.AddChild(new CSharpTokenNode(Convert(switchLabel.Location), CaseLabel.DefaultKeywordRole), CaseLabel.DefaultKeywordRole);
newLabel.AddChild(new CSharpTokenNode(new TextLocation(switchLabel.Location.Row, switchLabel.Location.Column + "default".Length), Roles.Colon), Roles.Colon);
}
return newLabel;
}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:16,代码来源:CSharpParser.cs示例3: yyparse
//.........这里部分代码省略.........
case 840:
case_840();
break;
case 841:
#line 5637 "cs-parser.jay"
{
report.Warning (1522, 1, current_block.StartLocation, "Empty switch block");
}
break;
case 845:
#line 5647 "cs-parser.jay"
{
Error_SyntaxError (yyToken);
}
break;
case 847:
case_847();
break;
case 848:
#line 5664 "cs-parser.jay"
{
current_block.AddStatement ((Statement) yyVals[0+yyTop]);
}
break;
case 849:
case_849();
break;
case 850:
case_850();
break;
case 851:
#line 5681 "cs-parser.jay"
{
yyVal = new SwitchLabel (null, GetLocation (yyVals[0+yyTop]));
}
break;
case 856:
case_856();
break;
case 857:
case_857();
break;
case 858:
case_858();
break;
case 859:
case_859();
break;
case 860:
case_860();
break;
case 861:
case_861();
break;
case 862:
#line 5742 "cs-parser.jay"
{
yyVal = yyVals[0+yyTop];
}
break;
case 863:
case_863();
break;
case 864:
#line 5757 "cs-parser.jay"
{
开发者ID:segaman,项目名称:NRefactory,代码行数:67,代码来源:cs-parser.cs示例4: case_849
void case_849()
#line 5669 "cs-parser.jay"
{
yyVal = new SwitchLabel ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop]));
lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop]));
}
开发者ID:segaman,项目名称:NRefactory,代码行数:6,代码来源:cs-parser.cs示例5: Error_AlreadyOccurs
public void Error_AlreadyOccurs (ResolveContext ec, TypeSpec switch_type, SwitchLabel collision_with)
{
string label;
if (converted == null)
label = "default";
else if (converted == NullStringCase)
label = "null";
else
label = converted.ToString ();
ec.Report.SymbolRelatedToPreviousError (collision_with.loc, null);
ec.Report.Error (152, loc, "The label `case {0}:' already occurs in this switch statement", label);
}
开发者ID:alisci01,项目名称:mono,代码行数:13,代码来源:statement.cs示例6: FindSection
SwitchSection FindSection (SwitchLabel label)
{
foreach (SwitchSection ss in Sections){
foreach (SwitchLabel sl in ss.Labels){
if (label == sl)
return ss;
}
}
return null;
}
开发者ID:alisci01,项目名称:mono,代码行数:11,代码来源:statement.cs示例7: Visit
public virtual object Visit (SwitchLabel switchLabel)
{
return null;
}
开发者ID:rlfqudxo,项目名称:playscript-mono,代码行数:4,代码来源:visit.cs示例8: yyparse
//.........这里部分代码省略.........
case 774:
case_774();
break;
case 775:
#line 4954 "cs-parser.jay"
{
start_block (GetLocation (yyVals[0+yyTop]));
}
break;
case 776:
case_776();
break;
case 777:
case_777();
break;
case 779:
case_779();
break;
case 780:
case_780();
break;
case 781:
case_781();
break;
case 782:
#line 4998 "cs-parser.jay"
{
current_block = current_block.CreateSwitchBlock (lexer.Location);
}
break;
case 783:
#line 5002 "cs-parser.jay"
{
yyVal = new SwitchSection ((List<SwitchLabel>) yyVals[-2+yyTop], current_block);
}
break;
case 784:
case_784();
break;
case 785:
case_785();
break;
case 786:
case_786();
break;
case 787:
#line 5031 "cs-parser.jay"
{
yyVal = new SwitchLabel (null, GetLocation (yyVals[0+yyTop]));
}
break;
case 792:
case_792();
break;
case 793:
case_793();
break;
case 794:
case_794();
break;
case 795:
case_795();
break;
case 796:
#line 5085 "cs-parser.jay"
{ yyVal = new EmptyStatement (lexer.Location); }
开发者ID:Ein,项目名称:monodevelop,代码行数:67,代码来源:cs-parser.cs示例9: Resolve
public override bool Resolve (EmitContext ec)
{
if (ec.Switch == null){
Report.Error (153, loc, "A goto case is only valid inside a switch statement");
return false;
}
expr = expr.Resolve (ec);
if (expr == null)
return false;
Constant c = expr as Constant;
if (c == null) {
Error (150, "A constant value is expected");
return false;
}
Type type = ec.Switch.SwitchType;
if (!Convert.ImplicitStandardConversionExists (c, type))
Report.Warning (469, 2, loc, "The `goto case' value is not implicitly " +
"convertible to type `{0}'", TypeManager.CSharpName (type));
bool fail = false;
object val = c.GetValue ();
if ((val != null) && (c.Type != type) && (c.Type != TypeManager.object_type))
val = TypeManager.ChangeType (val, type, out fail);
if (fail) {
Report.Error (30, loc, "Cannot convert type `{0}' to `{1}'",
c.GetSignatureForError (), TypeManager.CSharpName (type));
return false;
}
if (val == null)
val = SwitchLabel.NullStringCase;
sl = (SwitchLabel) ec.Switch.Elements [val];
if (sl == null){
FlowBranchingBlock.Error_UnknownLabel (loc, "case " +
(c.GetValue () == null ? "null" : val.ToString ()));
return false;
}
ec.CurrentBranching.CurrentUsageVector.Goto ();
return true;
}
开发者ID:lewurm,项目名称:benchmarker,代码行数:47,代码来源:statement.cs示例10: yyparse
//.........这里部分代码省略.........
case 730:
#line 4619 "cs-parser.jay"
{
current_block = current_block.CreateSwitchBlock (lexer.Location);
}
break;
case 731:
#line 4623 "cs-parser.jay"
{
yyVal = new SwitchSection ((ArrayList) yyVals[-2+yyTop], current_block.Explicit);
}
break;
case 732:
#line 4630 "cs-parser.jay"
{
ArrayList labels = new ArrayList (4);
labels.Add (yyVals[0+yyTop]);
yyVal = labels;
}
break;
case 733:
#line 4637 "cs-parser.jay"
{
ArrayList labels = (ArrayList) (yyVals[-1+yyTop]);
labels.Add (yyVals[0+yyTop]);
yyVal = labels;
}
break;
case 734:
#line 4647 "cs-parser.jay"
{
yyVal = new SwitchLabel ((Expression) yyVals[-1+yyTop], (Location) yyVals[-2+yyTop]);
}
break;
case 735:
#line 4651 "cs-parser.jay"
{
yyVal = new SwitchLabel (null, (Location) yyVals[0+yyTop]);
}
break;
case 740:
#line 4665 "cs-parser.jay"
{
Location l = (Location) yyVals[-4+yyTop];
yyVal = new While ((Expression) yyVals[-2+yyTop], (Statement) yyVals[0+yyTop], l);
}
break;
case 741:
#line 4674 "cs-parser.jay"
{
Location l = (Location) yyVals[-6+yyTop];
yyVal = new Do ((Statement) yyVals[-5+yyTop], (Expression) yyVals[-2+yyTop], l);
}
break;
case 742:
#line 4683 "cs-parser.jay"
{
Location l = lexer.Location;
start_block (l);
Block assign_block = current_block;
if (yyVals[-1+yyTop] is DictionaryEntry){
DictionaryEntry de = (DictionaryEntry) yyVals[-1+yyTop];
开发者ID:lewurm,项目名称:benchmarker,代码行数:67,代码来源:cs-parser.cs示例11: case_799
void case_799()
{
Error_SyntaxError (yyToken);
yyVal = new SwitchLabel ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop]));
}
开发者ID:animaonline,项目名称:Portable-Mono.CSharp,代码行数:5,代码来源:cs-parser.cs示例12: case_798
void case_798()
{
yyVal = new SwitchLabel ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop]));
lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop]));
}
开发者ID:animaonline,项目名称:Portable-Mono.CSharp,代码行数:5,代码来源:cs-parser.cs示例13: Resolve
public override bool Resolve (BlockContext ec)
{
if (ec.Switch == null){
ec.Report.Error (153, loc, "A goto case is only valid inside a switch statement");
return false;
}
ec.CurrentBranching.CurrentUsageVector.Goto ();
expr = expr.Resolve (ec);
if (expr == null)
return false;
Constant c = expr as Constant;
if (c == null) {
ec.Report.Error (150, expr.Location, "A constant value is expected");
return false;
}
Type type = ec.Switch.SwitchType;
Constant res = c.TryReduce (ec, type, c.Location);
if (res == null) {
c.Error_ValueCannotBeConverted (ec, loc, type, true);
return false;
}
if (!Convert.ImplicitStandardConversionExists (c, type))
ec.Report.Warning (469, 2, loc,
"The `goto case' value is not implicitly convertible to type `{0}'",
TypeManager.CSharpName (type));
object val = res.GetValue ();
if (val == null)
val = SwitchLabel.NullStringCase;
sl = (SwitchLabel) ec.Switch.Elements [val];
if (sl == null){
FlowBranchingBlock.Error_UnknownLabel (loc, "case " +
(c.GetValue () == null ? "null" : val.ToString ()), ec.Report);
return false;
}
return true;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:45,代码来源:statement.cs示例14: yyparse
//.........这里部分代码省略.........
#line 5436 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
var sections = new List<SwitchSection> (4);
sections.Add ((SwitchSection) yyVals[0+yyTop]);
yyVal = sections;
}
break;
case 810:
#line 5443 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
var sections = (List<SwitchSection>) yyVals[-1+yyTop];
sections.Add ((SwitchSection) yyVals[0+yyTop]);
yyVal = sections;
}
break;
case 811:
#line 5450 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
Error_SyntaxError (yyToken);
yyVal = new List<SwitchSection> ();
}
break;
case 812:
#line 5458 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
current_block = current_block.CreateSwitchBlock (lexer.Location);
}
break;
case 813:
#line 5462 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new SwitchSection ((List<SwitchLabel>) yyVals[-2+yyTop], current_block);
}
break;
case 814:
#line 5469 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
var labels = new List<SwitchLabel> (2);
labels.Add ((SwitchLabel) yyVals[0+yyTop]);
yyVal = labels;
}
break;
case 815:
#line 5476 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
var labels = (List<SwitchLabel>) (yyVals[-1+yyTop]);
labels.Add ((SwitchLabel) yyVals[0+yyTop]);
yyVal = labels;
}
break;
case 816:
#line 5486 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new SwitchLabel ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop]));
lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop]));
}
break;
case 817:
#line 5491 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new SwitchLabel (null, GetLocation (yyVals[0+yyTop]));
}
开发者ID:runefs,项目名称:Marvin,代码行数:67,代码来源:cs-parser.cs示例15: case_786
void case_786()
#line 5004 "C:\Projects\Junk\mono\mcs\class\Mono.CSharp\..\..\mcs\cs-parser.jay"
{
yyVal = new SwitchLabel ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop]));
lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop]));
}
开发者ID:RainsSoft,项目名称:MonoCompilerAsAService,代码行数:6,代码来源:cs-parser.cs本文标签属性:
示例:示例是什么意思
代码:代码生成器
SwitchLabel:SwitchLabel
CSharp:CSharp