Thread: [Nice-commit] Nice/src/bossa/syntax constraint.nice,NONE,1.1 tools.nice,1.69,1.70 typedef.nice,1.3,1
Brought to you by:
bonniot
From: Arjan B. <ar...@us...> - 2004-12-08 23:04:21
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14725/F:/nice/src/bossa/syntax Modified Files: tools.nice typedef.nice Added Files: constraint.nice Removed Files: ImplementsCst.java MonotypeLeqCst.java TypeConstructorLeqCst.java Log Message: Converted AtomicConstraint subclasses. --- TypeConstructorLeqCst.java DELETED --- Index: typedef.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typedef.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** typedef.nice 1 Dec 2004 02:00:32 -0000 1.3 --- typedef.nice 8 Dec 2004 23:03:37 -0000 1.4 *************** *** 407,412 **** bossa.syntax.Monotype v = bossa.syntax.Monotype.create(mvar); ! atoms.add(new MonotypeLeqCst(bossa.syntax.Monotype.create(params[i]), v)); ! atoms.add(new MonotypeLeqCst(v, bossa.syntax.Monotype.create(params[i]))); } --- 407,412 ---- bossa.syntax.Monotype v = bossa.syntax.Monotype.create(mvar); ! atoms.add(new MonotypeLeqCst(m1: bossa.syntax.Monotype.create(params[i]), m2: v)); ! atoms.add(new MonotypeLeqCst(m1: v, m2: bossa.syntax.Monotype.create(params[i]))); } --- ImplementsCst.java DELETED --- Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** tools.nice 6 Dec 2004 23:32:23 -0000 1.69 --- tools.nice 8 Dec 2004 23:03:37 -0000 1.70 *************** *** 251,254 **** --- 251,256 ---- MethodContainer MethodContainer(LocatedString, int, MethodContainer.Constraint, List<?boolean>) = native new MethodContainer(LocatedString, int, MethodContainer.Constraint, List); AST AST(List<Definition>, int) = native new AST(List, int); + ?String getParentFor(AtomicConstraint, mlsub.typing.TypeConstructor) = native String AtomicConstraint.getParentFor(mlsub.typing.TypeConstructor); + mlsub.typing.AtomicConstraint resolve(AtomicConstraint, TypeScope) = native mlsub.typing.AtomicConstraint AtomicConstraint.resolve(TypeScope); // Retypings needed since java types are not strict. --- NEW FILE: constraint.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.*; /** Syntactic inequality between monotypes. */ public class MonotypeLeqCst extends AtomicConstraint { Monotype m1; Monotype m2; resolve(ts) { return new mlsub.typing.MonotypeLeqCst (m1.resolve(ts), m2.resolve(ts)); } toString() = m1 + " <: " + m2; } /** Inequality between TypeConstructors. */ public class TypeConstructorLeqCst extends AtomicConstraint { mlsub.typing.TypeConstructor t1; TypeIdent t2; resolve(ts) { // If t2 resolve to an interface definition, // this constraint meant t1 implements t2 let s = t2.resolveToTypeSymbol(ts); if (s instanceof mlsub.typing.Interface) return new mlsub.typing.ImplementsCst(t1, s); if (!(s instanceof mlsub.typing.TypeConstructor)) throw User.error(t2, t2 + " is not a class"); let c2 = getTypeDefinition(s); if (c2 != null) { let associatedInterface = c2.getAssociatedInterface(); if (associatedInterface!=null) return new mlsub.typing.ImplementsCst(t1, associatedInterface); } return new mlsub.typing.TypeConstructorLeqCst(t1, s); } toString() = t1 + " <: " + t2; getParentFor(tc) { if (this.t1 == tc) return t2.toString(); else return null; } } /** A type constructor implements an interface. */ public class ImplementsCst extends AtomicConstraint { TypeIdent tc; TypeIdent itf; resolve(scope) { TypeConstructor stc = tc.resolveToTC(scope); TypeSymbol sitf = itf.resolveToTypeSymbol(scope); if (! (sitf instanceof Interface)) throw User.error(itf, itf+" should be an interface"); return new mlsub.typing.ImplementsCst(stc, sitf); } toString() = tc + ":" + itf; } --- MonotypeLeqCst.java DELETED --- |