本文整理汇总了C#中System.CodeDom.CodeGotoStatement类的典型用法代码示例。如果您正苦于以下问题:C# CodeGotoStatement类的具体用法?C# CodeGotoStatement怎么用?C# CodeGotoStatement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CodeGotoStatement类属于System.CodeDom命名空间,在下文中一共展示了CodeGotoStatement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Constructor1
public void Constructor1 ()
{
string label1 = "mono1";
CodeGotoStatement cgs = new CodeGotoStatement (label1);
Assert.IsNotNull (cgs.Label, "#1");
Assert.AreSame (label1, cgs.Label, "#2");
#if NET_2_0
Assert.IsNotNull (cgs.StartDirectives, "#3");
Assert.AreEqual (0, cgs.StartDirectives.Count, "#4");
Assert.IsNotNull (cgs.EndDirectives, "#5");
Assert.AreEqual (0, cgs.EndDirectives.Count, "#6");
#endif
Assert.IsNotNull (cgs.UserData, "#7");
Assert.AreEqual (typeof(ListDictionary), cgs.UserData.GetType (), "#8");
Assert.AreEqual (0, cgs.UserData.Count, "#9");
Assert.IsNull (cgs.LinePragma, "#10");
string label2 = "mono2";
cgs.Label = label2;
Assert.AreSame (label2, cgs.Label, "#11");
}
开发者ID:nlhepler,项目名称:mono,代码行数:26,代码来源:CodeGotoStatementTest.cs
示例2: Constructor0
public void Constructor0 ()
{
CodeGotoStatement cgs = new CodeGotoStatement ();
Assert.IsNull (cgs.Label, "#1");
Assert.IsNotNull (cgs.StartDirectives, "#2");
Assert.AreEqual (0, cgs.StartDirectives.Count, "#3");
Assert.IsNotNull (cgs.EndDirectives, "#4");
Assert.AreEqual (0, cgs.EndDirectives.Count, "#5");
Assert.IsNotNull (cgs.UserData, "#6");
Assert.AreEqual (typeof(ListDictionary), cgs.UserData.GetType (), "#7");
Assert.AreEqual (0, cgs.UserData.Count, "#8");
Assert.IsNull (cgs.LinePragma, "#9");
CodeLinePragma clp = new CodeLinePragma ("mono", 10);
cgs.LinePragma = clp;
Assert.IsNotNull (cgs.LinePragma, "#10");
Assert.AreSame (clp, cgs.LinePragma, "#11");
cgs.LinePragma = null;
Assert.IsNull (cgs.LinePragma, "#12");
string label = "mono";
cgs.Label = label;
Assert.AreSame (label, cgs.Label, "#13");
}
开发者ID:Profit0004,项目名称:mono,代码行数:29,代码来源:CodeGotoStatementTest.cs
示例3: TypescriptGotoStatement
public TypescriptGotoStatement(
IStatementFactory statementFactory,
IExpressionFactory expressionFactory,
CodeGotoStatement statement,
CodeGeneratorOptions options)
{
_statementFactory = statementFactory;
_expressionFactory = expressionFactory;
_statement = statement;
_options = options;
}
开发者ID:s2quake,项目名称:TypescriptCodeDom,代码行数:11,代码来源:TypescriptGotoStatement.cs
示例4: EmitGotoStatement
private void EmitGotoStatement(CodeGotoStatement Goto)
{
Depth++;
Debug("Emitting goto: " + Goto.Label);
LabelMetadata Meta = LookupLabel(Goto.Label);
Generator.Emit(OpCodes.Br, Meta.Label);
Meta.From = Goto;
Depth--;
}
开发者ID:Tyelpion,项目名称:IronAHK,代码行数:11,代码来源:EmitLabel.cs
示例5: Write
private void Write(CodeGotoStatement e){
TextWriter w = this.writer;
w.Write("goto ");
w.Write(e.Label);
w.WriteLine(";");
}
开发者ID:hesam,项目名称:SketchSharp,代码行数:6,代码来源:Compiler.cs
示例6: GenerateGotoStatement
protected override void GenerateGotoStatement(CodeGotoStatement e)
{
Output.WriteLine("[CodeGotoStatement: {0}]", e.ToString());
}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:4,代码来源:CodeDOMVerboseOutputGenerator.cs
示例7: GenerateGotoStatement
protected override void GenerateGotoStatement (CodeGotoStatement statement)
{
TextWriter output = Output;
output.Write ("goto ");
output.Write (statement.Label);
output.WriteLine ();
}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:VBCodeGenerator.cs
示例8: Visit
public void Visit (CodeGotoStatement o)
{
g.GenerateGotoStatement (o);
}
开发者ID:carrie901,项目名称:mono,代码行数:4,代码来源:CodeGenerator.cs
示例9: Label_Null
public void Label_Null ()
{
CodeGotoStatement cgs = new CodeGotoStatement ("mono");
cgs.Label = null;
}
开发者ID:Profit0004,项目名称:mono,代码行数:5,代码来源:CodeGotoStatementTest.cs
示例10: GenerateGotoStatement
protected override void GenerateGotoStatement(CodeGotoStatement e) {
throw new Exception(JScriptException.Localize("No goto statements", CultureInfo.CurrentUICulture));
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:3,代码来源:jscodegenerator.cs
示例11: Generate
public void Generate(CodeGotoStatement statement)
{
throw new NotImplementedException();
}
开发者ID:chunlea,项目名称:rubydotnetcompiler,代码行数:4,代码来源:RubyCodeGenerator.cs
示例12: Label_Empty
public void Label_Empty () {
CodeGotoStatement cgs = new CodeGotoStatement ("mono");
cgs.Label = string.Empty;
#if ONLY_1_1
Assert.IsNotNull (cgs.Label, "#1");
Assert.AreEqual (string.Empty, cgs.Label, "#2");
#endif
}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:CodeGotoStatementTest.cs
示例13: Label_Null
public void Label_Null ()
{
CodeGotoStatement cgs = new CodeGotoStatement ("mono");
cgs.Label = null;
#if ONLY_1_1
Assert.IsNull (cgs.Label, "#1");
#endif
}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:CodeGotoStatementTest.cs
示例14: Constructor1_EmptyLabel
public void Constructor1_EmptyLabel () {
CodeGotoStatement cgs = new CodeGotoStatement (string.Empty);
#if ONLY_1_1
Assert.IsNotNull (cgs.Label, "#1");
Assert.AreEqual (string.Empty, cgs.Label, "#2");
#endif
}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:CodeGotoStatementTest.cs
示例15: Constructor1_NullLabel
public void Constructor1_NullLabel ()
{
CodeGotoStatement cgs = new CodeGotoStatement ((string) null);
#if ONLY_1_1
Assert.IsNull (cgs.Label, "#1");
#endif
}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:CodeGotoStatementTest.cs
示例16: VisitContinueStatement
public override object VisitContinueStatement(ContinueStatement continueStatement, object data)
{
// RG:
// continue;
//
// emulate with:
// goto continue1;
//
Breakable breakable = breakableStack.Peek();
// Is continuable?
if (!breakable.AllowContinue)
{
// walk stack to find first continuable item
Breakable[] stack = breakableStack.ToArray();
foreach (Breakable b in stack)
{
if (b.AllowContinue)
{
breakable = b;
break;
}
}
}
breakable.IsContinue = true;
CodeGotoStatement continueStmt = new CodeGotoStatement("continue" + breakable.Id);
AddStmt(continueStmt);
return continueStmt;
}
开发者ID:almazik,项目名称:ILSpy,代码行数:33,代码来源:CodeDOMOutputVisitor.cs
示例17: Constructor1_EmptyLabel
public void Constructor1_EmptyLabel () {
CodeGotoStatement cgs = new CodeGotoStatement (string.Empty);
}
开发者ID:Profit0004,项目名称:mono,代码行数:3,代码来源:CodeGotoStatementTest.cs
示例18: GenerateGotoStatement
/// <summary>
/// Generates code for the specified goto statement.
/// </summary>
/// <remarks><c>goto LABEL;</c></remarks>
protected override void GenerateGotoStatement(CodeGotoStatement e)
{
Output.Write(SpecialWords.Goto + WhiteSpace.Space);
Output.Write(e.Label);
Output.WriteLine(Tokens.Semicolon);
}
开发者ID:jdluzen,项目名称:Phalanger,代码行数:11,代码来源:PhpGenerator.CLR.cs
示例19: Label_Empty
public void Label_Empty () {
CodeGotoStatement cgs = new CodeGotoStatement ("mono");
cgs.Label = string.Empty;
}
开发者ID:Profit0004,项目名称:mono,代码行数:4,代码来源:CodeGotoStatementTest.cs
示例20: CodeTryCatchFinallyStatementTest
public void CodeTryCatchFinallyStatementTest ()
{
CodeStatement cs = new CodeGotoStatement ("exit");
CodeCatchClause ccc1 = new CodeCatchClause ("ex1", new CodeTypeReference ("System.ArgumentException"));
CodeCatchClause ccc2 = new CodeCatchClause (null, new CodeTypeReference ("System.ApplicationException"));
CodeSnippetStatement fin1 = new CodeSnippetStatement ("A");
CodeSnippetStatement fin2 = new CodeSnippetStatement ("B");
statement = new CodeTryCatchFinallyStatement (new CodeStatement[] { cs },
new CodeCatchClause[] { ccc1, ccc2 }, new CodeStatement[] { fin1, fin2 });
Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
"try {{{0}" +
" goto exit;{0}" +
"}}{0}" +
"catch (System.ArgumentException ex1) {{{0}" +
"}}{0}" +
"catch (System.ApplicationException ) {{{0}" +
"}}{0}" +
"finally {{{0}" +
#if NET_2_0
"A{0}" +
"B{0}" +
#else
" A{0}" +
" B{0}" +
#endif
"}}{0}", NewLine), Generate (), "#1");
options.ElseOnClosing = true;
Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
"try {{{0}" +
" goto exit;{0}" +
"}} catch (System.ArgumentException ex1) {{{0}" +
"}} catch (System.ApplicationException ) {{{0}" +
"}} finally {{{0}" +
#if NET_2_0
"A{0}" +
"B{0}" +
#else
" A{0}" +
" B{0}" +
#endif
"}}{0}", NewLine), Generate (), "#2");
statement = new CodeTryCatchFinallyStatement ();
Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
"try {{{0}" +
"}}{0}", NewLine), Generate (), "#3");
options.ElseOnClosing = false;
Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
"try {{{0}" +
"}}{0}", NewLine), Generate (), "#4");
}
开发者ID:zxlin25,项目名称:mono,代码行数:58,代码来源:CodeGeneratorFromStatementTest.cs
注:本文中的System.CodeDom.CodeGotoStatement类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论