Esempio n. 1
0
 public void AddMethod(MethodEntry/*!*/ method)
 {
     if (_methods == null) {
         _methods = new List<MethodEntry>();
     }
     _methods.Add(method);
 }
Esempio n. 2
0
 public void AddNested(MethodEntry/*!*/ method)
 {
     if (_nestedMethods == null) {
         _nestedMethods = new List<MethodEntry>();
     } else {
         // children need to be sorted by position:
         Debug.Assert(_nestedMethods.Last().End <= method.Start);
     }
     _nestedMethods.Add(method);
 }
Esempio n. 3
0
        public override bool Enter(MethodDefinition/*!*/ node)
        {
            var outerModule = _outerModules.Peek();

            string targetName;
            bool isSelfSingleton =
                !outerModule.IsSingleton && IsSelfModuleReference(node.Target, out targetName) ||
                outerModule.IsSingleton && node.Target == null;

            var entry = new MethodEntry(node, isSelfSingleton);

            // add to the outer method:
            if (_outerMethods.Count > 0) {
                var outerMethod = _outerMethods.Peek();
                if (outerMethod != null) {
                    outerMethod.AddNested(entry);
                }
            }

            // add to the outer module:
            // TODO: lookup target name...
            if (isSelfSingleton || node.Target == null) {
                outerModule.AddMethod(entry);
            }

            _outerName.Add(null);
            _outerMethods.Push(entry);
            return true;
        }
Esempio n. 4
0
 public MethodEntry LocateMethod(int position)
 {
     return(MethodEntry.LocateMethod(_methods, position));
 }