[Nice-commit] Nice/src/bossa/syntax customConstructor.nice,1.5,1.6 loop.nice,1.8,1.9 monotype.nice,1
Brought to you by:
bonniot
From: Arjan B. <ar...@us...> - 2004-12-20 17:17:08
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1446/F:/nice/src/bossa/syntax Modified Files: customConstructor.nice loop.nice monotype.nice niceMethod.nice tools.nice Removed Files: TypeParameters.java Log Message: Converted TypeParameters. Index: customConstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/customConstructor.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** customConstructor.nice 20 Dec 2004 16:05:18 -0000 1.5 --- customConstructor.nice 20 Dec 2004 17:16:48 -0000 1.6 *************** *** 168,172 **** let res = createMonotypeConstructor ! (classe, new TypeParameters(params), classe.location()); res.nullness = Monotype.sure; return res; --- 168,172 ---- let res = createMonotypeConstructor ! (classe, new TypeParameters(content: params), classe.location()); res.nullness = Monotype.sure; return res; Index: monotype.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/monotype.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** monotype.nice 18 Dec 2004 22:04:59 -0000 1.5 --- monotype.nice 20 Dec 2004 17:16:48 -0000 1.6 *************** *** 40,44 **** } ! mlsub.typing.Monotype[] resolvedParams = parameters.resolve(typeMap); try{ --- 40,44 ---- } ! mlsub.typing.Monotype[?] resolvedParams = parameters.resolve(notNull(typeMap)); try{ *************** *** 47,51 **** catch(mlsub.typing.BadSizeEx e){ // See if this is a class with default type parameters ! let res = getTypeWithTC(notNull(lowlevelTC), resolvedParams); if (res == null) throw User.error(this, (tc!=null ? "Class "+tc : notNull(lowlevelTC).toString()) + --- 47,51 ---- catch(mlsub.typing.BadSizeEx e){ // See if this is a class with default type parameters ! let res = getTypeWithTC(notNull(lowlevelTC), cast(resolvedParams)); if (res == null) throw User.error(this, (tc!=null ? "Class "+tc : notNull(lowlevelTC).toString()) + *************** *** 60,64 **** Monotype res = createMonotypeConstructor (notNull(tc), ! new TypeParameters(Monotype.substitute(map, notNull(parameters.content))), loc); res.nullness = this.nullness; --- 60,64 ---- Monotype res = createMonotypeConstructor (notNull(tc), ! new TypeParameters(content: Monotype.substitute(map, notNull(parameters.content))), loc); res.nullness = this.nullness; *************** *** 87,91 **** { return new MonotypeConstructor(tc: tc, ! parameters: parameters || new TypeParameters([]), loc: loc); } --- 87,91 ---- { return new MonotypeConstructor(tc: tc, ! parameters: parameters || new TypeParameters(content: []), loc: loc); } *************** *** 94,99 **** --- 94,120 ---- { return new MonotypeConstructor(lowlevelTC: tc, parameters: parameters, loc: loc); + } + + /** + Type parameters. + Holds a colloction of Monotype. + + */ + public class TypeParameters + { + public Monotype[] content; + + mlsub.typing.Monotype[?] resolve(TypeMap ts) + { + return Monotype.resolve(ts, content); + } + + toString() = Util.map("<",", ",">", content); } + public TypeParameters createTypeParameters(List<Monotype> tps) + { + return new TypeParameters(content: Monotype.toArray(tps)); + } /** Functional type. *************** *** 173,177 **** assert tc instanceof MonotypeConstructor; let res = createMonotypeConstructor(notNull(tc.lowlevelTC), ! new TypeParameters(Monotype.substitute(map, parameters)), loc); res.nullness = this.nullness; --- 194,198 ---- assert tc instanceof MonotypeConstructor; let res = createMonotypeConstructor(notNull(tc.lowlevelTC), ! new TypeParameters(content: Monotype.substitute(map, parameters)), loc); res.nullness = this.nullness; Index: loop.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/loop.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** loop.nice 18 Dec 2004 19:41:01 -0000 1.8 --- loop.nice 20 Dec 2004 17:16:48 -0000 1.9 *************** *** 136,140 **** tparams.add(vartype); itertype = createMonotypeConstructor(new TypeIdent(name: new LocatedString("Iterator", loc)), ! new TypeParameters(tparams), loc); notNull(itertype).nullness = Monotype.sure; } --- 136,140 ---- tparams.add(vartype); itertype = createMonotypeConstructor(new TypeIdent(name: new LocatedString("Iterator", loc)), ! createTypeParameters(tparams), loc); notNull(itertype).nullness = Monotype.sure; } Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** tools.nice 20 Dec 2004 16:05:18 -0000 1.82 --- tools.nice 20 Dec 2004 17:16:48 -0000 1.83 *************** *** 209,214 **** ?gnu.bytecode.ClassType staticClass(Arguments) = native gnu.bytecode.ClassType Arguments.staticClass(); ?gnu.bytecode.ClassType staticClass(Expression) = native gnu.bytecode.ClassType Expression.staticClass(); - TypeParameters TypeParameters(List<Monotype>) = native new bossa.syntax.TypeParameters(List); - TypeParameters TypeParameters(Monotype[]) = native new bossa.syntax.TypeParameters(Monotype[]); ?String explainNoMatch(Arguments, List<VarSymbol>) = native String Arguments.explainNoMatch(List); Map<VarSymbol,mlsub.typing.Polytype> types(Arguments) = native Arguments.types; --- 209,212 ---- --- TypeParameters.java DELETED --- Index: niceMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceMethod.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** niceMethod.nice 19 Dec 2004 19:58:28 -0000 1.1 --- niceMethod.nice 20 Dec 2004 17:16:48 -0000 1.2 *************** *** 296,300 **** map.put(getAlikeID(), createMonotypeConstructor(alikeTC, ! new TypeParameters(new ArrayList()), notNull(name.location()))); returnType = returnType.substitute(map); params.substitute(map); --- 296,300 ---- map.put(getAlikeID(), createMonotypeConstructor(alikeTC, ! createTypeParameters(new ArrayList()), notNull(name.location()))); returnType = returnType.substitute(map); params.substitute(map); |