[Nice-commit] Nice/src/bossa/syntax methodDeclaration.nice,1.4,1.5 formalParameters.nice,1.8,1.9
Brought to you by:
bonniot
From: Daniel B. <bo...@us...> - 2005-03-13 03:24:14
|
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); |