[Nice-commit] Nice/src/bossa/syntax monotype.nice,NONE,1.1 symbol.nice,1.1,1.2 tools.nice,1.72,1.73
Brought to you by:
bonniot
From: Arjan B. <ar...@us...> - 2004-12-15 03:46:09
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2818/F:/nice/src/bossa/syntax Modified Files: symbol.nice tools.nice Added Files: monotype.nice Removed Files: FunType.java Log Message: Converted FunType. Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** tools.nice 14 Dec 2004 22:49:12 -0000 1.72 --- tools.nice 15 Dec 2004 03:45:59 -0000 1.73 *************** *** 260,263 **** --- 260,266 ---- List<FormalParameters.Parameter> getRequiredParameters(FormalParameters) = native List FormalParameters.getRequiredParameters(); List<FormalParameters.Parameter> asList(FormalParameters) = native List FormalParameters.asList(); + boolean containsAlike(Monotype[]) = native boolean Monotype.containsAlike(Monotype[]); + bossa.syntax.Monotype[] substitute(Map<String,bossa.syntax.Monotype>,bossa.syntax.Monotype[]) = native bossa.syntax.Monotype[] bossa.syntax.Monotype.substitute(Map,bossa.syntax.Monotype[]); + Monotype[?] types(FormalParameters) = native Monotype[] FormalParameters.types(); // Retypings needed since java types are not strict. --- NEW FILE: monotype.nice --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2004 */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /**************************************************************************/ package bossa.syntax; import bossa.util.*; /** Functional type. */ public class FunType extends bossa.syntax.Monotype { private bossa.syntax.Monotype[] in; private bossa.syntax.Monotype out; rawResolve(typeMap) { return new mlsub.typing.FunType (bossa.syntax.Monotype.resolve(notNull(typeMap), in), out.resolve(typeMap)); } substitute(map) { bossa.syntax.Monotype res = new bossa.syntax.FunType (in: bossa.syntax.Monotype.substitute(map,in), out: out.substitute(map)); res.nullness = this.nullness; return res; } containsAlike() = Monotype.containsAlike(in) || out.containsAlike(); location() = out.location(); toString() { return "(" + Util.map("", ", ", "", in) + (nullness == maybe ? ")?->" : ")->") + out; } toStringExtern() = "(" + Util.map("", ", ", "", in) + ")->" + out.toStringExtern(); } public FunType createFunType(?List<bossa.syntax.Monotype> in, bossa.syntax.Monotype out) { return new FunType(in: (in != null ? in.toArray() : []), out: out); } public FunType createFunType_(bossa.syntax.Monotype[?] in, bossa.syntax.Monotype out) { return new FunType(in: (in != null ? in : []), out: out); } --- FunType.java DELETED --- Index: symbol.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/symbol.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** symbol.nice 21 Nov 2004 23:24:37 -0000 1.1 --- symbol.nice 15 Dec 2004 03:45:59 -0000 1.2 *************** *** 138,142 **** { this(name, parameters: parameters, arity: parameters.size, syntacticType: ! new Polytype(constraint, new FunType(parameters.types(), returnType))); } --- 138,142 ---- { this(name, parameters: parameters, arity: parameters.size, syntacticType: ! new Polytype(constraint, createFunType(parameters.types(), returnType))); } *************** *** 200,204 **** FormalParameters parameters = declaration.formalParameters(); this(name, declaration: declaration, parameters: parameters, arity: parameters.size, ! syntacticType: new Polytype(constraint, new FunType(parameters.types(), returnType))); } --- 200,204 ---- FormalParameters parameters = declaration.formalParameters(); this(name, declaration: declaration, parameters: parameters, arity: parameters.size, ! syntacticType: new Polytype(constraint, createFunType(parameters.types(), returnType))); } |