コード例 #1
0
            public override ScopeInfo OpenScope(
                ScopeType scopeType,
                Microsoft.Cci.ITypeReference exceptionType,
                ExceptionHandlerScope currentExceptionHandler
                )
            {
                Debug.Assert(
                    ((_handlers.Count == 0) && (scopeType == ScopeType.Try)) ||
                    (
                        (_handlers.Count > 0) &&
                        (
                            (scopeType == ScopeType.Catch) ||
                            (scopeType == ScopeType.Filter) ||
                            (scopeType == ScopeType.Finally) ||
                            (scopeType == ScopeType.Fault)
                        )
                    )
                    );

                Debug.Assert(currentExceptionHandler == _containingHandler);

                var handler = new ExceptionHandlerScope(this, scopeType, exceptionType);

                _handlers.Add(handler);
                return(handler);
            }
コード例 #2
0
            public ExceptionHandlerScope(ExceptionHandlerContainerScope containingScope, ScopeType type, Microsoft.Cci.ITypeReference exceptionType)
            {
                Debug.Assert((type == ScopeType.Try) || (type == ScopeType.Catch) || (type == ScopeType.Filter) || (type == ScopeType.Finally) || (type == ScopeType.Fault));
                Debug.Assert((type == ScopeType.Catch) == (exceptionType != null));

                _containingScope = containingScope;
                _type            = type;
                _exceptionType   = exceptionType;
            }
コード例 #3
0
 public virtual ScopeInfo OpenScope(ScopeType scopeType,
                                    Microsoft.Cci.ITypeReference exceptionType,
                                    ExceptionHandlerScope currentHandler)
 {
     if (scopeType == ScopeType.TryCatchFinally)
     {
         return(new ExceptionHandlerContainerScope(currentHandler));
     }
     else
     {
         Debug.Assert(scopeType == ScopeType.Variable || scopeType == ScopeType.StateMachineVariable);
         return(new LocalScopeInfo());
     }
 }
コード例 #4
0
            internal ScopeInfo OpenScope(ScopeType scopeType, Microsoft.Cci.ITypeReference exceptionType)
            {
                var scope = CurrentScope.OpenScope(scopeType, exceptionType, _enclosingExceptionHandler);

                _scopes.Push(scope);

                if (scope.IsExceptionHandler)
                {
                    _enclosingExceptionHandler = (ExceptionHandlerScope)scope;
                }

                Debug.Assert(_enclosingExceptionHandler == GetEnclosingExceptionHandler());
                return(scope);
            }
コード例 #5
0
            public override ScopeInfo OpenScope(
                ScopeType scopeType,
                Microsoft.Cci.ITypeReference exceptionType,
                ExceptionHandlerScope currentExceptionHandler)
            {
                var scope = base.OpenScope(scopeType, exceptionType, currentExceptionHandler);

                if (NestedScopes == null)
                {
                    NestedScopes = ImmutableArray.CreateBuilder <ScopeInfo>(1);
                }
                NestedScopes.Add(scope);
                return(scope);
            }