public SemanticCheckerTests()
 {
     _logger          = Substitute.For <ILogger>();
     _metricServer    = Substitute.For <IMonitoringMetricServer>();
     _serviceProxy    = Substitute.For <IServiceProxy>();
     _semanticChecker = new SemanticChecker(_metricServer, _serviceProxy, _logger);
 }
예제 #2
0
        protected BindingContext(
            CSemanticChecker pSemanticChecker,
            ExprFactory exprFactory,
            OutputContext outputContext,
            NameGenerator nameGenerator,
            bool bflushLocalVariableTypesForEachStatement,
            bool bAllowUnsafeBlocks,
            bool bIsOptimizingSwitchAndArrayInit,
            bool bShowReachability,
            bool bWrapNonExceptionThrows,
            bool bInRefactoring,
            KAID aidLookupContext
            )
        {
            m_ExprFactory            = exprFactory;
            m_outputContext          = outputContext;
            m_pNameGenerator         = nameGenerator;
            m_pInputFile             = null;
            m_pParentDecl            = null;
            m_pContainingAgg         = null;
            m_pCurrentSwitchType     = null;
            m_pOriginalConstantField = null;
            m_pCurrentFieldSymbol    = null;
            m_pImplicitlyTypedLocal  = null;
            m_pOuterScope            = null;
            m_pFinallyScope          = null;
            m_pTryScope                                = null;
            m_pCatchScope                              = null;
            m_pCurrentScope                            = null;
            m_pSwitchScope                             = null;
            m_pCurrentBlock                            = null;
            m_UnsafeState                              = UNSAFESTATES.UNSAFESTATES_Unknown;
            m_FinallyNestingCount                      = 0;
            m_bInsideTryOfCatch                        = false;
            m_bInFieldInitializer                      = false;
            m_bInBaseConstructorCall                   = false;
            m_bAllowUnsafeBlocks                       = bAllowUnsafeBlocks;
            m_bIsOptimizingSwitchAndArrayInit          = bIsOptimizingSwitchAndArrayInit;
            m_bShowReachability                        = bShowReachability;
            m_bWrapNonExceptionThrows                  = bWrapNonExceptionThrows;
            m_bInRefactoring                           = bInRefactoring;
            m_bInAttribute                             = false;
            m_bRespectSemanticsAndReportErrors         = true;
            m_bflushLocalVariableTypesForEachStatement = bflushLocalVariableTypesForEachStatement;
            m_ppamis          = null;
            m_pamiCurrent     = null;
            m_pInitType       = null;
            m_returnErrorSink = null;

            Debug.Assert(pSemanticChecker != null);
            this.SemanticChecker                   = pSemanticChecker;
            this.SymbolLoader                      = SemanticChecker.GetSymbolLoader();
            m_outputContext.m_pThisPointer         = null;
            m_outputContext.m_pCurrentMethodSymbol = null;

            m_aidExternAliasLookupContext = aidLookupContext;
            CheckedNormal   = false;
            CheckedConstant = false;
        }
예제 #3
0
        protected BindingContext(BindingContext parent)
        {
            m_ExprFactory            = parent.m_ExprFactory;
            m_outputContext          = parent.m_outputContext;
            m_pNameGenerator         = parent.m_pNameGenerator;
            m_pInputFile             = parent.m_pInputFile;
            m_pParentDecl            = parent.m_pParentDecl;
            m_pContainingAgg         = parent.m_pContainingAgg;
            m_pCurrentSwitchType     = parent.m_pCurrentSwitchType;
            m_pOriginalConstantField = parent.m_pOriginalConstantField;
            m_pCurrentFieldSymbol    = parent.m_pCurrentFieldSymbol;
            m_pImplicitlyTypedLocal  = parent.m_pImplicitlyTypedLocal;
            m_pOuterScope            = parent.m_pOuterScope;
            m_pFinallyScope          = parent.m_pFinallyScope;
            m_pTryScope                   = parent.m_pTryScope;
            m_pCatchScope                 = parent.m_pCatchScope;
            m_pCurrentScope               = parent.m_pCurrentScope;
            m_pSwitchScope                = parent.m_pSwitchScope;
            m_pCurrentBlock               = parent.m_pCurrentBlock;
            m_ppamis                      = parent.m_ppamis;
            m_pamiCurrent                 = parent.m_pamiCurrent;
            m_UnsafeState                 = parent.m_UnsafeState;
            m_FinallyNestingCount         = parent.m_FinallyNestingCount;
            m_bInsideTryOfCatch           = parent.m_bInsideTryOfCatch;
            m_bInFieldInitializer         = parent.m_bInFieldInitializer;
            m_bInBaseConstructorCall      = parent.m_bInBaseConstructorCall;
            CheckedNormal                 = parent.CheckedNormal;
            CheckedConstant               = parent.CheckedConstant;
            m_aidExternAliasLookupContext = parent.m_aidExternAliasLookupContext;

            m_bAllowUnsafeBlocks = parent.m_bAllowUnsafeBlocks;
            m_bIsOptimizingSwitchAndArrayInit = parent.m_bIsOptimizingSwitchAndArrayInit;
            m_bShowReachability       = parent.m_bShowReachability;
            m_bWrapNonExceptionThrows = parent.m_bWrapNonExceptionThrows;
            m_bflushLocalVariableTypesForEachStatement = parent.m_bflushLocalVariableTypesForEachStatement;
            m_bInRefactoring = parent.m_bInRefactoring;
            m_bInAttribute   = parent.m_bInAttribute;
            m_bRespectSemanticsAndReportErrors = parent.m_bRespectSemanticsAndReportErrors;
            m_pInitType       = parent.m_pInitType;
            m_returnErrorSink = parent.m_returnErrorSink;

            Debug.Assert(parent.SemanticChecker != null);
            this.SemanticChecker = parent.SemanticChecker;
            this.SymbolLoader    = SemanticChecker.GetSymbolLoader();
        }