[Nice-commit] Nice/src/bossa/syntax NiceMethod.java,1.41,1.42 MethodDeclaration.java,1.61,1.62 JavaM
Brought to you by:
bonniot
From: Daniel B. <bo...@us...> - 2004-10-12 23:35:59
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6059/src/bossa/syntax Modified Files: NiceMethod.java MethodDeclaration.java JavaMethod.java InlinedMethod.java Log Message: Allow existing Java methods to be generalized. Index: JavaMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/JavaMethod.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** JavaMethod.java 24 Feb 2004 14:05:48 -0000 1.30 --- JavaMethod.java 12 Oct 2004 23:35:48 -0000 1.31 *************** *** 98,106 **** } ! gnu.expr.Expression getCode() { return nice.tools.code.Gen.wrapInLambda(new PrimProcedure(reflectMethod)); } ! /**************************************************************** * Module interface --- 98,106 ---- } ! public gnu.expr.Expression getCode() { return nice.tools.code.Gen.wrapInLambda(new PrimProcedure(reflectMethod)); } ! /**************************************************************** * Module interface Index: NiceMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceMethod.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** NiceMethod.java 12 Oct 2004 18:39:18 -0000 1.41 --- NiceMethod.java 12 Oct 2004 23:35:48 -0000 1.42 *************** *** 244,249 **** if (! d.specializesMethods() && Typing.smaller(itsDomain, ourDomain, true) && ! ! Types.typeParameterDispatch(getType(), s.getType())) { // d is a specialized version of this. // Therefore, all its implementations also belong to this. --- 244,256 ---- if (! d.specializesMethods() && Typing.smaller(itsDomain, ourDomain, true) && ! ! Types.typeParameterDispatch(s.getType(), getType())) { + if (! Types.covariantSpecialization(s.getType(), getType())) + User.error + (returnTypeLocation!=null ? returnTypeLocation :location(), + "The return type should be less precise than the return type of method\n" + + d + "\ndefined in:\n" + + d.location()); + // d is a specialized version of this. // Therefore, all its implementations also belong to this. Index: InlinedMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/InlinedMethod.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** InlinedMethod.java 11 Feb 2004 13:16:26 -0000 1.17 --- InlinedMethod.java 12 Oct 2004 23:35:48 -0000 1.18 *************** *** 170,174 **** } ! gnu.expr.Expression getCode() { return nice.tools.code.Gen.wrapInLambda(getProcedure()); --- 170,174 ---- } ! public gnu.expr.Expression getCode() { return nice.tools.code.Gen.wrapInLambda(getProcedure()); Index: MethodDeclaration.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodDeclaration.java,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** MethodDeclaration.java 24 Jun 2004 08:11:09 -0000 1.61 --- MethodDeclaration.java 12 Oct 2004 23:35:48 -0000 1.62 *************** *** 455,459 **** protected abstract gnu.expr.Expression computeCode(); ! gnu.expr.Expression getCode() { // Default implementation. --- 455,459 ---- protected abstract gnu.expr.Expression computeCode(); ! public gnu.expr.Expression getCode() { // Default implementation. |