Пример #1
0
        /// <summary>
        /// Discard the current flow analysis information, should be called whenever the routine is transformed.
        /// </summary>
        /// <remarks>
        /// It is expected to be called either on a context without a routine (parameter initializers etc.) or
        /// on a routine with a CFG, hence no abstract methods etc.
        /// </remarks>
        public void InvalidateAnalysis()
        {
            Debug.Assert(Routine?.ControlFlowGraph != null);

            // By incrementing the version, the current flow states won't be valid any longer
            _version++;

            // Reset internal structures to prevent possible bugs in re-analysis
            _usedMask = 0;
            _varsIndex.Clear();
            _varsType = Array.Empty <TypeRefMask>();

            // Revert the information regarding the return type to the default state
            ReturnType = default;

            // TODO: Recreate the state also in the case of a standalone expression (such as a parameter initializer)
            if (_routine != null)
            {
                // Reset routine properties related to the analysis
                _routine.IsReturnAnalysed = false;

                // Recreate the entry state to enable another analysis
                _routine.ControlFlowGraph.Start.FlowState = StateBinder.CreateInitialState(_routine, this);
            }
        }
Пример #2
0
        /// <summary>
        /// Discard the current flow analysis information, should be called whenever the routine is transformed.
        /// </summary>
        /// <remarks>
        /// It is expected to be called either on a context without a routine (parameter initializers etc.) or
        /// on a routine with a CFG, hence no abstract methods etc.
        /// </remarks>
        public void InvalidateAnalysis()
        {
            Debug.Assert(Routine?.ControlFlowGraph != null);

            // By incrementing the version, the current flow states won't be valid any longer
            _version++;

            // Revert the information regarding the return type to the default state
            ReturnType = default;

            // TODO: Recreate the state also in the case of a standalone expression (such as a parameter initializer)
            if (_routine != null)
            {
                _routine.IsReturnAnalysed = false;

                // Recreate the entry state to enable another analysis
                _routine.ControlFlowGraph.Start.FlowState = StateBinder.CreateInitialState(_routine, this);
            }
        }