PERWAPI.Scope.AddLocalBinding C# (CSharp) Метод

AddLocalBinding() приватный Метод

private AddLocalBinding ( string name, int index ) : LocalBinding
name string
index int
Результат LocalBinding
        internal LocalBinding AddLocalBinding(string name, int index)
        {
            LocalBinding binding;
               if ((binding = FindLocalBinding(name)) != null)
             return binding;

               binding = new LocalBinding(index, name);
               _localBindings.Add(binding);
               return binding;
        }

Usage Example

Пример #1
0
        //public void ReadPDB() {
        //  PDBReader reader = new PDBReader(this.fileName);
        //  foreach (ClassDef cDef in GetClasses())
        //    foreach (MethodDef mDef in cDef.GetMethods()) {
        //      CILInstructions buffer = mDef.GetCodeBuffer();
        //      PDBMethod meth = reader.GetMethod((int) mDef.Token());
        //      if (meth == null)
        //        continue; // no symbols for this method
        //      PDBSequencePoint[] spList = meth.SequencePoints;
        //      MergeBuffer mergeBuffer = new MergeBuffer(buffer.GetInstructions());
        //      PDBScope outer = meth.Scope;
        //      buffer.currentScope = ReadPDBScope(outer, mergeBuffer, null, mDef);
        //      foreach (PDBSequencePoint sp in spList) {
        //        PDBDocument doc = sp.Document;
        //        mergeBuffer.Add(new Line((uint) sp.Line, (uint) sp.Column, (uint) sp.EndLine, (uint) sp.EndColumn,
        //          SourceFile.GetSourceFile(doc.URL, doc.Language, doc.LanguageVendor, doc.DocumentType)),
        //          (uint) sp.Offset);
        //      }
        //      buffer.SetInstructions(mergeBuffer.Instructions);
        //    }
        // }
        private Scope ReadPDBScope(PDBScope scope, MergeBuffer mergeBuffer, Scope parent, MethodDef thisMeth)
        {
            Scope thisScope = new Scope(parent, thisMeth);

            if (parent != null) mergeBuffer.Add(new OpenScope(thisScope), (uint) scope.StartOffset);

            foreach (PDBVariable var in scope.Variables)
                thisScope.AddLocalBinding(var.Name, var.Address);

            foreach (PDBScope child in scope.Children)
                ReadPDBScope(child, mergeBuffer, thisScope, thisMeth);

            if (parent != null) mergeBuffer.Add(new CloseScope(thisScope), (uint) scope.EndOffset);

            return thisScope;
        }