Example #1
0
        internal IList <MethodOverride> GetMethodOverrides(CorMethodDef cmd)
        {
            var gpContext = new GenericParamContext(this, cmd);

            var dict = methodRidToOverrides;

            if (dict == null)
            {
                dict = InitializeMethodOverrides();
            }

            if (dict.TryGetValue(cmd.OriginalToken.Rid, out var overrides))
            {
                var newList = new List <MethodOverride>(overrides.Count);

                for (int i = 0; i < overrides.Count; i++)
                {
                    var ovr                  = overrides[i];
                    var newMethodBody        = readerModule.ResolveToken(ovr.MethodBodyToken, gpContext) as IMethodDefOrRef;
                    var newMethodDeclaration = readerModule.ResolveToken(ovr.MethodDeclarationToken, gpContext) as IMethodDefOrRef;
                    Debug.Assert(newMethodBody != null && newMethodDeclaration != null);
                    if (newMethodBody == null || newMethodDeclaration == null)
                    {
                        continue;
                    }
                    newList.Add(new MethodOverride(newMethodBody, newMethodDeclaration));
                }
                return(newList);
            }
            return(new List <MethodOverride>());
        }
Example #2
0
 public CorParamDef(CorModuleDef readerModule, uint rid, CorMethodDef ownerMethod)
 {
     this.readerModule = readerModule;
     this.rid          = rid;
     origRid           = rid;
     this.ownerMethod  = ownerMethod;
 }
Example #3
0
 public CorParamDef(CorModuleDef readerModule, uint rid, CorMethodDef ownerMethod)
 {
     this.readerModule = readerModule;
     this.rid = rid;
     this.origRid = rid;
     this.ownerMethod = ownerMethod;
 }
Example #4
0
		internal ThreadSafe.IList<MethodOverride> GetMethodOverrides(CorMethodDef cmd) {
			var gpContext = new GenericParamContext(this, cmd);

			var dict = methodRidToOverrides;
			if (dict == null)
				dict = InitializeMethodOverrides();

			ThreadSafe.IList<MethodOverrideTokens> overrides;
			if (dict.TryGetValue(cmd.OriginalToken.Rid, out overrides)) {
				var newList = ThreadSafeListCreator.Create<MethodOverride>(overrides.Count);

				for (int i = 0; i < overrides.Count; i++) {
					var ovr = overrides[i];
					var newMethodBody = readerModule.ResolveToken(ovr.MethodBodyToken, gpContext) as IMethodDefOrRef;
					var newMethodDeclaration = readerModule.ResolveToken(ovr.MethodDeclarationToken, gpContext) as IMethodDefOrRef;
					Debug.Assert(newMethodBody != null && newMethodDeclaration != null);
					if (newMethodBody == null || newMethodDeclaration == null)
						continue;
					newList.Add(new MethodOverride(newMethodBody, newMethodDeclaration));
				}
				return newList;
			}
			return ThreadSafeListCreator.Create<MethodOverride>();
		}