示例#1
0
        internal LocalScope(MetadataReader reader, LocalScopeHandle handle)
        {
            Debug.Assert(reader != null);
            Debug.Assert(!handle.IsNil);

            _reader = reader;
            _rowId = handle.RowId;
        }
        internal ChildScopeData(SymMethod symMethod, ScopeData parent, LocalScopeHandle handle)
            : base(symMethod)
        {
            Debug.Assert(parent != null);
            Debug.Assert(!handle.IsNil);

            _handle = handle;
            _parent = parent;
        }
示例#3
0
        internal void GetLocalConstantRange(LocalScopeHandle scope, out int firstConstantRowId, out int lastConstantRowId)
        {
            int scopeRowId = scope.RowId;

            firstConstantRowId = this.LocalScopeTable.GetConstantStart(scopeRowId);
            if (firstConstantRowId == 0)
            {
                firstConstantRowId = 1;
                lastConstantRowId = 0;
            }
            else if (scopeRowId == this.LocalScopeTable.NumberOfRows)
            {
                lastConstantRowId = this.LocalConstantTable.NumberOfRows;
            }
            else
            {
                lastConstantRowId = this.LocalScopeTable.GetConstantStart(scopeRowId + 1) - 1;
            }
        }
示例#4
0
 public LocalScope GetLocalScope(LocalScopeHandle handle)
 {
     return new LocalScope(this, handle);
 }
示例#5
0
 internal ImportScopeHandle GetImportScope(LocalScopeHandle handle)
 {
     int rowOffset = (handle.RowId - 1) * RowSize;
     return ImportScopeHandle.FromRowId(Block.PeekReference(rowOffset + _importScopeOffset, _isImportScopeRefSmall));
 }
        //
        // Gather the local details in a scope and then recurse to child scopes
        //
        private void ProbeScopeForLocals(List<ILLocalVariable> variables, LocalScopeHandle localScopeHandle)
        {
            var localScope = _reader.GetLocalScope(localScopeHandle);

            foreach (var localVariableHandle in localScope.GetLocalVariables())
            {
                var localVariable = _reader.GetLocalVariable(localVariableHandle);

                var name = _reader.GetString(localVariable.Name);
                bool compilerGenerated = (localVariable.Attributes & LocalVariableAttributes.DebuggerHidden) != 0;

                variables.Add(new ILLocalVariable(localVariable.Index, name, compilerGenerated));
            }

            var children = localScope.GetChildren();
            while (children.MoveNext())
            {
                ProbeScopeForLocals(variables, children.Current);
            }
        }
示例#7
0
 public static LocalScope GetLocalScope(this LocalScopeHandle handle, MetadataReader reader) => reader.GetLocalScope(handle);
示例#8
0
 public LocalScopeEntry(PEFile module, MetadataReader metadata, bool isEmbedded, LocalScopeHandle handle)
 {
     this.offset = isEmbedded ? null : (int?)metadata.GetTableMetadataOffset(TableIndex.LocalScope)
                   + metadata.GetTableRowSize(TableIndex.LocalScope) * (MetadataTokens.GetRowNumber(handle) - 1);
     this.module     = module;
     this.metadata   = metadata;
     this.handle     = handle;
     this.localScope = metadata.GetLocalScope(handle);
 }