logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Nice/src/bossa/modules Package.java,1.114,1.115: msg#00065

Subject: Nice/src/bossa/modules Package.java,1.114,1.115
Update of /cvsroot/nice/Nice/src/bossa/modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv403/src/bossa/modules

Modified Files:
        Package.java 
Log Message:
Compile dispatch methods as member methods whenever possible, to make
integration with Java tools and code easier.


Index: Package.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v
retrieving revision 1.114
retrieving revision 1.115
diff -C2 -d -r1.114 -r1.115
*** Package.java        5 Mar 2004 14:07:14 -0000       1.114
--- Package.java        20 Mar 2004 15:49:24 -0000      1.115
***************
*** 812,817 ****
        retType  = def.javaReturnType();
        }
      res = nice.tools.code.Gen.createMethod
!       (name, argTypes, retType, def.getSymbols());
      res.parameterCopies = def.formalParameters().getParameterCopies();
  
--- 812,836 ----
        retType  = def.javaReturnType();
        }
+ 
+     // Try to compile the dispatch method as a member method if possible.
+     NiceClass receiver;
+     if (argTypes.length == 0)
+       receiver = null;
+     else
+       {
+         receiver = NiceClass.get(def.getArgTypes()[0]);
+ 
+         // JVM interfaces cannot contain code.
+         if (receiver != null && receiver.isInterface())
+           receiver = null;
+ 
+         // Special treatment for serialization at the moment.
+         if (def.getArity() == 2 && 
+             (name.equals("writeObject")||name.equals("readObject")))
+           receiver = null;
+       }
+ 
      res = nice.tools.code.Gen.createMethod
!       (name, argTypes, retType, def.getSymbols(), true, receiver != null);
      res.parameterCopies = def.formalParameters().getParameterCopies();
  
***************
*** 820,824 ****
        (new MiscAttr("id", def.getFullName().getBytes()));
  
!     return addMethod(res, false);
    }
  
--- 839,846 ----
        (new MiscAttr("id", def.getFullName().getBytes()));
  
!     if (receiver != null)
!       return receiver.addJavaMethod(res);
!     else
!       return addMethod(res, false);
    }
  



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click


<Prev in Thread] Current Thread [Next in Thread>