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"); }
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"); }
public TypescriptGotoStatement( IStatementFactory statementFactory, IExpressionFactory expressionFactory, CodeGotoStatement statement, CodeGeneratorOptions options) { _statementFactory = statementFactory; _expressionFactory = expressionFactory; _statement = statement; _options = options; }
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--; }
protected override void GenerateGotoStatement(CodeGotoStatement e) { Output.WriteLine("[CodeGotoStatement: {0}]", e.ToString()); }
protected override void GenerateGotoStatement (CodeGotoStatement statement) { TextWriter output = Output; output.Write ("goto "); output.Write (statement.Label); output.WriteLine (); }
public void Visit (CodeGotoStatement o) { g.GenerateGotoStatement (o); }
public void Label_Null () { CodeGotoStatement cgs = new CodeGotoStatement ("mono"); cgs.Label = null; }
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; }
protected override void GenerateGotoStatement(System.CodeDom.CodeGotoStatement e) { throw new Exception("The method or operation is not implemented."); }
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 }
public void Label_Null () { CodeGotoStatement cgs = new CodeGotoStatement ("mono"); cgs.Label = null; #if ONLY_1_1 Assert.IsNull (cgs.Label, "#1"); #endif }
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 }
public void Constructor1_NullLabel () { CodeGotoStatement cgs = new CodeGotoStatement ((string) null); #if ONLY_1_1 Assert.IsNull (cgs.Label, "#1"); #endif }
private void Write(CodeGotoStatement e){ TextWriter w = this.writer; w.Write("goto "); w.Write(e.Label); w.WriteLine(";"); }
public override object VisitBreakStatement(BreakStatement breakStatement, object data) { // RG: // break; // // emulate with: // goto break1; // Breakable breakable = breakableStack.Peek(); breakable.IsBreak = true; CodeGotoStatement breakStmt = new CodeGotoStatement("break" + breakable.Id); AddStmt(breakStmt); return breakStmt; }
public void Generate(CodeGotoStatement statement) { throw new NotImplementedException(); }
public void Constructor1_EmptyLabel () { CodeGotoStatement cgs = new CodeGotoStatement (string.Empty); }
protected override void GenerateGotoStatement(CodeGotoStatement e) { throw new Exception(JScriptException.Localize("No goto statements", CultureInfo.CurrentUICulture)); }
public void Label_Empty () { CodeGotoStatement cgs = new CodeGotoStatement ("mono"); cgs.Label = string.Empty; }
/// <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); }
public void Constructor1_NullLabel () { CodeGotoStatement cgs = new CodeGotoStatement ((string) null); }
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"); }
protected abstract void GenerateGotoStatement (CodeGotoStatement statement);
void EmitGoto(CodeGotoStatement go) { writer.Write(Parser.FlowGoto); writer.Write(Parser.SingleSpace); writer.Write(go.Label); }
protected override void GenerateGotoStatement (CodeGotoStatement e) { }
public bool ValidateCodeGotoStatement (CodeGotoStatement exp) { PushError ("CodeGotoStatement is not allowed."); return false; }
protected override void GenerateGotoStatement(CodeGotoStatement e) { base.Output.Write("goto "); base.Output.WriteLine(e.Label); }
private static void ValidateGotoStatement(CodeGotoStatement e) { ValidateIdentifier(e,"Label",e.Label); }
public override object Visit(GotoStatement gotoStatement, object data) { ProcessSpecials(gotoStatement.Specials); System.CodeDom.CodeGotoStatement gotoStmt = new CodeGotoStatement(gotoStatement.Label); // Add Statement to Current Statement Collection AddStmt(gotoStmt); return gotoStmt; }
private void GenerateGotoStatement(CodeGotoStatement e) { Output.Write("goto "); Output.Write(e.Label); Output.WriteLine(";"); }