Update of /cvsroot/nice/Nice/src/bossa/link
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16026/src/bossa/link
Modified Files:
SourceAlternative.java ImportedAlternative.java
Alternative.java
Log Message:
Methods now specialize other methods with a larger domain (ignoring
subtyping on non-dispatchable types like primitive and tuple types).
Covariance of the return type is not yet checked, and there is not yet a
way to explicitely declare that a method is a specialization.
Index: SourceAlternative.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/link/SourceAlternative.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SourceAlternative.java 11 Sep 2003 20:50:27 -0000 1.3
--- SourceAlternative.java 28 Feb 2004 14:23:43 -0000 1.4
***************
*** 28,34 ****
{
super(implementation.getDeclaration().getName().toString(),
- implementation.getDeclaration().getFullName(),
implementation.getPatterns());
this.implementation = implementation;
}
--- 28,43 ----
{
super(implementation.getDeclaration().getName().toString(),
implementation.getPatterns());
this.implementation = implementation;
+
+ add(implementation.getDeclaration().getFullName());
+
+ java.util.Iterator specializedMethods =
+ implementation.getDeclaration().listSpecializedMethods();
+ if (specializedMethods != null)
+ for (; specializedMethods.hasNext();)
+ {
+ add(((MethodDeclaration) specializedMethods.next()).getFullName());
+ }
}
Index: ImportedAlternative.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/link/ImportedAlternative.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ImportedAlternative.java 28 Feb 2004 12:26:05 -0000 1.7
--- ImportedAlternative.java 28 Feb 2004 14:23:43 -0000 1.8
***************
*** 76,83 ****
}
! new ImportedAlternative(method.getName(), fullName, (Pattern[])
! patterns.toArray(new Pattern[patterns.size()]),
! new QuoteExp(new PrimProcedure(method)),
! location);
}
--- 76,87 ----
}
! Alternative alt =
! new ImportedAlternative(method.getName(), (Pattern[])
! patterns.toArray(new Pattern[patterns.size()]),
! new QuoteExp(new PrimProcedure(method)),
! location);
!
! alt.add(nice.tools.util.System.split
! (fullName, MethodDeclaration.methodListSeparator));
}
***************
*** 111,118 ****
}
! private ImportedAlternative(String name, String fullName, Pattern[] patterns,
gnu.expr.Expression code, Location location)
{
! super(name, fullName, patterns);
this.code = code;
this.location = location;
--- 115,122 ----
}
! private ImportedAlternative(String name, Pattern[] patterns,
gnu.expr.Expression code, Location location)
{
! super(name, patterns);
this.code = code;
this.location = location;
Index: Alternative.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/link/Alternative.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** Alternative.java 2 Feb 2004 13:08:34 -0000 1.47
--- Alternative.java 28 Feb 2004 14:23:43 -0000 1.48
***************
*** 45,54 ****
complete type.
*/
! public Alternative(String methodName, String fullName, Pattern[] patterns)
{
this.methodName = methodName;
- this.fullName = fullName;
this.patterns = patterns;
- add();
}
--- 45,52 ----
complete type.
*/
! public Alternative(String methodName, Pattern[] patterns)
{
this.methodName = methodName;
this.patterns = patterns;
}
***************
*** 176,180 ****
String methodName;
- String fullName;
Pattern[] patterns;
--- 174,177 ----
***************
*** 191,195 ****
}
! private void add()
{
List l = (List) alternatives.get(fullName);
--- 188,192 ----
}
! protected void add(String fullName)
{
List l = (List) alternatives.get(fullName);
***************
*** 205,208 ****
--- 202,211 ----
}
+ protected void add(String[] fullNames)
+ {
+ for (int i = 0; i < fullNames.length; i++)
+ add(fullNames[i]);
+ }
+
public static Stack sortedAlternatives(MethodDeclaration m)
{
|