nice-commit Mailing List for The Nice Programming Language (Page 83)
Brought to you by:
bonniot
You can subscribe to this list here.
2003 |
Jan
|
Feb
(60) |
Mar
(125) |
Apr
(183) |
May
(140) |
Jun
(227) |
Jul
(141) |
Aug
(181) |
Sep
(75) |
Oct
(89) |
Nov
(187) |
Dec
(162) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(69) |
Feb
(197) |
Mar
(98) |
Apr
(26) |
May
(10) |
Jun
(85) |
Jul
(88) |
Aug
(79) |
Sep
(80) |
Oct
(81) |
Nov
(53) |
Dec
(109) |
2005 |
Jan
(68) |
Feb
(77) |
Mar
(232) |
Apr
(79) |
May
(37) |
Jun
(37) |
Jul
(3) |
Aug
(18) |
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(10) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(9) |
2007 |
Jan
(2) |
Feb
(8) |
Mar
(2) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
(17) |
Dec
(6) |
2008 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <bo...@us...> - 2003-09-12 11:57:14
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1:/tmp/cvs-serv30438 Modified Files: Makefile Log Message: Correctly install and use javacc.jar when it is not found. Index: Makefile =================================================================== RCS file: /cvsroot/nice/Nice/Makefile,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -d -r1.128 -r1.129 *** Makefile 5 Sep 2003 21:23:53 -0000 1.128 --- Makefile 12 Sep 2003 11:57:08 -0000 1.129 *************** *** 152,157 **** parser: src/bossa/parser/Parser.java src/bossa/parser/Parser.java: src/bossa/parser/Parser.jj ! cd src/bossa/parser; CLASSPATH=`${TOP}/external/javacc` \ ! TOP=${TOP} ${java} javacc Parser.jj bootstrap: parser --- 152,157 ---- parser: src/bossa/parser/Parser.java src/bossa/parser/Parser.java: src/bossa/parser/Parser.jj ! cd src/bossa/parser; CLASSPATH=`TOP=${TOP} ${TOP}/external/javacc` \ ! ${java} javacc Parser.jj bootstrap: parser |
From: <bo...@us...> - 2003-09-12 11:57:14
|
Update of /cvsroot/nice/Nice/external In directory sc8-pr-cvs1:/tmp/cvs-serv30438/external Modified Files: javacc Log Message: Correctly install and use javacc.jar when it is not found. Index: javacc =================================================================== RCS file: /cvsroot/nice/Nice/external/javacc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** javacc 31 Aug 2003 14:31:24 -0000 1.1 --- javacc 12 Sep 2003 11:57:08 -0000 1.2 *************** *** 15,21 **** wget https://javacc.dev.java.net/files/documents/17/686/${version}.zip \ ! -O ${version}.zip ! ( cd external; unzip -j ../${version}.zip ${version}/bin/lib/javacc.jar; \ ! rm ../${version}.zip ) fi --- 15,22 ---- wget https://javacc.dev.java.net/files/documents/17/686/${version}.zip \ ! -O ${TOP}/external/${version}.zip >&2 ! cd ${TOP}/external ! unzip -j ${version}.zip ${version}/bin/lib/javacc.jar >&2 ! rm ${version}.zip fi |
From: <bo...@us...> - 2003-09-11 21:09:51
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1:/tmp/cvs-serv531/testsuite/compiler/methods Added Files: defaultImplementation.testsuite Log Message: Replaced functions by methods with default implementations. --- NEW FILE: defaultImplementation.testsuite --- /// PASS A a = new A(); assert a.f() == 1; a = new B(); assert a.f() == 2; /// Toplevel class A { int f() = 1; } class B extends A { f() = 2; } |
From: <bo...@us...> - 2003-09-11 21:07:06
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1:/tmp/cvs-serv32150/testsuite/compiler/methods Modified Files: constrained.testsuite Log Message: Report an error when a method implementation binds type parameters that are not in the method declaration. Index: constrained.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/constrained.testsuite,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** constrained.testsuite 18 Jun 2003 18:12:46 -0000 1.4 --- constrained.testsuite 11 Sep 2003 21:07:01 -0000 1.5 *************** *** 74,75 **** --- 74,89 ---- /*/// FAIL HERE */ foo(@X){} //@X is not in the domain of foo + + /// FAIL + /// Toplevel + class A + { + void f(); + f() {} + } + + class B extends A + { + // Use type parameter that does not exist in the declaration + <U> f() {} + } |
From: <bo...@us...> - 2003-09-11 21:07:06
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv32150/src/bossa/syntax Modified Files: MethodBodyDefinition.java Log Message: Report an error when a method implementation binds type parameters that are not in the method declaration. Index: MethodBodyDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodBodyDefinition.java,v retrieving revision 1.141 retrieving revision 1.142 diff -C2 -d -r1.141 -r1.142 *** MethodBodyDefinition.java 11 Sep 2003 20:50:27 -0000 1.141 --- MethodBodyDefinition.java 11 Sep 2003 21:07:01 -0000 1.142 *************** *** 303,318 **** // Get type parameters if (binders != null) ! try{ ! typeScope.addMappingsLS ! (binders, ! declaration.getType().getConstraint().binders()); ! } ! catch(mlsub.typing.BadSizeEx e){ ! User.error(name, "Method " + name + ! " expects " + e.expected + " type parameters"); ! } ! catch(TypeScope.DuplicateName e) { ! User.error(this, e); ! } try{ --- 303,322 ---- // Get type parameters if (binders != null) ! { ! Constraint cst = declaration.getType().getConstraint(); ! if (! Constraint.hasBinders(cst)) ! User.error(name, "Method " + name + " has no type parameters"); ! ! try{ ! typeScope.addMappingsLS(binders, cst.binders()); ! } ! catch(mlsub.typing.BadSizeEx e){ ! User.error(name, "Method " + name + ! " expects " + e.expected + " type parameters"); ! } ! catch(TypeScope.DuplicateName e) { ! User.error(this, e); ! } ! } try{ |
From: <bo...@us...> - 2003-09-11 20:56:38
|
Update of /cvsroot/nice/Nice/src/bossa/link In directory sc8-pr-cvs1:/tmp/cvs-serv29355/src/bossa/link Modified Files: Dispatch.java Log Message: Typo. Index: Dispatch.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/link/Dispatch.java,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** Dispatch.java 2 Sep 2003 23:14:14 -0000 1.61 --- Dispatch.java 11 Sep 2003 20:56:35 -0000 1.62 *************** *** 162,166 **** boolean[] isValue = new boolean[method.getArity()]; List values = generateValues(sortedAlternatives, isValue); ! boolean hasValues = values.size() > 0; int nb_errors = 0; --- 162,166 ---- boolean[] isValue = new boolean[method.getArity()]; List values = generateValues(sortedAlternatives, isValue); ! boolean hasValues = values.size() > 0; int nb_errors = 0; |
From: <bo...@us...> - 2003-09-11 20:54:59
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv28969/src/bossa/syntax Removed Files: ToplevelFunction.java Log Message: Replaced functions by methods with a default implementation. --- ToplevelFunction.java DELETED --- |
From: <bo...@us...> - 2003-09-11 20:51:49
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv28152/src/bossa/syntax Added Files: MethodImplementation.java DefaultMethodImplementation.java Log Message: Replaced functions by methods with a default implementation. --- NEW FILE: MethodImplementation.java --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2002 */ /* */ /* 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; /** An implementation of a method @version $Date: 2003/09/11 20:51:46 $ @author daniel (bo...@us...) */ import nice.tools.code.Types; import nice.tools.code.Gen; import mlsub.typing.Typing; import mlsub.typing.TypeConstructor; import mlsub.typing.MonotypeVar; import gnu.bytecode.*; import bossa.util.Debug; import bossa.util.User; public abstract class MethodImplementation extends Definition implements Function { MethodImplementation (LocatedString name, Statement body, Pattern[] formals) { super(name, Node.down); this.body = body; this.formals = formals; } public MethodDeclaration getDeclaration() { return declaration; } public Pattern[] getPatterns() { return formals; } boolean hasThis() { return declaration.formalParameters().hasThis(); } void buildSymbols() { mlsub.typing.Monotype[] types = declaration.getArgTypes(); if(formals.length != types.length) switch(types.length){ case 0: User.error(this,"Method "+name+" has no parameters"); case 1: User.error(this,"Method "+name+" has 1 parameter"); default:User.error(this, "Method "+name+" has "+types.length+" parameters"); } MonoSymbol[] res = new MonoSymbol[formals.length]; for(int tn = 0; tn < formals.length; tn++) { Pattern p = formals[tn]; mlsub.typing.Monotype type; if (p.atAny()) { // When a parameter is not dispatched on, it has the declared type // of that parameter in the method declaration. type = types[tn]; } else if (p.getRuntimeTC() != null) { mlsub.typing.AtomicKind v = p.tc.variance; p.getRuntimeTC().setVariance(v); type = new mlsub.typing.MonotypeConstructor(p.getRuntimeTC(), mlsub.typing.MonotypeVar.news(v.arity())); type.setKind(v); type = bossa.syntax.Monotype.sure(type); } else { if (p.name == null) // anonymous pattern type = new MonotypeVar(types[tn].toString()+ "(argument_" + tn+")"); else type = new MonotypeVar(types[tn].toString()+ "(" + p.name + ")"); } res[tn] = new MonoSymbol(p.name, type); } scope.addSymbols(res); parameters = res; } void resolveBody() { if (hasThis()) Node.thisExp = new SymbolExp(parameters[0], location()); try { body = bossa.syntax.dispatch.analyse (body, scope, typeScope, !Types.isVoid(declaration.getReturnType())); } finally { Node.thisExp = null; } } /**************************************************************** * Type checking ****************************************************************/ public mlsub.typing.Monotype getExpectedType() { return declaration.getReturnType(); } public void checkReturnedType(mlsub.typing.Polytype returned) throws Function.WrongReturnType { try { Typing.leq(returned, declaration.getReturnType()); } catch (mlsub.typing.TypingEx e) { throw new Function.WrongReturnType(e, declaration.getReturnType()); } } /**************************************************************** * Code generation ****************************************************************/ protected abstract Type[] javaArgTypes(); gnu.expr.ReferenceExp ref; gnu.expr.LambdaExp compiledMethod; public gnu.expr.ReferenceExp getRefExp() { if (ref == null) { ref = createRef(); Gen.setMethodBody(compiledMethod, body.generateCode()); } return ref; } public void compile() { if (Debug.codeGeneration) Debug.println("Compiling method body " + this); getRefExp(); } private gnu.expr.ReferenceExp createRef () { createMethod(name.toString()); gnu.expr.ReferenceExp ref = module.addMethod(compiledMethod, true); return ref; } private void createMethod (String bytecodeName) { compiledMethod = Gen.createMethod(bytecodeName, javaArgTypes(), declaration.javaReturnType(), parameters, true, false); compiledMethod.addBytecodeAttribute (new MiscAttr("definition", declaration.getFullName().getBytes())); compiledMethod.addBytecodeAttribute (new MiscAttr("patterns", Pattern.bytecodeRepresentation(formals).getBytes())); } /**************************************************************** * Fields ****************************************************************/ protected MethodDeclaration declaration; protected MonoSymbol[] parameters; protected Pattern[] formals; protected Statement body; } --- NEW FILE: DefaultMethodImplementation.java --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2002 */ /* */ /* 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; /** A the default implementation of a method. @version $Date: 2003/09/11 20:51:46 $ @author daniel (bo...@us...) */ import bossa.util.User; class DefaultMethodImplementation extends MethodImplementation { DefaultMethodImplementation (LocatedString name, Constraint constraint, Monotype returnType, FormalParameters parameters, Contract contract, Statement body) { super(name, body, getAnyPatterns(parameters, name.location())); this.declaration = new NiceMethod.WithDefault (name, constraint, returnType, parameters, contract, this); addChild(declaration); } public static Pattern[] getAnyPatterns(FormalParameters parameters, bossa.util.Location loc) { Pattern[] res = new Pattern[parameters.size]; for (int i = 0; i < res.length; i++) { LocatedString name = parameters.getName(i); if (name == null) name = new LocatedString("_", loc); res[i] = Pattern.any(name); } return res; } void doResolve() { //scope = declaration.scope; typeScope = declaration.typeScope; declaration.doResolve(); buildSymbols(); // Do not reset scope and typeScope to null. } void typedResolve() { declaration.typedResolve(); } void resolveBody() { super.resolveBody(); /*alternative =*/ new bossa.link.SourceAlternative(this); } void innerTypecheck() throws mlsub.typing.TypingEx { Node.currentFunction = this; if (hasThis()) Node.thisExp = new SymbolExp(parameters[0], location()); try{ bossa.syntax.dispatch.typecheck(body); } finally{ Node.currentFunction = null; Node.thisExp = null; } } public void printInterface(java.io.PrintWriter s) { s.print(declaration.toString()); s.print("= ...\n"); } protected gnu.bytecode.Type[] javaArgTypes() { return declaration.javaArgTypes(); } } |
From: <bo...@us...> - 2003-09-11 20:51:00
|
Update of /cvsroot/nice/Nice/src/nice/tools/code In directory sc8-pr-cvs1:/tmp/cvs-serv27659/src/nice/tools/code Modified Files: Types.java Log Message: Replaced functions by methods with a default implementation. Index: Types.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/Types.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** Types.java 1 Sep 2003 20:17:31 -0000 1.51 --- Types.java 11 Sep 2003 20:50:27 -0000 1.52 *************** *** 657,660 **** --- 657,666 ---- } + /** @return the domain of a functional monotype with nullness marker */ + public static Monotype[] domain(Monotype type) + { + return rawType(type).domain(); + } + /** @return the domain of a functional polytype with nullness marker */ public static Monotype[] domain(Polytype type) |
From: <bo...@us...> - 2003-09-11 20:51:00
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv27659/stdlib/nice/lang Modified Files: array.nice Log Message: Replaced functions by methods with a default implementation. Index: array.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/array.nice,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** array.nice 3 Sep 2003 23:26:30 -0000 1.28 --- array.nice 11 Sep 2003 20:50:27 -0000 1.29 *************** *** 86,94 **** <C,T,U> map(a@Array, func) = fill(new U[a.length], int i => func(a[i])); ! <C,T> filter(a@Array, test) = a.filter(test); ! ! // Specialized versions for arrays. ! ! <T> T[] filter(T[] a, T -> boolean test) { int l = a.length; --- 86,90 ---- <C,T,U> map(a@Array, func) = fill(new U[a.length], int i => func(a[i])); ! <C,T> filter(a@Array, test) { int l = a.length; |
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv27659/src/bossa/syntax Modified Files: Pattern.java OverloadedSymbolExp.java NiceMethod.java Module.java MethodBodyDefinition.java AbstractInterface.java AST.java Log Message: Replaced functions by methods with a default implementation. Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** Pattern.java 2 Sep 2003 19:57:52 -0000 1.70 --- Pattern.java 11 Sep 2003 20:50:27 -0000 1.71 *************** *** 104,107 **** --- 104,113 ---- } + static Pattern any(LocatedString name) + { + Pattern res = new Pattern(name); + return res; + } + final TypeConstructor getRuntimeTC() { Index: OverloadedSymbolExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/OverloadedSymbolExp.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** OverloadedSymbolExp.java 26 Jul 2003 22:29:47 -0000 1.58 --- OverloadedSymbolExp.java 11 Sep 2003 20:50:27 -0000 1.59 *************** *** 299,302 **** --- 299,357 ---- } + static void removeNonMinimal(List symbols) + { + // optimization + if(symbols.size()<2) + return; + + int len = symbols.size(); + VarSymbol[] syms = (VarSymbol[]) + symbols.toArray(new VarSymbol[len]); + boolean[] remove = new boolean[len]; + + for(int s1 = 0; s1<len; s1++) { + + Domain d1 = domain(syms[s1].getType()); + + for(int s2 = 0; s2<len; s2++) + /* + Look for symbols s1 and s2 such that + d2 <: d1 and not d1 <: d2 + In that case s1 can be removed, since it is less specific than s2. + + Optimizations: + Skip the diagonal. + If s2 was removed, then there is s3 below s2. + Therefore s1 will be removed anyway. + */ + if (s1 != s2 && !remove[s2]) { + + Domain d2 = domain(syms[s2].getType()); + + try{ + Typing.leq(d2, d1); + try { + Typing.leq(d1, d2); + } + catch (TypingEx e) { + remove[s1] = true; + break; + } + } + catch(TypingEx e){ + } + } + } + + for(int i = 0; i<len; i++) + if(remove[i]) + { + if (Debug.overloading) + Debug.println("Removing " + syms[i] + " since it is not minimal"); + + symbols.remove(syms[i]); + } + } + /** * Removes the symbols that do not have minimal domain types. *************** *** 370,374 **** { // remove nullness marker ! Monotype[] m = ((FunType) Types.rawType(t.getMonotype())).domain(); Monotype[] dom; --- 425,429 ---- { // remove nullness marker ! Monotype[] m = Types.domain(t.getMonotype()); Monotype[] dom; *************** *** 392,395 **** --- 447,458 ---- return new Domain(t.getConstraint(), new TupleType(dom)); + } + + private static Domain domain(Polytype t) + { + // remove nullness marker + Monotype[] m = Types.domain(t.getMonotype()); + + return new Domain(t.getConstraint(), new TupleType(m)); } Index: NiceMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceMethod.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** NiceMethod.java 15 Jul 2003 10:36:18 -0000 1.23 --- NiceMethod.java 11 Sep 2003 20:50:27 -0000 1.24 *************** *** 40,44 **** @param body the body of the function, or null if this is a real method */ ! public static MethodDeclaration create (MethodContainer c, LocatedString name, --- 40,44 ---- @param body the body of the function, or null if this is a real method */ ! public static Definition create (MethodContainer c, LocatedString name, *************** *** 126,131 **** return new NiceMethod(name, constraint, returnType, params, contract); else ! return new ToplevelFunction(name, constraint, returnType, params, ! body, contract); } --- 126,131 ---- return new NiceMethod(name, constraint, returnType, params, contract); else ! return NiceMethod.WithDefault.create ! (name, constraint, returnType, params, body, contract); } *************** *** 170,173 **** --- 170,235 ---- { s.print(super.toString() + ";\n"); + } + + /**************************************************************** + * Method with default implementation + ****************************************************************/ + + public static class WithDefault extends NiceMethod + { + /** + @param name the name of the method + @param constraint the constraint + @param returnType the return type + @param parameters the formal parameters + @param body the body of the function + */ + public static Definition create + (LocatedString name, + Constraint constraint, + Monotype returnType, + FormalParameters parameters, + Statement body, + Contract contract) + { + if (body == null) + return new NiceMethod + (name, constraint, returnType, parameters, contract); + + return new DefaultMethodImplementation + (name, constraint, returnType, parameters, contract, body); + } + + public WithDefault + (LocatedString name, + Constraint constraint, Monotype returnType, + FormalParameters parameters, + Contract contract, + DefaultMethodImplementation impl) + { + super(name, constraint, returnType, parameters, contract); + this.implementation = impl; + } + + DefaultMethodImplementation implementation; + + void resolve() + { + super.resolve(); + + mlsub.typing.Constraint cst = getType().getConstraint(); + if (mlsub.typing.Constraint.hasBinders(cst)) + try { + typeScope.addSymbols(cst.binders()); + } catch (TypeScope.DuplicateName ex) { + User.error(this, "Double declaration of the same type parameter"); + } + } + + void innerTypecheck() throws TypingEx + { + super.innerTypecheck(); + implementation.innerTypecheck(); + } } } Index: Module.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Module.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Module.java 8 Aug 2003 19:16:33 -0000 1.15 --- Module.java 11 Sep 2003 20:50:27 -0000 1.16 *************** *** 32,36 **** gnu.expr.Declaration addGlobalVar(String name, gnu.bytecode.Type type, boolean constant); gnu.expr.Expression getDispatchMethod(NiceMethod def); - gnu.expr.Expression lookupPackageMethod(ToplevelFunction fun); gnu.expr.ReferenceExp addMethod(gnu.expr.LambdaExp method, boolean packageMethod); --- 32,35 ---- Index: MethodBodyDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodBodyDefinition.java,v retrieving revision 1.140 retrieving revision 1.141 diff -C2 -d -r1.140 -r1.141 *** MethodBodyDefinition.java 29 Aug 2003 16:08:11 -0000 1.140 --- MethodBodyDefinition.java 11 Sep 2003 20:50:27 -0000 1.141 *************** *** 34,39 **** @author Daniel Bonniot (bo...@us...) */ ! public class MethodBodyDefinition extends Definition ! implements Function { /** --- 34,38 ---- @author Daniel Bonniot (bo...@us...) */ ! public class MethodBodyDefinition extends MethodImplementation { /** *************** *** 54,66 **** Statement body) { ! super(name, Node.down); this.binders = binders; - this.formals = makeFormals(formals, container, name.location()); - this.body = body; this.declaration = null; ! this.insideClass = container != null || this.formals != null && this.formals.length >= 1 && --- 53,66 ---- Statement body) { ! super(name, body, makeFormals(formals, container, name.location())); this.binders = binders; this.declaration = null; + } ! boolean hasThis() ! { ! return this.formals != null && this.formals.length >= 1 && *************** *** 88,140 **** } ! private MonoSymbol[] buildSymbols(Pattern[] names, Monotype[] types) ! { ! if(names.length != types.length) ! switch(types.length){ ! case 0: User.error(this,"Method "+name+" has no parameters"); ! case 1: User.error(this,"Method "+name+" has 1 parameter"); ! default:User.error(this, ! "Method "+name+" has "+types.length+" parameters"); ! } ! ! MonoSymbol[] res = new MonoSymbol[names.length]; ! for(int tn = 0; tn < names.length; tn++) ! { ! Pattern p = names[tn]; ! ! Monotype type; ! ! if (p.atAny()) ! { ! // When a parameter is not dispatched on, it has the declared type ! // of that parameter in the method declaration. ! type = types[tn]; ! } ! else if (p.getRuntimeTC() != null) ! { ! AtomicKind v = p.tc.variance; ! p.getRuntimeTC().setVariance(v); ! type = new mlsub.typing.MonotypeConstructor(p.getRuntimeTC(), mlsub.typing.MonotypeVar.news(v.arity())); ! type.setKind(v); ! ! type = bossa.syntax.Monotype.sure(type); ! } ! else ! { ! if (p.name == null) ! // anonymous pattern ! type = new MonotypeVar(types[tn].toString()+ "(argument_" + tn+")"); ! else ! type = new MonotypeVar(types[tn].toString()+ "(" + p.name + ")"); ! } ! ! res[tn] = new MonoSymbol(p.name, type); ! } ! return res; ! } ! ! public MethodDeclaration getDeclaration() { ! return declaration; } --- 88,94 ---- } ! final TypeConstructor firstArgument() { ! return formals[0].tc; } *************** *** 159,164 **** alternative = new bossa.link.SourceAlternative(this); ! parameters = buildSymbols(this.formals, declaration.getArgTypes()); ! scope.addSymbols(parameters); } --- 113,117 ---- alternative = new bossa.link.SourceAlternative(this); ! buildSymbols(); } *************** *** 273,276 **** --- 226,230 ---- } + // Check that the non-dispatched parameter names match the declaration outer: for(Iterator it = symbols.iterator(); it.hasNext();) { MethodDeclaration m = ((MethodDeclaration.Symbol) it.next()).getMethodDeclaration(); *************** *** 286,289 **** --- 240,245 ---- } + OverloadedSymbolExp.removeNonMinimal(symbols); + if(symbols.size() == 1) return (VarSymbol) symbols.get(0); *************** *** 321,324 **** --- 277,281 ---- Typing.leq(Types.rawType(m1), Types.rawType(m2)); } + void doResolve() { *************** *** 372,409 **** } - void resolveBody() - { - if (insideClass) - Node.thisExp = new SymbolExp(parameters[0], location()); - - try { - body = bossa.syntax.dispatch.analyse - (body, scope, typeScope, !Types.isVoid(declaration.getReturnType())); - } - finally { - Node.thisExp = null; - } - } - /**************************************************************** * Type checking ****************************************************************/ - public mlsub.typing.Monotype getExpectedType() - { - return declaration.getReturnType(); - } - - public void checkReturnedType(mlsub.typing.Polytype returned) - throws Function.WrongReturnType - { - try { - Typing.leq(returned, declaration.getReturnType()); - } - catch (mlsub.typing.TypingEx e) { - throw new Function.WrongReturnType(e, declaration.getReturnType()); - } - } - void typecheck() { --- 329,336 ---- *************** *** 489,493 **** Node.currentFunction = this; ! if (insideClass) Node.thisExp = new SymbolExp(parameters[0], location()); --- 416,420 ---- Node.currentFunction = this; ! if (hasThis()) Node.thisExp = new SymbolExp(parameters[0], location()); *************** *** 525,529 **** ****************************************************************/ ! private Type[] javaArgTypes() { Type[] res = new Type[parameters.length]; --- 452,456 ---- ****************************************************************/ ! protected Type[] javaArgTypes() { Type[] res = new Type[parameters.length]; *************** *** 539,591 **** } - gnu.expr.ReferenceExp ref; - gnu.expr.LambdaExp compiledMethod; - - public gnu.expr.ReferenceExp getRefExp() - { - if (ref == null) - ref = createRef(); - - return ref; - } - - public void compile() - { - if (Debug.codeGeneration) - Debug.println("Compiling method body " + this); - - getRefExp(); - Gen.setMethodBody(compiledMethod, body.generateCode()); - } - - private gnu.expr.ReferenceExp createRef () - { - createMethod(name.toString(), false); - gnu.expr.ReferenceExp ref = module.addMethod(compiledMethod, true); - - compiledMethod.addBytecodeAttribute - (new MiscAttr("definition", declaration.getFullName().getBytes())); - compiledMethod.addBytecodeAttribute - (new MiscAttr("patterns", - Pattern.bytecodeRepresentation(formals).getBytes())); - - return ref; - } - - final TypeConstructor firstArgument() - { - return formals[0].tc; - } - - private void createMethod (String bytecodeName, boolean member) - { - compiledMethod = - Gen.createMethod(bytecodeName, - javaArgTypes(), - declaration.javaReturnType(), - parameters, - true, member); - } - gnu.expr.Expression[] compiledArguments() { --- 466,469 ---- *************** *** 597,600 **** --- 475,479 ---- bossa.link.Alternative getAlternative() { return alternative; } + /**************************************************************** * Printing *************** *** 606,617 **** } - public Pattern[] getPatterns() { return formals; } - - private MethodDeclaration declaration; - protected MonoSymbol[] parameters; - private Pattern[] formals; Collection /* of LocatedString */ binders; // Null if type parameters are not bound - private Statement body; - private boolean insideClass; } - --- 485,488 ---- Index: AbstractInterface.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/AbstractInterface.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** AbstractInterface.java 28 May 2003 12:57:25 -0000 1.15 --- AbstractInterface.java 11 Sep 2003 20:50:27 -0000 1.16 *************** *** 46,50 **** } ! public void addMethod(MethodDeclaration m) { addChild(m); --- 46,50 ---- } ! public void addMethod(Definition m) { addChild(m); *************** *** 76,81 **** { Object child = i.next(); ! if (child instanceof ToplevelFunction) ! ((ToplevelFunction) child).resolveBody(); } } --- 76,81 ---- { Object child = i.next(); ! if (child instanceof DefaultMethodImplementation) ! ((DefaultMethodImplementation) child).resolveBody(); } } Index: AST.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/AST.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** AST.java 31 Jul 2003 21:59:39 -0000 1.49 --- AST.java 11 Sep 2003 20:50:27 -0000 1.50 *************** *** 55,58 **** --- 55,60 ---- else if (node instanceof GlobalVarDeclaration) globals.add(node); + else if (node instanceof DefaultMethodImplementation) + methods.add(((DefaultMethodImplementation) node).getDeclaration()); } |
From: <bo...@us...> - 2003-09-11 20:50:35
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv27659/debian Modified Files: changelog Log Message: Replaced functions by methods with a default implementation. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.207 retrieving revision 1.208 diff -C2 -d -r1.207 -r1.208 *** changelog 11 Sep 2003 20:43:16 -0000 1.207 --- changelog 11 Sep 2003 20:50:28 -0000 1.208 *************** *** 1,4 **** --- 1,19 ---- nice (0.9.2) unstable; urgency=low + * Removed the concept of function. Now everything is a method, which is more + flexible. + The syntax that used to define a function is still valid: it now + declares a method together with a default implementation. Exemple: + class A { + // Declares a method f, with a default implementation that returns 1. + int f() = 1; + } + + class B extends A { + // Override f for B: + // When called with an argument of type B, f returns 2. + f() = 2; + } + The same applies for methods outside classes. * More dynamic type inference implemented. The type of a local variable is made more precise after a succesful instanceof: |
From: <bo...@us...> - 2003-09-11 20:50:34
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv27659/src/bossa/parser Modified Files: Parser.jj Log Message: Replaced functions by methods with a default implementation. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.206 retrieving revision 1.207 diff -C2 -d -r1.206 -r1.207 *** Parser.jj 2 Sep 2003 19:57:51 -0000 1.206 --- Parser.jj 11 Sep 2003 20:50:27 -0000 1.207 *************** *** 853,857 **** } ! MethodDeclaration internalMethodOrFunction(MethodContainer c): { LocatedString name; --- 853,857 ---- } ! Definition internalMethodOrFunction(MethodContainer c): { LocatedString name; *************** *** 1002,1006 **** { globalDefinitions.add(mb); } | ! { MethodDeclaration m; } m = internalMethodOrFunction(res) { --- 1002,1006 ---- { globalDefinitions.add(mb); } | ! { Definition m; } m = internalMethodOrFunction(res) { *************** *** 1052,1056 **** extensions); } ( ! { MethodDeclaration m; } [ "public" | "private" ] m = internalMethodOrFunction(res) --- 1052,1056 ---- extensions); } ( ! { Definition m; } [ "public" | "private" ] m = internalMethodOrFunction(res) *************** *** 1245,1249 **** } ! MethodDeclaration methodDeclaration(): { LocatedString name; --- 1245,1249 ---- } ! Definition methodDeclaration(): { LocatedString name; *************** *** 1251,1255 **** FormalParameters parameters; Constraint cst; ! MethodDeclaration res; List statements = new LinkedList(); } --- 1251,1255 ---- FormalParameters parameters; Constraint cst; ! Definition res; List statements = new LinkedList(); } *************** *** 1280,1285 **** { Statement body; } body=code() { statements.add(body); } ! { res = new ToplevelFunction(name, cst, returnType, parameters, ! body!=null?new Block(statements):null, contract);} | // Nice method --- 1280,1288 ---- { Statement body; } body=code() { statements.add(body); } ! { res = NiceMethod.WithDefault.create ! (name, cst, returnType, parameters, ! body != null ? new Block(statements) : null, ! contract); ! } | // Nice method |
From: <bo...@us...> - 2003-09-11 20:50:34
|
Update of /cvsroot/nice/Nice/src/bossa/link In directory sc8-pr-cvs1:/tmp/cvs-serv27659/src/bossa/link Modified Files: SourceAlternative.java Log Message: Replaced functions by methods with a default implementation. Index: SourceAlternative.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/link/SourceAlternative.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SourceAlternative.java 18 Apr 2003 14:50:27 -0000 1.2 --- SourceAlternative.java 11 Sep 2003 20:50:27 -0000 1.3 *************** *** 25,29 **** public class SourceAlternative extends Alternative implements Located { ! public SourceAlternative(MethodBodyDefinition implementation) { super(implementation.getDeclaration().getName().toString(), --- 25,29 ---- public class SourceAlternative extends Alternative implements Located { ! public SourceAlternative(MethodImplementation implementation) { super(implementation.getDeclaration().getName().toString(), *************** *** 33,37 **** } ! private MethodBodyDefinition implementation; public Location location() --- 33,37 ---- } ! private MethodImplementation implementation; public Location location() |
From: <bo...@us...> - 2003-09-11 20:50:34
|
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1:/tmp/cvs-serv27659/src/bossa/modules Modified Files: Package.java Log Message: Replaced functions by methods with a default implementation. Index: Package.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** Package.java 8 Aug 2003 19:16:33 -0000 1.96 --- Package.java 11 Sep 2003 20:50:27 -0000 1.97 *************** *** 721,741 **** /** - @return an expression to call this method - if the package has not been recompiled. - */ - public gnu.expr.Expression lookupPackageMethod(ToplevelFunction fun) - { - Method res = lookupClassMethod(source.getBytecode(), - fun.getName().toString(), - "type", fun.getType().toString()); - if (res == null) - return null; - - return new gnu.expr.QuoteExp - (new gnu.expr.PrimProcedure - (res, fun.formalParameters().getParameterCopies())); - } - - /** @return the bytecode method with this (unique) name if the package has not been recompiled. --- 721,724 ---- |
From: <bo...@us...> - 2003-09-11 20:43:20
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv26070/debian Modified Files: changelog Log Message: Fixed typos. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.206 retrieving revision 1.207 diff -C2 -d -r1.206 -r1.207 *** changelog 31 Aug 2003 14:32:26 -0000 1.206 --- changelog 11 Sep 2003 20:43:16 -0000 1.207 *************** *** 16,20 **** * Some more methods are added to nice.lang. * Implemented simple range expressions. 'a..b' is an immutable list of int's ! from a to b(inclusive) where b >= a. Example usage: for (i : 1..10) println(i); * In local variable declarations like 'var x = exp', the inferred type --- 16,20 ---- * Some more methods are added to nice.lang. * Implemented simple range expressions. 'a..b' is an immutable list of int's ! from a to b (inclusive) where b >= a. Example usage: for (i : 1..10) println(i); * In local variable declarations like 'var x = exp', the inferred type *************** *** 130,134 **** required for some reason. * Bugfixes (Parsing of nested tuples, global constants of type char, ! Overloading resolving of methods implementation with additional tc's, ...) * Improved some error messages. --- 130,134 ---- required for some reason. * Bugfixes (Parsing of nested tuples, global constants of type char, ! overloading resolution of method implementations with additional tc's, ...) * Improved some error messages. |
From: <bo...@us...> - 2003-09-11 20:13:01
|
Update of /cvsroot/nice/Nice/testsuite/lib/java/util In directory sc8-pr-cvs1:/tmp/cvs-serv19247/testsuite/lib/java/util Modified Files: collections.testsuite Log Message: Use a special name in the testcase, to make in independent of the stdlib by avoid a name clash. Index: collections.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/lib/java/util/collections.testsuite,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** collections.testsuite 1 May 2003 18:50:58 -0000 1.11 --- collections.testsuite 11 Sep 2003 20:12:58 -0000 1.12 *************** *** 58,64 **** /// PASS /// Toplevel ! <T,U,V | U <: T, V <: T> Set<T> intersection(Set<U>, Set<V>); ! <T,U,V> intersection(s1@Set, s2@Set) { Set<T> res = new HashSet(); if (s1.size() < s2.size()) { --- 58,64 ---- /// PASS /// Toplevel ! <T,U,V | U <: T, V <: T> Set<T> myintersection(Set<U>, Set<V>); ! <T,U,V> myintersection(s1@Set, s2@Set) { Set<T> res = new HashSet(); if (s1.size() < s2.size()) { |
From: <bo...@us...> - 2003-09-11 20:01:08
|
Update of /cvsroot/nice/Nice/src/mlsub/typing/lowlevel In directory sc8-pr-cvs1:/tmp/cvs-serv16116/src/mlsub/typing/lowlevel Modified Files: K0.java Log Message: Handle backup when some lowlevel constraint has been created on the fly at a point where (several) backups existed. Index: K0.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/lowlevel/K0.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** K0.java 26 Jun 2003 10:37:13 -0000 1.19 --- K0.java 11 Sep 2003 20:01:03 -0000 1.20 *************** *** 1372,1377 **** // backtrack to the situation the last time mark() has been called public void backtrack() { S.assume(S.a&& hasBeenInitialized); - S.assume(S.a&& backup != null, "backtrack() without corresponding mark()"); this.m = backup.savedM; --- 1372,1381 ---- // backtrack to the situation the last time mark() has been called public void backtrack() { + if (backup == null) + // This can happen for a K0 that has been created on the fly + // at a point where (several) backups existed. + return; + S.assume(S.a&& hasBeenInitialized); this.m = backup.savedM; |
From: <bo...@us...> - 2003-09-11 19:53:27
|
Update of /cvsroot/nice/Nice/regtest In directory sc8-pr-cvs1:/tmp/cvs-serv12927/regtest Modified Files: regtest Log Message: Specify a locale that uses latin1, so that unicode in identifier can be tested. Index: regtest =================================================================== RCS file: /cvsroot/nice/Nice/regtest/regtest,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** regtest 1 Aug 2003 19:19:35 -0000 1.25 --- regtest 11 Sep 2003 19:53:13 -0000 1.26 *************** *** 25,29 **** compile() { ! (cd ..; "$NICE_TOP"/bin/nicec \ -e -r -a regtest/"$1" -d . \ --classpath=".:${NICE_TOP}/classes" regtest."$1") --- 25,29 ---- compile() { ! (cd ..; LC_CTYPE=french "$NICE_TOP"/bin/nicec \ -e -r -a regtest/"$1" -d . \ --classpath=".:${NICE_TOP}/classes" regtest."$1") |
From: <bo...@us...> - 2003-09-11 17:10:13
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv12201/stdlib/nice/lang Modified Files: collections.nice Log Message: Added foreach on Enumerations. Index: collections.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/collections.nice,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** collections.nice 3 Sep 2003 23:26:30 -0000 1.55 --- collections.nice 11 Sep 2003 17:10:08 -0000 1.56 *************** *** 109,112 **** --- 109,118 ---- } + <T> void foreach(Enumeration<T> enumeration, T->void f) + { + while (enumeration.hasMoreElements()) + f(enumeration.nextElement()); + } + /**************************************************************** * Implementations |
From: <bo...@us...> - 2003-09-11 15:57:52
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv30415/stdlib/nice/lang Modified Files: java.nice Log Message: Added Properties.propertyNames() Index: java.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/java.nice,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** java.nice 31 Aug 2003 22:06:47 -0000 1.36 --- java.nice 11 Sep 2003 15:57:49 -0000 1.37 *************** *** 64,67 **** --- 64,69 ---- ?String System_setProperty(String,String) = native String System.setProperty(String,String); + Enumeration<String> propertyNames(Properties<String,String>) = + native Enumeration Properties.propertyNames(); // PACKAGE: java.text |
From: <bo...@us...> - 2003-09-11 15:44:26
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv27407/src/bossa/syntax Modified Files: VoidConstantExp.java IfExp.java ExpressionStmt.java Block.java Log Message: Print more constructs as valid syntax. Index: VoidConstantExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/VoidConstantExp.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** VoidConstantExp.java 12 May 2001 22:16:28 -0000 1.5 --- VoidConstantExp.java 11 Sep 2003 15:44:20 -0000 1.6 *************** *** 34,38 **** public String toString() { ! return "()"; } } --- 34,38 ---- public String toString() { ! return "{}"; } } Index: IfExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/IfExp.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** IfExp.java 29 Mar 2003 00:30:28 -0000 1.14 --- IfExp.java 11 Sep 2003 15:44:20 -0000 1.15 *************** *** 89,93 **** "\nelse\n" + String.valueOf(elseExp) + ! "\nendif" ; } --- 89,93 ---- "\nelse\n" + String.valueOf(elseExp) + ! "\n" ; } Index: ExpressionStmt.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ExpressionStmt.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ExpressionStmt.java 20 Jan 2003 19:20:59 -0000 1.15 --- ExpressionStmt.java 11 Sep 2003 15:44:20 -0000 1.16 *************** *** 44,48 **** public String toString() { ! return exp.toString(); } --- 44,48 ---- public String toString() { ! return exp.toString() + ";"; } Index: Block.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Block.java,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** Block.java 19 Jul 2003 00:54:05 -0000 1.61 --- Block.java 11 Sep 2003 15:44:20 -0000 1.62 *************** *** 81,84 **** --- 81,92 ---- return null; } + + public String display() + { + if (value == null) + return getSymbol().toString(); + else + return getSymbol().toString() + '=' + value; + } } *************** *** 99,102 **** --- 107,125 ---- LocalValue next, last; + + public String toString() + { + StringBuffer res = new StringBuffer(); + LocalValue v = this; + while (true) { + res.append(v.display()); + v = v.next; + if (v == null) + break; + else + res.append(','); + } + return res.toString(); + } } *************** *** 170,173 **** --- 193,201 ---- last = last.next; } + + public String display() + { + return "var " + super.display(); + } } *************** *** 205,208 **** --- 233,241 ---- last = last.next; } + + public String toString() + { + return "let " + super.display(); + } } *************** *** 377,380 **** --- 410,414 ---- { return "{\n" + + Util.map("",";\n",";\n",locals) + Util.map("",";\n",";\n",statements) + "}\n"; |
From: <bo...@us...> - 2003-09-11 15:44:23
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1:/tmp/cvs-serv27407/testsuite/compiler/classes Modified Files: initializer.testsuite Log Message: Print more constructs as valid syntax. Index: initializer.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/initializer.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** initializer.testsuite 8 Sep 2003 18:49:35 -0000 1.3 --- initializer.testsuite 11 Sep 2003 15:44:20 -0000 1.4 *************** *** 106,107 **** --- 106,123 ---- /// package b import a assert new A().initialised; + + /// PASS + /// package a + /// Toplevel + class A + { + boolean initialised = false; + { + let b1 = true, b2 = true; + if (b1 && b2) + initialised = true; + } + } + /// package b import a + assert new A().initialised; + |
From: <bo...@us...> - 2003-09-09 06:26:19
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv4675/src/bossa/syntax Modified Files: NiceClass.java Log Message: Save class initializers in the package interface (fixes #802210). Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** NiceClass.java 30 Aug 2003 10:37:12 -0000 1.60 --- NiceClass.java 8 Sep 2003 18:49:36 -0000 1.61 *************** *** 500,503 **** --- 500,504 ---- + Util.map("", ";\n", ";\n", fields) + Util.map("", ";\n", ";\n", overrides) + + Util.map("{\n", "\n", "}\n", initializers) + "}\n\n" ); |
From: <bo...@us...> - 2003-09-09 00:50:37
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1:/tmp/cvs-serv4675/testsuite/compiler/classes Modified Files: initializer.testsuite Log Message: Save class initializers in the package interface (fixes #802210). Index: initializer.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/initializer.testsuite,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** initializer.testsuite 28 Jul 2003 10:51:35 -0000 1.2 --- initializer.testsuite 8 Sep 2003 18:49:35 -0000 1.3 *************** *** 96,97 **** --- 96,107 ---- } + /// PASS + /// package a + /// Toplevel + class A + { + boolean initialised = false; + { initialised = true; } + } + /// package b import a + assert new A().initialised; |