Exemplo n.º 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);
            }
            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;
            }
 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());
     }
 }
Exemplo n.º 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);
            }
Exemplo n.º 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);
            }