Nice/src/bossa/syntax methodDeclaration.nice,1.4,1.5 formalParameters.nice,1.8,1.9

Daniel Bonniot <[email protected]> Sun, 13 Mar 2005 03:24:07 +0000
Newsgroups gmane.comp.lang.nice.cvs
Message-ID <[email protected]>
Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8307/src/bossa/syntax

Modified Files:
	methodDeclaration.nice formalParameters.nice 
Log Message:
Optim: avoid checking the type of default values for method parameters in compiled packages.


Index: methodDeclaration.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodDeclaration.nice,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** methodDeclaration.nice	6 Mar 2005 01:34:26 -0000	1.4
--- methodDeclaration.nice	13 Mar 2005 03:24:05 -0000	1.5
***************
*** 83,89 ****
        return;
  
      if (!mlsub.typing.Constraint.hasBinders(notNull(type).getConstraint()))
        {
! 	notNull(parameters).typecheck(notNull(type).domain());
  	return;
        }
--- 83,90 ----
        return;
  
+     boolean check = ! module.compiled();
      if (!mlsub.typing.Constraint.hasBinders(notNull(type).getConstraint()))
        {
! 	notNull(parameters).typecheck(notNull(type).domain(), check);
  	return;
        }
***************
*** 108,112 ****
          mlsub.typing.Typing.implies();
  
! 	notNull(parameters).typecheck(notNull(type).domain());
        }
        finally{
--- 109,113 ----
          mlsub.typing.Typing.implies();
  
! 	notNull(parameters).typecheck(notNull(type).domain(), check);
        }
        finally{

Index: formalParameters.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/formalParameters.nice,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** formalParameters.nice	17 Jan 2005 13:16:57 -0000	1.8
--- formalParameters.nice	13 Mar 2005 03:24:05 -0000	1.9
***************
*** 79,86 ****
    }
  
!   void typecheck(mlsub.typing.Monotype[] domain)
    {
      for (int i = 0; i<this.size(); i++)
!       parameters[i].typecheck(domain[i]);
    }
  
--- 79,86 ----
    }
  
!   void typecheck(mlsub.typing.Monotype[] domain, boolean check)
    {
      for (int i = 0; i<this.size(); i++)
!       parameters[i].typecheck(domain[i], check);
    }
  
***************
*** 268,272 ****
    boolean requiresName() = false;
  
!   void typecheck(mlsub.typing.Monotype domain) {}
  
    ?Expression value() = null;
--- 268,272 ----
    boolean requiresName() = false;
  
!   void typecheck(mlsub.typing.Monotype domain, boolean check) {}
  
    ?Expression value() = null;
***************
*** 399,408 ****
    }
  
!   typecheck(domain)
    {
      defaultValue = defaultValue.noOverloading();
      //defaultValue = defaultValue.resolveOverloading(new mlsub.typing.Polytype(domain));
      typecheck(defaultValue);
  
      try {
        mlsub.typing.Typing.leq(defaultValue.getType(), domain);
--- 399,416 ----
    }
  
!   typecheck(domain, check)
    {
      defaultValue = defaultValue.noOverloading();
      //defaultValue = defaultValue.resolveOverloading(new mlsub.typing.Polytype(domain));
+ 
      typecheck(defaultValue);
  
+     if (! check)
+       {
+ 	// Make sure that the value's type is computed now (when the typing context is right).
+ 	defaultValue.getType();
+ 	return;
+       }
+ 
      try {
        mlsub.typing.Typing.leq(defaultValue.getType(), domain);



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click