public override void VisitTryStatement (TryStatement node)
		{
			WriteKeyword ("try");
			WriteLine ();
			Visit (node.Try);
			Visit (node.CatchClauses);

			if (node.Finally != null) {
				WriteKeyword ("finally");
				WriteLine ();
				Visit (node.Finally);
			}
		}
		void ProcessCatchHandlers (ExceptionHandlerData data, TryStatement @try)
		{
			foreach (var catch_data in data.Catches)
				@try.CatchClauses.Add (CreateCatchHandler (catch_data));
		}
		void ProcessFinallyHandler (ExceptionHandlerData data, TryStatement @try)
		{
			if (data.FinallyRange == null)
				return;

			var range = data.FinallyRange;

			@try.Finally = new BlockStatement ();

			MoveStatementsToBlock (range.Start, range.End, @try.Finally);
		}
		void ProcessExceptionData (ExceptionHandlerData data)
		{
			var block_statements = GetOrCreateStatementListAt (data.TryRange.Start.Index);

			var @try = new TryStatement ();
			@try.Try = new BlockStatement ();

			MoveStatementsToBlock (data.TryRange.Start, data.TryRange.End, @try.Try);

			ProcessCatchHandlers (data, @try);

			ProcessFinallyHandler (data, @try);

			block_statements.Add (@try);
		}
Esempio n. 5
0
		public virtual void VisitTryStatement (TryStatement node)
		{
			Visit (node.Try);
			Visit (node.CatchClauses);
			Visit (node.Fault);
			Visit (node.Finally);
		}
Esempio n. 6
0
			static bool IsValidTryStatement (TryStatement try_statement)
			{
				return try_statement.CatchClauses.Count == 0 &&
				       try_statement.Try.Statements.Count == 1 &&
				       try_statement.Finally != null &&
				       try_statement.Finally.Statements.Count == 1;
			}