public void CompileTryCatchFinally(TryCatchFinally tcf) { XmlElement previousElement = currentElement; XmlElement tmpElement = document.CreateElement("TryCatchFinally"); tmpElement.SetAttribute("ExceptionName", tcf.ExceptionName); currentElement = document.CreateElement("TryBlock"); tcf.TryBlock.AcceptCompiler(this); tmpElement.AppendChild(currentElement); if (tcf.CatchBlock != null) { currentElement = document.CreateElement("CatchBlock"); tcf.CatchBlock.AcceptCompiler(this); tmpElement.AppendChild(currentElement); } if (tcf.FinallyBlock != null) { currentElement = document.CreateElement("FinallyBlock"); tcf.FinallyBlock.AcceptCompiler(this); tmpElement.AppendChild(currentElement); } previousElement.AppendChild(tmpElement); currentElement = previousElement; }
public BasicBlock(Source src, TryCatchFinally tryBlock, int tryDepth) { TryBlock = tryBlock; TryDepth = tryDepth; Source = src; Ending = BlockEnding.Open; }
void EndTryCatchFinally(TryCatchFinally tcf) { if (tcf.OptionalFinallyBody != null) { _prependReturn.Pop(); } _prependContinue.Pop(); _prependBreak.Pop(); }
void BeginTryCatchFinally(TryCatchFinally tcf) { if (tcf.OptionalFinallyBody != null) { _prependReturn.Push(tcf.OptionalFinallyBody); } _prependContinue.Push(tcf.OptionalFinallyBody); _prependBreak.Push(tcf.OptionalFinallyBody); _insideTry = true; }
public void CompileTryCatchFinally(TryCatchFinally tcf) { textWriter.WriteLine("try"); tcf.TryBlock.AcceptCompiler(this); if (tcf.CatchBlock != null) { textWriter.WriteLine("catch ({0})", SafeName(tcf.ExceptionName)); tcf.CatchBlock.AcceptCompiler(this); } if (tcf.FinallyBlock != null) { textWriter.WriteLine("finally"); tcf.FinallyBlock.AcceptCompiler(this); } }
public virtual void WriteTryCatchFinally(TryCatchFinally s) { Skip(); WriteLine("try"); WriteScope(s.TryBody, true, false); foreach (var c in s.CatchBlocks) { BeginLine("catch ("); WriteCaughtException(c.Exception.Source, c.Exception.ValueType, c.Exception.Name); EndLine(")"); WriteScope(c.Body, true, false); } if (s.OptionalFinallyBody != null) { WriteLine("finally"); WriteScope(s.OptionalFinallyBody, true, false); } Skip(); }
public override void WriteTryCatchFinally(TryCatchFinally s) { WriteLine("try"); WriteScope(s.TryBody); if (s.CatchBlocks.Length > 0) { WriteLine("catch ($js_exception)"); BeginScope(); WriteLine("$uno_exception = $ConvertNativeException($js_exception);"); bool first = true; foreach (var c in s.CatchBlocks) { BeginLine(!first ? "else " : ""); EndLine("if ($uno_exception instanceof " + Backend.GetGlobal(c.Exception.ValueType) + ")"); BeginScope(); WriteLine("var " + c.Exception.Name + " = $uno_exception;"); WriteScope(c.Body, false, false); EndScope(); first = false; } WriteLine("else"); BeginScope(); WriteLine("throw $js_exception"); EndScope(); EndScope(); } if (s.OptionalFinallyBody != null) { WriteLine("finally"); WriteScope(s.OptionalFinallyBody); } }
private void btnTryCatchFinally_Click(object sender, EventArgs e) { var x = new TryCatchFinally(); x.Test(); }
public Label(TryCatchFinally tcBlock) { TryCatchBlock = tcBlock; }