[Nice-commit] Nice/src/bossa/syntax MethodBodyDefinition.java,1.117,1.118
Brought to you by:
bonniot
|
From: <bo...@us...> - 2003-04-25 17:22:12
|
Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1:/tmp/cvs-serv18965/src/bossa/syntax
Modified Files:
MethodBodyDefinition.java
Log Message:
Re-enabled parameter type naming.
Index: MethodBodyDefinition.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodBodyDefinition.java,v
retrieving revision 1.117
retrieving revision 1.118
diff -C2 -d -r1.117 -r1.118
*** MethodBodyDefinition.java 23 Apr 2003 19:56:57 -0000 1.117
--- MethodBodyDefinition.java 25 Apr 2003 17:21:26 -0000 1.118
***************
*** 51,54 ****
--- 51,55 ----
LocatedString name,
Collection binders,
+ List newTypeVars,
List formals,
Statement body)
***************
*** 61,64 ****
--- 62,68 ----
this.body = body;
this.declaration = null;
+ if (newTypeVars != null)
+ this.newTypeVars = (TypeConstructor[])
+ newTypeVars.toArray(new TypeConstructor[newTypeVars.size()]);
this.insideClass = container != null ||
***************
*** 287,290 ****
--- 291,302 ----
}
+ if (newTypeVars != null)
+ try{
+ typeScope.addSymbols(newTypeVars);
+ }
+ catch(TypeScope.DuplicateName e) {
+ User.error(this, e);
+ }
+
// We can resolve now
Pattern.resolveType(this.typeScope, formals);
***************
*** 339,343 ****
// Introduce the types of the arguments
Monotype[] monotypes = MonoSymbol.getMonotype(parameters);
! Typing.introduce(monotypes);
// The arguments are specialized by the patterns
--- 351,377 ----
// Introduce the types of the arguments
Monotype[] monotypes = MonoSymbol.getMonotype(parameters);
!
! for(int n = 0; n < formals.length; n++)
! {
! Pattern pat = formals[n];
! Monotype type = pat.getType();
! if (type == null)
! Typing.introduce(monotypes[n]);
! else
! {
! parameters[n].type = monotypes[n] = type;
!
! // We need to find the variance of the constructor.
! // This is the only case where a type constructor is created
! // without a known variance. But we can get it easily from the
! // pattern.
! TypeConstructor tc = Types.rawType(type).head();
! if (tc != null && tc.variance == null)
! tc.setVariance(pat.tc.variance);
! }
! }
!
! if (newTypeVars != null)
! Typing.introduce(newTypeVars);
// The arguments are specialized by the patterns
***************
*** 375,408 ****
}
- // Introduction of binders for the types of the arguments
- // as in f(x@C : X)
- for(int n = 0; n < formals.length; n++)
- {
- Pattern pat = formals[n];
- Monotype type = pat.getType();
- if (type == null)
- continue;
-
- MonoSymbol sym = parameters[n];
-
- try{
- TypeConstructor
- tc = type.head(),
- formalTC = ((MonotypeConstructor) sym.getMonotype()).getTC();
-
- if (tc == null)
- Internal.error("Not implemented ?");
-
- tc.setId(formalTC.getId());
- Typing.eq(type, sym.getMonotype());
- }
- catch(TypingEx e){
- throw User.error(pat.name,
- "\":\" constraint for argument "+pat.name+
- " is not correct",
- ": "+e);
- }
- }
-
for(int n = 0; n < formals.length; n++)
{
--- 409,412 ----
***************
*** 539,542 ****
--- 543,547 ----
private Pattern[] formals;
Collection /* of LocatedString */ binders; // Null if type parameters are not bound
+ private TypeConstructor[] newTypeVars;
private Statement body;
private boolean insideClass;
|