Update of /cvsroot/nice/Nice/src/gnu/expr
In directory sc8-pr-cvs1:/tmp/cvs-serv16555/src/gnu/expr
Modified Files:
InstantiateProc.java ConstructorExp.java ClassExp.java
Log Message:
Load custom constructors form the bytecode of compiled packages.
Index: InstantiateProc.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/gnu/expr/InstantiateProc.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** InstantiateProc.java 14 Dec 2003 16:52:32 -0000 1.3
--- InstantiateProc.java 15 Dec 2003 02:40:16 -0000 1.4
***************
*** 27,31 ****
--- 27,37 ----
public InstantiateProc (Method constructor)
{
+ this(constructor, 0);
+ }
+
+ public InstantiateProc (Method constructor, int dummyArgs)
+ {
this.constructor = constructor;
+ this.dummyArgs = dummyArgs;
}
***************
*** 37,40 ****
--- 43,47 ----
private Method constructor;
private ConstructorExp method;
+ private int dummyArgs;
public void compile (ApplyExp exp, Compilation comp, Target target)
***************
*** 56,61 ****
// Add dummy arguments to match the bytecode constructor.
if (method !=null)
! for (int i = 0; i < method.dummyArgs; i++)
! code.emitPushInt(0);
code.emitInvokeSpecial(constructor);
--- 63,69 ----
// Add dummy arguments to match the bytecode constructor.
if (method !=null)
! dummyArgs = method.dummyArgs;
! for (int i = 0; i < dummyArgs; i++)
! code.emitPushInt(0);
code.emitInvokeSpecial(constructor);
Index: ConstructorExp.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/gnu/expr/ConstructorExp.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ConstructorExp.java 14 Dec 2003 16:52:32 -0000 1.5
--- ConstructorExp.java 15 Dec 2003 02:40:16 -0000 1.6
***************
*** 87,90 ****
--- 87,92 ----
("<init>", args, Type.void_type, Access.PUBLIC);
primMethods = new Method[] { method };
+
+ addAttributes(method);
}
Index: ClassExp.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/gnu/expr/ClassExp.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** ClassExp.java 27 Nov 2003 00:21:19 -0000 1.16
--- ClassExp.java 15 Dec 2003 02:40:16 -0000 1.17
***************
*** 100,104 ****
Method m = instanceType.getDeclaredMethod
(method.getName(), method.getArgTypes());
! if (m != null)
{
m.eraseCode();
--- 100,104 ----
Method m = instanceType.getDeclaredMethod
(method.getName(), method.getArgTypes());
! if (m != null && ! m.isConstructor())
{
m.eraseCode();
|