Update of /cvsroot/nice/Nice/src/bossa/modules
In directory sc8-pr-cvs1:/tmp/cvs-serv16555/src/bossa/modules
Modified Files:
Package.java Content.java
Log Message:
Load custom constructors form the bytecode of compiled packages.
Index: Package.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v
retrieving revision 1.106
retrieving revision 1.107
diff -C2 -d -r1.106 -r1.107
*** Package.java 27 Nov 2003 15:23:11 -0000 1.106
--- Package.java 15 Dec 2003 02:40:17 -0000 1.107
***************
*** 121,125 ****
compilation.progress(this, "parsing");
! this.ast = new AST(this, source.getDefinitions(shouldReload));
compilation.addNumberOfDeclarations(ast.numberOfDeclarations());
--- 121,127 ----
compilation.progress(this, "parsing");
! definitions = new ArrayList();
! source.getDefinitions(definitions, shouldReload);
! this.ast = new AST(this, definitions);
compilation.addNumberOfDeclarations(ast.numberOfDeclarations());
***************
*** 612,615 ****
--- 614,618 ----
if (classe == null)
Internal.error("Compiled class " + def + " was not found");
+ importMethods(def, classe);
ClassExp res = new ClassExp(classe);
***************
*** 618,621 ****
--- 621,637 ----
}
+ /** Load methods compiled in a class (custom constructors for now). */
+ private void importMethods(NiceClass def, ClassType classe)
+ {
+ for(Method method = classe.getMethods();
+ method != null;
+ method = method.getNext())
+ {
+ Definition d = CustomConstructor.load(def, method);
+ if (d != null)
+ definitions.add(d);
+ }
+ }
+
public void addUserClass(gnu.expr.ClassExp classe)
{
***************
*** 853,856 ****
--- 869,875 ----
private boolean isRoot;
+ /** The list of definitions. Used to add global definitions on the fly. */
+ private List definitions;
+
private AST ast;
Index: Content.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/modules/Content.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Content.java 22 Jul 2003 16:56:28 -0000 1.11
--- Content.java 15 Dec 2003 02:40:17 -0000 1.12
***************
*** 74,81 ****
}
! List getDefinitions(boolean shouldReload)
{
- List definitions = new LinkedList();
-
Content.Unit[] readers = getReaders(shouldReload);
--- 74,79 ----
}
! void getDefinitions(List definitions, boolean shouldReload)
{
Content.Unit[] readers = getReaders(shouldReload);
***************
*** 90,97 ****
pkg.compilation.exitIfErrors();
! return expand(definitions);
}
! private static List expand(List definitions)
{
Collection ads = new LinkedList();
--- 88,95 ----
pkg.compilation.exitIfErrors();
! expand(definitions);
}
! private static void expand(List definitions)
{
Collection ads = new LinkedList();
***************
*** 104,108 ****
}
definitions.addAll(ads);
- return definitions;
}
--- 102,105 ----
|