| Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9786/src/bossa/syntax
Modified Files:
	nicefield.nice niceclass.nice 
Log Message:
Optimization: avoid checking the type of fields in compiled packages.
Index: nicefield.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/nicefield.nice,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** nicefield.nice	16 Jan 2005 00:28:21 -0000	1.7
--- nicefield.nice	13 Mar 2005 05:53:46 -0000	1.8
***************
*** 60,64 ****
    }
  
!   void typecheck()
    {
      if (value != null)
--- 60,64 ----
    }
  
!   void typecheck(boolean compiled)
    {
      if (value != null)
***************
*** 70,73 ****
--- 70,82 ----
  	typecheck(notNull(value));
  
+ 	if (compiled)
+ 	  {
+ 	    // Just make sure that the value's type is computed now
+ 	    // (when the typing context is right).
+ 	    // We don't need to check the type against the declared type.
+ 	    notNull(value).getType();
+ 	    return;
+ 	  }
+ 
  	try {
  	  mlsub.typing.Typing.leq(notNull(value).getType(), declaredType);
***************
*** 179,183 ****
    } 
  
!   typecheck()
    {
      ?gnu.expr.Declaration decl = null;
--- 188,192 ----
    } 
  
!   typecheck(compiled)
    {
      ?gnu.expr.Declaration decl = null;
***************
*** 271,275 ****
    }
  
!   void typecheck()
    {
      boolean exists = false;
--- 280,284 ----
    }
  
!   void typecheck(boolean compiled)
    {
      boolean exists = false;
Index: niceclass.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceclass.nice,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** niceclass.nice	6 Mar 2005 01:34:26 -0000	1.26
--- niceclass.nice	13 Mar 2005 05:53:46 -0000	1.27
***************
*** 194,198 ****
    }
  
!   private boolean checkValueOverride(LocatedString name, Expression value)
    {
      ?NiceField original = null;
--- 194,198 ----
    }
  
!   boolean checkValueOverride(LocatedString name, Expression value)
    {
      ?NiceField original = null;
***************
*** 304,316 ****
    typecheck()
    {
      try {
        for (field : fields)
! 	field.typecheck();
  
        for (or : overrides)
! 	or.typecheck();
  
        for (valueOverride : valueOverrides)
!         valueOverride.typecheck();
  
        if (! initializers.isEmpty())
--- 304,318 ----
    typecheck()
    {
+     let compiled = definition.module.compiled();
+ 
      try {
        for (field : fields)
! 	field.typecheck(compiled);
  
        for (or : overrides)
! 	or.typecheck(compiled);
  
        for (valueOverride : valueOverrides)
!         valueOverride.typecheck(compiled);
  
        if (! initializers.isEmpty())
 |