dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] pnet/image context.c, 1.16, 1.17 meta_build.c, 1.


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnet/image context.c, 1.16, 1.17 meta_build.c, 1.41, 1.42 misc_token.c, 1.8, 1.9
Date: Tue, 25 Nov 2003 04:17:47 +0000

Update of /cvsroot/dotgnu-pnet/pnet/image
In directory subversions:/tmp/cvs-serv24017/image

Modified Files:
        context.c meta_build.c misc_token.c 
Log Message:


Resolve export type references to files.


Index: meta_build.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_build.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** meta_build.c        25 Nov 2003 03:05:03 -0000      1.41
--- meta_build.c        25 Nov 2003 04:17:45 -0000      1.42
***************
*** 3654,3658 ****
        ILProgramItem *scope = ILClassGetScope(classInfo);
        ILProgramItem *importScope;
!       ILImage *importImage;
        ILClass *importInfo = 0;
        switch(ILProgramItem_Token(scope) & IL_META_TOKEN_MASK)
--- 3654,3658 ----
        ILProgramItem *scope = ILClassGetScope(classInfo);
        ILProgramItem *importScope;
!       ILImage *importImage = 0;
        ILClass *importInfo = 0;
        switch(ILProgramItem_Token(scope) & IL_META_TOKEN_MASK)
***************
*** 3672,3691 ****
                break;
  
                case IL_META_TOKEN_ASSEMBLY_REF:
                {
                        /* Type is imported from a foreign assembly */
                        importImage = ILAssemblyToImage((ILAssembly *)scope);
-                       if(importImage)
-                       {
-                               importScope = ILClassGlobalScope(importImage);
-                               if(importScope)
-                               {
-                                       importInfo = ILClassLookup
-                                               (importScope, 
ILClass_Name(classInfo),
-                                                ILClass_Namespace(classInfo));
-                               }
-                       }
                }
                break;
        }
        if(importInfo)
--- 3672,3705 ----
                break;
  
+               case IL_META_TOKEN_MODULE_REF:
+               {
+                       /* Type is imported from a foreign module */
+                       importImage = ILModuleToImage((ILModule *)scope);
+               }
+               break;
+ 
                case IL_META_TOKEN_ASSEMBLY_REF:
                {
                        /* Type is imported from a foreign assembly */
                        importImage = ILAssemblyToImage((ILAssembly *)scope);
                }
                break;
+ 
+               case IL_META_TOKEN_FILE:
+               {
+                       /* Type is imported from a foreign file */
+                       importImage = ILFileDeclToImage((ILFileDecl *)scope);
+               }
+               break;
+       }
+       if(importImage)
+       {
+               importScope = ILClassGlobalScope(importImage);
+               if(importScope)
+               {
+                       importInfo = ILClassLookup
+                               (importScope, ILClass_Name(classInfo),
+                                ILClass_Namespace(classInfo));
+               }
        }
        if(importInfo)

Index: context.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/context.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** context.c   25 Nov 2003 03:05:03 -0000      1.16
--- context.c   25 Nov 2003 04:17:45 -0000      1.17
***************
*** 121,125 ****
                if(classInfo->scope &&
               (classInfo->scope->token & IL_META_TOKEN_MASK) ==
!                                       IL_META_TOKEN_FILE)
                {
                        goto moduleScope;
--- 121,126 ----
                if(classInfo->scope &&
               (classInfo->scope->token & IL_META_TOKEN_MASK) ==
!                                       IL_META_TOKEN_FILE &&
!                  key->scopeItem->image == classInfo->scope->image)
                {
                        goto moduleScope;

Index: misc_token.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/misc_token.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** misc_token.c        25 Nov 2003 02:01:37 -0000      1.8
--- misc_token.c        25 Nov 2003 04:17:45 -0000      1.9
***************
*** 799,802 ****
--- 799,841 ----
  }
  
+ ILImage *ILFileDeclToImage(ILFileDecl *decl)
+ {
+       if(decl->programItem.linked)
+       {
+               /* We have cached a previous image */
+               return _ILProgramItemResolve(&(decl->programItem))->image;
+       }
+       else
+       {
+               /* Search for a matching ILModule in another image */
+               ILImage *image;
+               ILModule *newModule = 0;
+               image = decl->programItem.image->context->firstImage;
+               while(image != 0 && newModule == 0)
+               {
+                       newModule = 0;
+                       while((newModule = (ILModule *)ILImageNextToken
+                                               (image, IL_META_TOKEN_MODULE, 
newModule)) != 0)
+                       {
+                               if(!ILStrICmp(newModule->name, decl->name))
+                               {
+                                       break;
+                               }
+                       }
+                       image = image->nextImage;
+               }
+               if(!newModule)
+               {
+                       return 0;
+               }
+ 
+               /* Link the reference to the foreign module */
+               _ILProgramItemLink(&(decl->programItem), 
&(newModule->programItem));
+ 
+               /* Return the new module's image to the caller */
+               return newModule->programItem.image;
+       }
+ }
+ 
  ILManifestRes *ILManifestResCreate(ILImage *image, ILToken token,
                                                                   const char 
*name, ILUInt32 attrs)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]