Update of /cvsroot/nice/Nice/src/mlsub/compilation
In directory sc8-pr-cvs1:/tmp/cvs-serv30713/src/mlsub/compilation
Modified Files:
make.nice
Added Files:
load.nice
Log Message:
API to load Nice sources without compiling them.
--- NEW FILE: load.nice ---
/**************************************************************************/
/* N I C E */
/* A high-level object-oriented research language */
/* (c) Daniel Bonniot 2003 */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/**************************************************************************/
package mlsub.compilation;
/**
Load modules, and resolve the identifiers, but do not compile them.
@author Daniel Bonniot (bo...@us...)
*/
void loadComponent(Compilation compilation, List<Module> modules)
{
modules.foreach(Module m => m.scope());
modules.foreach(Module m => m.load());
notNull(compilation.root).freezeGlobalContext();
try {
modules.foreach(Module m => m.typedResolve());
}
finally {
notNull(compilation.root).unfreezeGlobalContext();
}
modules.foreach(Module m => m.localResolve());
}
List<List<Module>> load(mlsub.compilation.Compilation compilation)
{
List<List<Module>> sccs =
stronglyConnectedComponents
(notNull(compilation.root), Module m => m.getRequirements());
sccs.foreach(List<Module> scc =>
loadComponent(compilation, scc));
return sccs;
}
Index: make.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/mlsub/compilation/make.nice,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** make.nice 17 Jul 2003 23:10:37 -0000 1.23
--- make.nice 13 Sep 2003 00:39:02 -0000 1.24
***************
*** 24,41 ****
boolean doLink)
{
- modules.foreach(Module m => m.scope());
- modules.foreach(Module m => m.load());
-
- notNull(compilation.root).freezeGlobalContext();
-
- try {
- modules.foreach(Module m => m.typedResolve());
- }
- finally {
- notNull(compilation.root).unfreezeGlobalContext();
- }
-
- modules.foreach(Module m => m.localResolve());
-
notNull(compilation.root).freezeGlobalContext();
--- 24,27 ----
***************
*** 54,60 ****
void make(mlsub.compilation.Compilation compilation)
{
! List<List<Module>> sccs =
! stronglyConnectedComponents
! (notNull(compilation.root), Module m => m.getRequirements());
sccs.foreach(List<Module> scc =>
--- 40,44 ----
void make(mlsub.compilation.Compilation compilation)
{
! List<List<Module>> sccs = load(compilation);
sccs.foreach(List<Module> scc =>
|