當前位置: 首頁>>代碼示例>>C#>>正文


C# CSharp.TryFinally類代碼示例

本文整理匯總了C#中Mono.CSharp.TryFinally的典型用法代碼示例。如果您正苦於以下問題:C# TryFinally類的具體用法?C# TryFinally怎麽用?C# TryFinally使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TryFinally類屬於Mono.CSharp命名空間,在下文中一共展示了TryFinally類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Visit

			public override object Visit (TryFinally tryFinallyStatement)
			{
				TryCatchStatement result;
				var location = LocationsBag.GetLocations (tryFinallyStatement);
				
				if (tryFinallyStatement.Stmt is TryCatch) {
					result = (TryCatchStatement)tryFinallyStatement.Stmt.Accept (this);
				} else {
					result = new TryCatchStatement ();
					result.AddChild (new CSharpTokenNode (Convert (tryFinallyStatement.loc), "try".Length), TryCatchStatement.TryKeywordRole);
					result.AddChild ((INode)tryFinallyStatement.Stmt.Accept (this), TryCatchStatement.TryBlockRole);
				}
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[0]), "finally".Length), TryCatchStatement.FinallyKeywordRole);
				result.AddChild ((INode)tryFinallyStatement.Fini.Accept (this), TryCatchStatement.FinallyBlockRole);
				
				return result;
			}
開發者ID:pgoron,項目名稱:monodevelop,代碼行數:18,代碼來源:CSharpParser.cs

示例2: Emit

		public override void Emit()
		{
			var base_type = Parent.PartialContainer.BaseType;
			if (base_type != null && Block != null) {
				var base_dtor = MemberCache.FindMember (base_type,
					new MemberFilter (MetadataName, 0, MemberKind.Destructor, null, null), BindingRestriction.InstanceOnly) as MethodSpec;

				if (base_dtor == null)
					throw new NotImplementedException ();

				MethodGroupExpr method_expr = MethodGroupExpr.CreatePredefined (base_dtor, base_type, Location);
				method_expr.InstanceExpression = new BaseThis (base_type, Location);

				var try_block = new ExplicitBlock (block, block.StartLocation, block.EndLocation) {
					IsCompilerGenerated = true
				};
				var finaly_block = new ExplicitBlock (block, Location, Location) {
					IsCompilerGenerated = true
				};

				//
				// 0-size arguments to avoid CS0250 error
				// TODO: Should use AddScopeStatement or something else which emits correct
				// debugger scope
				//
				finaly_block.AddStatement (new StatementExpression (new Invocation (method_expr, new Arguments (0)), Location.Null));

				var tf = new TryFinally (try_block, finaly_block, Location);
				block.WrapIntoDestructor (tf, try_block);
			}

			base.Emit ();
		}
開發者ID:OpenFlex,項目名稱:playscript-mono,代碼行數:33,代碼來源:method.cs

示例3: case_912

void case_912()
#line 6084 "cs-parser.jay"
{
		yyVal = new TryFinally ((Statement) yyVals[-2+yyTop], (Block) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop]));
		lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
開發者ID:segaman,項目名稱:NRefactory,代碼行數:6,代碼來源:cs-parser.cs

示例4: case_913

void case_913()
#line 6089 "cs-parser.jay"
{
		yyVal = new TryFinally (new TryCatch ((Block) yyVals[-3+yyTop], (List<Catch>) yyVals[-2+yyTop], GetLocation (yyVals[-4+yyTop]), true), (Block) yyVals[0+yyTop], GetLocation (yyVals[-4+yyTop]));
		lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
開發者ID:segaman,項目名稱:NRefactory,代碼行數:6,代碼來源:cs-parser.cs

示例5: WrapIntoDestructor

		public void WrapIntoDestructor (TryFinally tf, ExplicitBlock tryBlock)
		{
			tryBlock.statements = statements;
			statements = new List<Statement> (1);
			statements.Add (tf);
		}
開發者ID:alisci01,項目名稱:mono,代碼行數:6,代碼來源:statement.cs

示例6: Visit

		public virtual object Visit (TryFinally tryFinallyStatement)
		{
			return null;
		}
開發者ID:KAW0,項目名稱:Alter-Native,代碼行數:4,代碼來源:visit.cs

示例7: case_862

void case_862()
#line 5706 "cs-parser.jay"
{
		var loc = GetLocation (yyVals[-4+yyTop]);
		yyVal = new TryFinally (new TryCatch ((Block) yyVals[-3+yyTop], (List<Catch>) yyVals[-2+yyTop], loc, true), (Block) yyVals[0+yyTop], loc);
		lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
開發者ID:xamarin-release-manager,項目名稱:monodevelop,代碼行數:7,代碼來源:cs-parser.cs

示例8: yyparse


//.........這裏部分代碼省略.........
#line 5125 "cs-parser.jay"
  {
		Report.Error (1627, GetLocation (yyVals[-1+yyTop]), "Expression expected after yield return");
		yyVal = null;
	  }
  break;
case 798:
#line 5130 "cs-parser.jay"
  {
		var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop];
		string s = lt.Value;
		if (s != "yield"){
			Report.Error (1003, lt.Location, "; expected");
			yyVal = null;
		}
		if (RootContext.Version == LanguageVersion.ISO_1){
			Report.FeatureIsNotAvailable (lt.Location, "yield statement");
			yyVal = null;
		}
		
		current_block.Toplevel.IsIterator = true;
		yyVal = new YieldBreak (lt.Location);
	  }
  break;
case 801:
#line 5154 "cs-parser.jay"
  {
		yyVal = new TryCatch ((Block) yyVals[-1+yyTop], (List<Catch>) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]), false);
	  }
  break;
case 802:
#line 5158 "cs-parser.jay"
  {
		yyVal = new TryFinally ((Statement) yyVals[-2+yyTop], (Block) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop]));
	  }
  break;
case 803:
#line 5162 "cs-parser.jay"
  {
		yyVal = new TryFinally (new TryCatch ((Block) yyVals[-3+yyTop], (List<Catch>) yyVals[-2+yyTop], GetLocation (yyVals[-4+yyTop]), true), (Block) yyVals[0+yyTop], GetLocation (yyVals[-4+yyTop]));
	  }
  break;
case 804:
#line 5166 "cs-parser.jay"
  {
		Report.Error (1524, GetLocation (yyVals[-2+yyTop]), "Expected catch or finally");
		yyVal = null;
	  }
  break;
case 805:
#line 5174 "cs-parser.jay"
  {
		var l = new List<Catch> (2);

		l.Add ((Catch) yyVals[0+yyTop]);
		yyVal = l;
	  }
  break;
case 806:
#line 5181 "cs-parser.jay"
  {
		var l = (List<Catch>) yyVals[-1+yyTop];
		
		Catch c = (Catch) yyVals[0+yyTop];
		if (l [0].IsGeneral) {
			Report.Error (1017, c.loc, "Try statement already has an empty catch block");
開發者ID:speier,項目名稱:shake,代碼行數:67,代碼來源:cs-parser.cs

示例9: case_862

void case_862()
{
		yyVal = new TryFinally (new TryCatch ((Block) yyVals[-3+yyTop], (List<Catch>) yyVals[-2+yyTop], Location.Null, true), (Block) yyVals[0+yyTop], GetLocation (yyVals[-4+yyTop]));
		lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
開發者ID:animaonline,項目名稱:Portable-Mono.CSharp,代碼行數:5,代碼來源:cs-parser.cs

示例10: case_861

void case_861()
{
		yyVal = new TryFinally ((Statement) yyVals[-2+yyTop], (Block) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop]));
		lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
開發者ID:animaonline,項目名稱:Portable-Mono.CSharp,代碼行數:5,代碼來源:cs-parser.cs

示例11: yyparse


//.........這裏部分代碼省略.........
			FeatureIsNotAvailable (lt.Location, "iterators");
		}
		
		current_block.ParametersBlock.TopBlock.IsIterator = true;
		yyVal = new Yield ((Expression) yyVals[-1+yyTop], lt.Location);
		lbag.AddStatement (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop]));
	  }
  break;
case 857:
#line 5718 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop];
		string s = lt.Value;
		if (s != "yield"){
			report.Error (1003, lt.Location, "; expected");
		} else if (lang_version == LanguageVersion.ISO_1){
			FeatureIsNotAvailable (lt.Location, "iterators");
		}
		
		current_block.ParametersBlock.TopBlock.IsIterator = true;
		yyVal = new YieldBreak (lt.Location);
		lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop]));
	  }
  break;
case 860:
#line 5740 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		yyVal = new TryCatch ((Block) yyVals[-1+yyTop], (List<Catch>) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]), false);
	  }
  break;
case 861:
#line 5744 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		yyVal = new TryFinally ((Statement) yyVals[-2+yyTop], (Block) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop]));
		lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
  break;
case 862:
#line 5749 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		yyVal = new TryFinally (new TryCatch ((Block) yyVals[-3+yyTop], (List<Catch>) yyVals[-2+yyTop], GetLocation (yyVals[-4+yyTop]), true), (Block) yyVals[0+yyTop], GetLocation (yyVals[-4+yyTop]));
		lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
  break;
case 863:
#line 5754 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		report.Error (1524, GetLocation (yyVals[-2+yyTop]), "Expected catch or finally");
		yyVal = null;
	  }
  break;
case 864:
#line 5762 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		var l = new List<Catch> (2);

		l.Add ((Catch) yyVals[0+yyTop]);
		yyVal = l;
	  }
  break;
case 865:
#line 5769 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		var l = (List<Catch>) yyVals[-1+yyTop];
		
		Catch c = (Catch) yyVals[0+yyTop];
開發者ID:runefs,項目名稱:Marvin,代碼行數:67,代碼來源:cs-parser.cs

示例12: case_832

void case_832()
#line 5267 "C:\Projects\Junk\mono\mcs\class\Mono.CSharp\..\..\mcs\cs-parser.jay"
{
		yyVal = new TryFinally (new TryCatch ((Block) yyVals[-3+yyTop], (List<Catch>) yyVals[-2+yyTop], GetLocation (yyVals[-4+yyTop]), true), (Block) yyVals[0+yyTop], GetLocation (yyVals[-4+yyTop]));
		lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
開發者ID:RainsSoft,項目名稱:MonoCompilerAsAService,代碼行數:6,代碼來源:cs-parser.cs

示例13: case_831

void case_831()
#line 5262 "C:\Projects\Junk\mono\mcs\class\Mono.CSharp\..\..\mcs\cs-parser.jay"
{
		yyVal = new TryFinally ((Statement) yyVals[-2+yyTop], (Block) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop]));
		lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
開發者ID:RainsSoft,項目名稱:MonoCompilerAsAService,代碼行數:6,代碼來源:cs-parser.cs


注:本文中的Mono.CSharp.TryFinally類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。