Exemple #1
0
            /// <summary>
            /// Finalize method info emission and add the new element to the function list.
            /// </summary>
            public override void CloseMethod()
            {
                Contract.Assert(_currentMethod != null);

                List <PdbLines> documentLineSets = new List <PdbLines>();

                foreach (KeyValuePair <int, List <PdbLine> > tokenLinePair in _linesForCurrentMethod)
                {
                    int      lineCount = tokenLinePair.Value.Count;
                    PdbLines lines     = new PdbLines(_sourceDocuments[tokenLinePair.Key], (uint)lineCount);
                    for (int lineIndex = 0; lineIndex < lineCount; lineIndex++)
                    {
                        lines.lines[lineIndex] = tokenLinePair.Value[lineIndex];
                    }
                    documentLineSets.Add(lines);
                }
                _currentMethod.scopes         = _topLevelScopesForCurrentMethod.ToArray();
                _currentMethod.lines          = documentLineSets.ToArray();
                _currentMethod.usedNamespaces = _usedNamespacesForCurrentMethod.ToArray();
                Functions.Add(_currentMethod);
                _currentMethod         = null;
                _linesForCurrentMethod = null;

                _scopeStackForCurrentMethod = null;
                _currentScope = null;
                _topLevelScopesForCurrentMethod = null;
                _usedNamespacesForCurrentMethod = null;
            }
Exemple #2
0
 /// <summary>
 /// Open scope at given IL offset within the method. The scopes may be nested.
 /// </summary>
 /// <param name="startOffset">Starting IL offset for the scope</param>
 public override void OpenScope(int startOffset)
 {
     if (_currentScope != null)
     {
         _scopeStackForCurrentMethod.Push(_currentScope);
     }
     _currentScope = new PdbScopeBuilder((uint)startOffset);
 }
Exemple #3
0
            /// <summary>
            /// Start populating symbol information pertaining to a given method.
            /// </summary>
            /// <param name="methodToken">MSIL metadata token representing the method</param>
            public override void OpenMethod(int methodToken)
            {
                // Nested method opens are not supported
                Contract.Assert(_currentMethod == null);

                _currentMethod         = new PdbFunction();
                _currentMethod.token   = (uint)methodToken;
                _linesForCurrentMethod = new Dictionary <int, List <PdbLine> >();

                _scopeStackForCurrentMethod = new Stack <PdbScopeBuilder>();
                _currentScope = null;
                _topLevelScopesForCurrentMethod = new List <PdbScope>();
                _usedNamespacesForCurrentMethod = new HashSet <string>();
            }
Exemple #4
0
            /// <summary>
            /// Close scope at given IL offset within the method.
            /// </summary>
            /// <param name="endOffset">Ending IL offset for the scope</param>
            public override void CloseScope(int endOffset)
            {
                Contract.Assert(_currentScope != null);
                PdbScope scope = _currentScope.Close((uint)endOffset);

                if (_scopeStackForCurrentMethod.Count != 0)
                {
                    _currentScope = _scopeStackForCurrentMethod.Pop();
                    _currentScope.AddChildScope(scope);
                }
                else
                {
                    _currentScope = null;
                    _topLevelScopesForCurrentMethod.Add(scope);
                }
            }