nice-commit Mailing List for The Nice Programming Language (Page 67)
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-12-14 10:49:18
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv23930/src/bossa/syntax Modified Files: AST.java Log Message: Removed instanceof test, since resolution is already handled via states for classes. Index: AST.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/AST.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** AST.java 13 Dec 2003 14:54:08 -0000 1.53 --- AST.java 13 Dec 2003 16:10:07 -0000 1.54 *************** *** 113,118 **** { Node n = (Node) i.next(); ! if (!(n instanceof ClassDefinition)) ! resolve(n); } --- 113,117 ---- { Node n = (Node) i.next(); ! resolve(n); } |
From: <bo...@us...> - 2003-12-14 10:40:30
|
Update of /cvsroot/nice/Nice/lib/emacs In directory sc8-pr-cvs1:/tmp/cvs-serv1134/lib/emacs Modified Files: nice-mode.el Log Message: Set the compilation hooks only in our compilation buffer, not globally. This way, we don't canibalize other modes, and we make sure not to be overriden either. Index: nice-mode.el =================================================================== RCS file: /cvsroot/nice/Nice/lib/emacs/nice-mode.el,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** nice-mode.el 10 Dec 2003 14:31:19 -0000 1.32 --- nice-mode.el 13 Dec 2003 18:28:41 -0000 1.33 *************** *** 425,432 **** (func-decl-cont . c-lineup-java-throws))) t) - ;(make-local-variable 'compilation-exit-message-function) - (setq compilation-exit-message-function 'nice-compilation-exit) - (setq compilation-finish-function 'nice-compilation-finish-function) - (local-set-key "\C-c\C-b" 'nice-compile-buffer) (local-set-key "\C-c\C-c" 'nice-comment-region-or-line) --- 425,428 ---- *************** *** 523,526 **** --- 519,530 ---- (setq nice-compilation-buffer (compile-internal cmd "No more errors")) + + (save-excursion + (set-buffer nice-compilation-buffer) + (set (make-local-variable 'compilation-finish-function) + 'nice-compilation-finish-function) + (set (make-local-variable 'compilation-exit-message-function) + 'nice-compilation-exit) + ) ;; Start process |
From: <bo...@us...> - 2003-12-14 09:43:10
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv15335/src/bossa/syntax Modified Files: NiceClass.java Log Message: Utility to get the NiceClass associated to a TC. Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** NiceClass.java 4 Dec 2003 13:34:28 -0000 1.74 --- NiceClass.java 13 Dec 2003 19:09:40 -0000 1.75 *************** *** 85,96 **** private static OverridenField[] noOverrides = new OverridenField[0]; ! NiceClass getParent() { ! TypeConstructor tc = definition.getSuperClass(); ! ClassDefinition sup = ClassDefinition.get(tc); ! if (sup != null && sup.implementation instanceof NiceClass) ! return ((NiceClass) sup.implementation); else return null; } --- 85,100 ---- private static OverridenField[] noOverrides = new OverridenField[0]; ! static NiceClass get(TypeConstructor tc) { ! ClassDefinition res = ClassDefinition.get(tc); ! if (res != null && res.implementation instanceof NiceClass) ! return ((NiceClass) res.implementation); else return null; + } + + NiceClass getParent() + { + return get(definition.getSuperClass()); } |
From: <bo...@us...> - 2003-12-14 09:42:45
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv11548/src/bossa/syntax Modified Files: CustomConstructor.java Log Message: Find the associated NiceClass, and perform analyse and typechecking (without support for 'this' call). Index: CustomConstructor.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CustomConstructor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CustomConstructor.java 13 Dec 2003 17:52:01 -0000 1.4 --- CustomConstructor.java 13 Dec 2003 18:59:00 -0000 1.5 *************** *** 44,49 **** void resolve() { ! classTC = Node.getGlobalTypeScope().globalLookup(className); ! TypeConstructors.addConstructor(classTC, this); } --- 44,70 ---- void resolve() { ! TypeConstructor tc = Node.getGlobalTypeScope().globalLookup(className); ! TypeConstructors.addConstructor(tc, this); ! classe = NiceClass.get(tc); ! ! // Save the scopes, since we need them later, but they get null'ed. ! thisScope = scope; ! thisTypeScope = typeScope; ! } ! ! private VarScope thisScope; ! private TypeScope thisTypeScope; ! ! void resolveBody() ! { ! body = bossa.syntax.dispatch.analyse ! (body, thisScope, thisTypeScope, false); ! } ! ! void innerTypecheck() throws TypingEx ! { ! super.innerTypecheck(); ! ! bossa.syntax.dispatch.typecheck(body); } *************** *** 71,76 **** LocatedString className; ! Block body; ! TypeConstructor classTC; NiceClass classe; } --- 92,96 ---- LocatedString className; ! Statement body; NiceClass classe; } |
From: <ar...@us...> - 2003-12-14 09:41:43
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1:/tmp/cvs-serv20832/F:/nice/src/gnu/expr Modified Files: ConstructorExp.java Log Message: Codegeneration part for custom constructors. Index: ConstructorExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/ConstructorExp.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ConstructorExp.java 27 Nov 2003 21:02:13 -0000 1.3 --- ConstructorExp.java 13 Dec 2003 17:52:01 -0000 1.4 *************** *** 29,32 **** --- 29,39 ---- this.classType = (ClassType) thisDecl.getType(); thisDecl.context = this; + this.primary = true; + } + + public ConstructorExp(ClassType classType) + { + this.classType = classType; + this.primary = false; } *************** *** 39,42 **** --- 46,50 ---- private ClassType classType; private Expression superCall; + private boolean primary; ClassType getClassType() { return classType; } *************** *** 68,84 **** void enterFunction (Compilation comp) { ! // The super call has to come before anything else. ! superCall.compile(comp, Target.Ignore); ! ! // Do the normal stuff. ! super.enterFunction(comp); ! ! // Save 'this' if it is captured ! if (thisDecl.field != null) { ! CodeAttr code = comp.getCode(); ! thisDecl.loadOwningObject(comp); ! code.emitPushThis(); ! code.emitPutField(thisDecl.field); } } --- 76,100 ---- void enterFunction (Compilation comp) { ! if (primary) { ! // The super call has to come before anything else. ! superCall.compile(comp, Target.Ignore); ! ! // Do the normal stuff. ! super.enterFunction(comp); ! ! // Save 'this' if it is captured ! if (thisDecl.field != null) ! { ! CodeAttr code = comp.getCode(); ! thisDecl.loadOwningObject(comp); ! code.emitPushThis(); ! code.emitPutField(thisDecl.field); ! } ! } ! else ! { ! // nothing special to do for custom constructors. ! super.enterFunction(comp); } } |
From: <ar...@us...> - 2003-12-14 09:41:41
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv20832/F:/nice/src/bossa/syntax Modified Files: CustomConstructor.java Log Message: Codegeneration part for custom constructors. Index: CustomConstructor.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CustomConstructor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CustomConstructor.java 13 Dec 2003 14:54:08 -0000 1.3 --- CustomConstructor.java 13 Dec 2003 17:52:01 -0000 1.4 *************** *** 16,19 **** --- 16,22 ---- import java.util.*; import mlsub.typing.*; + import gnu.expr.*; + import gnu.bytecode.ClassType; + import nice.tools.code.Gen; /** *************** *** 52,56 **** protected gnu.expr.Expression computeCode() { ! return gnu.expr.QuoteExp.nullExp; } --- 55,71 ---- protected gnu.expr.Expression computeCode() { ! if (classe.definition.inInterfaceFile()) ! { ! return new QuoteExp(classe.getClassExp().getClassType().getDeclaredMethod ! ("<init>", javaArgTypes())); ! } ! ! ConstructorExp lambda = Gen.createCustomConstructor ! ((ClassType) javaReturnType(), javaArgTypes(), parameters.getMonoSymbols()); ! ! Gen.setMethodBody(lambda, body.generateCode()); ! classe.getClassExp().addMethod(lambda); ! ! return lambda; } *************** *** 58,60 **** --- 73,76 ---- Block body; TypeConstructor classTC; + NiceClass classe; } |
From: <bo...@us...> - 2003-12-14 09:40:29
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv2322/src/bossa/syntax Modified Files: AST.java Log Message: Added array of method implementations. Index: AST.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/AST.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** AST.java 13 Dec 2003 16:10:07 -0000 1.54 --- AST.java 13 Dec 2003 16:53:04 -0000 1.55 *************** *** 49,52 **** --- 49,53 ---- ArrayList globals = new ArrayList(10); ArrayList customConstructors = new ArrayList(10); + ArrayList methodImplementations = new ArrayList(10); for(Iterator i = children.iterator(); i.hasNext();) *************** *** 62,65 **** --- 63,68 ---- else if (node instanceof MethodDeclaration) methods.add(node); + else if (node instanceof MethodBodyDefinition) + methodImplementations.add(node); else if (node instanceof EnumDefinition) classes.add(((EnumDefinition)node).classDef); *************** *** 81,84 **** --- 84,90 ---- this.customConstructors = (CustomConstructor[]) customConstructors.toArray(new CustomConstructor[customConstructors.size()]); + + this.methodImplementations = (MethodBodyDefinition[]) + methodImplementations.toArray(new MethodBodyDefinition[methodImplementations.size()]); } *************** *** 123,136 **** Node.setModule(module); ! for(Iterator i = children.iterator(); i.hasNext();) ! { ! Object o = i.next(); ! if (o instanceof MethodBodyDefinition) ! try{ ! ((MethodBodyDefinition) o).lateBuildScope(); ! } ! catch(UserError ex){ ! module.compilation().error(ex); ! } } --- 129,138 ---- Node.setModule(module); ! for (int i = 0; i < methodImplementations.length; i++) ! try{ ! methodImplementations[i].lateBuildScope(); ! } ! catch(UserError ex){ ! module.compilation().error(ex); } *************** *** 230,233 **** --- 232,236 ---- private ClassDefinition[] classes; private MethodDeclaration[] methods; + private MethodBodyDefinition[] methodImplementations; private GlobalVarDeclaration[] globals; private CustomConstructor[] customConstructors; |
From: <bo...@us...> - 2003-12-14 08:42:03
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes/constructors In directory sc8-pr-cvs1:/tmp/cvs-serv7901/testsuite/compiler/classes/constructors Modified Files: custom.testsuite Log Message: Make custom constructors available for calls. Index: custom.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/constructors/custom.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** custom.testsuite 4 Dec 2003 16:19:57 -0000 1.1 --- custom.testsuite 13 Dec 2003 14:54:08 -0000 1.2 *************** *** 1,2 **** --- 1,13 ---- + /// Global + class Point { double x; double y; } + + /// PASS bug + /// Toplevel + /* Use the custom constructor before its declaration. */ + let Point origin = new Point(angle: 0, distance: 0); + + new Point(double angle, double distance) + { this(x: distance * cos(angle), y: distance * sin(angle)); } + /// PASS bug var p = new Point(angle: 0, distance: 1); *************** *** 7,12 **** /// Toplevel - class Point { double x; double y; } - new Point(double angle, double distance) { this(x: distance * cos(angle), y: distance * sin(angle)); } --- 18,21 ---- |
From: <bo...@us...> - 2003-12-14 08:42:03
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv7901/src/bossa/syntax Modified Files: UserOperator.java CustomConstructor.java AST.java Log Message: Make custom constructors available for calls. Index: UserOperator.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/UserOperator.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** UserOperator.java 28 Nov 2003 13:52:08 -0000 1.6 --- UserOperator.java 13 Dec 2003 14:54:08 -0000 1.7 *************** *** 43,48 **** --- 43,54 ---- ****************************************************************/ + private boolean resolved = false; + void doResolve() { + if (resolved) + return; + resolved = true; + // the type must be found before removeChild(getSymbol()); Index: CustomConstructor.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CustomConstructor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CustomConstructor.java 13 Dec 2003 13:31:42 -0000 1.2 --- CustomConstructor.java 13 Dec 2003 14:54:08 -0000 1.3 *************** *** 39,42 **** --- 39,48 ---- } + void resolve() + { + classTC = Node.getGlobalTypeScope().globalLookup(className); + TypeConstructors.addConstructor(classTC, this); + } + public void printInterface(java.io.PrintWriter s) { *************** *** 46,54 **** protected gnu.expr.Expression computeCode() { ! return null; } LocatedString className; Block body; ! } --- 52,60 ---- protected gnu.expr.Expression computeCode() { ! return gnu.expr.QuoteExp.nullExp; } LocatedString className; Block body; ! TypeConstructor classTC; } Index: AST.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/AST.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** AST.java 28 Nov 2003 13:52:08 -0000 1.52 --- AST.java 13 Dec 2003 14:54:08 -0000 1.53 *************** *** 48,51 **** --- 48,52 ---- ArrayList methods = new ArrayList(children.size()); ArrayList globals = new ArrayList(10); + ArrayList customConstructors = new ArrayList(10); for(Iterator i = children.iterator(); i.hasNext();) *************** *** 54,57 **** --- 55,63 ---- if (node instanceof ClassDefinition) classes.add(node); + else if (node instanceof CustomConstructor) + { + customConstructors.add(node); + methods.add(node); + } else if (node instanceof MethodDeclaration) methods.add(node); *************** *** 72,75 **** --- 78,84 ---- this.globals = (GlobalVarDeclaration[]) globals.toArray(new GlobalVarDeclaration[globals.size()]); + + this.customConstructors = (CustomConstructor[]) + customConstructors.toArray(new CustomConstructor[customConstructors.size()]); } *************** *** 97,100 **** --- 106,113 ---- resolve(classes[i]); + // Custom constructors depend classes, and code can depend on them + for(int i = 0; i < customConstructors.length; i++) + resolve(customConstructors[i]); + for(Iterator i = children.iterator();i.hasNext();) { *************** *** 219,222 **** --- 232,236 ---- private MethodDeclaration[] methods; private GlobalVarDeclaration[] globals; + private CustomConstructor[] customConstructors; } |
From: <bo...@us...> - 2003-12-14 08:42:02
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv7494/src/bossa/syntax Modified Files: GlobalTypeScope.java Log Message: Allow lookups directly on LocatedStrings. Index: GlobalTypeScope.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/GlobalTypeScope.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GlobalTypeScope.java 3 Dec 2003 21:50:41 -0000 1.7 --- GlobalTypeScope.java 13 Dec 2003 14:51:48 -0000 1.8 *************** *** 46,49 **** --- 46,54 ---- } + public TypeConstructor globalLookup(LocatedString name) + { + return globalLookup(name.toString(), name.location()); + } + public TypeConstructor globalLookup(String name, Location loc) { |
From: <ar...@us...> - 2003-12-14 08:41:21
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv30185/F:/nice/stdlib/nice/lang Modified Files: java.nice Log Message: Few retypings for parametric classes. Index: java.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/java.nice,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** java.nice 28 Nov 2003 18:02:52 -0000 1.46 --- java.nice 13 Dec 2003 22:46:55 -0000 1.47 *************** *** 179,182 **** --- 179,186 ---- <K,V> HashMap<K,V> HashMap(int,float) = native new HashMap(int,float); <K,K0,V,V0 | K0 <: K, V0 <: V> HashMap<K,V> HashMap(Map<K0,V0>) = native new HashMap(Map); + <K,V> WeakHashMap<K,V> WeakHashMap() = native new WeakHashMap(); + <K,V> WeakHashMap<K,V> WeakHashMap(int) = native new WeakHashMap(int); + <K,V> WeakHashMap<K,V> WeakHashMap(int,float) = native new WeakHashMap(int,float); + <K,K0,V,V0 | K0 <: K, V0 <: V> WeakHashMap<K,V> WeakHashMap(Map<K0,V0>) = native new WeakHashMap(Map); <K,V> IdentityHashMap<K,V> IdentityHashMap() = native new IdentityHashMap(); <K,V> IdentityHashMap<K,V> IdentityHashMap(int) = native new IdentityHashMap(int); *************** *** 229,233 **** class TreeSet<T> extends AbstractSet<T> implements SortedSet<T> = native java.util.TreeSet; class Vector<T> extends AbstractList<T> = native java.util.Vector; - class WeakHashMap<K,V> extends AbstractMap<K,V> = native java.util.WeakHashMap; <T> Iterator<T> iterator(Collection<T>) = --- 233,236 ---- *************** *** 345,348 **** --- 348,363 ---- <T> List<T> asList(T[]) = native List Arrays.asList(Object[]); + // Properties + class Properties<String K, String V> extends Hashtable<K,V> = native java.util.Properties; + Properties<String, String> Properties() = native new Properties(); + Properties<String, String> Properties(Properties<String, String>) = native new Properties(Properties); + ?String getProperty(Properties<String, String>, String) = native String Properties.getProperty(String); + <T | T <: ?String> T getProperty(Properties<String, String>, String, T) = native String Properties.getProperty(String, String); + void list(Properties<String, String>, PrintStream) = native void Properties.list(PrintStream); + void list(Properties<String, String>, PrintWriter) = native void Properties.list(PrintWriter); + void load(Properties<String, String>, InputStream) = native void Properties.load(InputStream); + ?String setProperty(Properties<String, String>, String, String) = native Object Properties.setProperty(String, String); + void store(Properties<String, String>, OutputStream, String) = native void Properties.store(OutputStream, String); + /* StringTokenizer inherits from Enumeration, which makes it wrongly parameterized. We ignore that inheritance. *************** *** 366,369 **** --- 381,385 ---- <T,U | T <: U > SoftReference<T> SoftReference(T, ReferenceQueue<U>) = native new SoftReference(Object, ReferenceQueue); <T,U | T <: U > PhantomReference<T> PhantomReference(T, ReferenceQueue<U>) = native new PhantomReference(Object, ReferenceQueue); + <T> ReferenceQueue<T> ReferenceQueue() = native new ReferenceQueue(); <T> void clear(Reference<T>) = native void Reference.clear(); |
From: <ar...@us...> - 2003-12-14 08:40:42
|
Update of /cvsroot/nice/Nice/src/nice/tools/code In directory sc8-pr-cvs1:/tmp/cvs-serv20832/F:/nice/src/nice/tools/code Modified Files: Gen.java Log Message: Codegeneration part for custom constructors. Index: Gen.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/Gen.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Gen.java 27 Nov 2003 21:02:13 -0000 1.17 --- Gen.java 13 Dec 2003 17:52:01 -0000 1.18 *************** *** 141,144 **** --- 141,153 ---- } + public static ConstructorExp createCustomConstructor + (ClassType classType, Type[] argTypes, MonoSymbol[] args) + { + ConstructorExp res = new ConstructorExp(classType); + createMethod(res, "<init>", argTypes, Type.void_type, args, + true, false, true); + return res; + } + /** Create a lambda expression to generate code for the method. |
From: <ar...@us...> - 2003-12-13 14:06:04
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv32394/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Cleaned up block call implementation a bit. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.224 retrieving revision 1.225 diff -C2 -d -r1.224 -r1.225 *** Parser.jj 12 Dec 2003 20:34:46 -0000 1.224 --- Parser.jj 13 Dec 2003 14:06:00 -0000 1.225 *************** *** 2471,2474 **** --- 2471,2487 ---- } + void PostfixBlocks(Expression exp) : + { LocatedString name; Statement block; } + { + ( + block=Block() + { if ( exp instanceof CallExp && ((CallExp)exp).hasBrackets && ! (exp instanceof NewExp) ) + ((CallExp)exp).addBlockArgument(block, null); + else + throw bossa.util.User.error(exp,"Block arguments can only be added to normal function calls"); + } + ) + } + Statement RealStatementExpression() : { Expression e1; Token first, last; Statement block; } *************** *** 2480,2489 **** e1=PrimaryExpression() ( ! block=Block() ! { if ( e1 instanceof CallExp && ! (e1 instanceof NewExp) ) ! ((CallExp)e1).addBlockArgument(block, null); ! else ! throw bossa.util.User.error(e1,"Block arguments can only be added to normal function calls"); ! } | e1=PostfixStatementExpression(e1, first) ";" --- 2493,2497 ---- e1=PrimaryExpression() ( ! PostfixBlocks(e1) | e1=PostfixStatementExpression(e1, first) ";" *************** *** 2506,2515 **** e1=PrimaryExpression() ( ! block=Block() ! { if ( e1 instanceof CallExp && ! (e1 instanceof NewExp) ) ! ((CallExp)e1).addBlockArgument(block, null); ! else ! throw bossa.util.User.error(e1,"Block arguments can only be added to normal function calls"); ! } | e1=PostfixStatementExpression(e1, first) --- 2514,2518 ---- e1=PrimaryExpression() ( ! PostfixBlocks(e1) | e1=PostfixStatementExpression(e1, first) |
From: <ar...@us...> - 2003-12-13 14:06:04
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv32394/F:/nice/src/bossa/syntax Modified Files: CallExp.java Log Message: Cleaned up block call implementation a bit. Index: CallExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CallExp.java,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** CallExp.java 12 Dec 2003 20:34:46 -0000 1.86 --- CallExp.java 13 Dec 2003 14:06:00 -0000 1.87 *************** *** 400,404 **** /** true iff this call was made using brackets (i.e. not like 'x.f'). */ ! final boolean hasBrackets; /** Class this static method is defined in, or null */ --- 400,404 ---- /** true iff this call was made using brackets (i.e. not like 'x.f'). */ ! public final boolean hasBrackets; /** Class this static method is defined in, or null */ |
From: <bo...@us...> - 2003-12-13 13:31:46
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv27215/src/bossa/syntax Modified Files: CustomConstructor.java Log Message: Temporary fix for the return type of a custom constructor. Index: CustomConstructor.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CustomConstructor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CustomConstructor.java 12 Dec 2003 14:55:01 -0000 1.1 --- CustomConstructor.java 13 Dec 2003 13:31:42 -0000 1.2 *************** *** 26,35 **** { super(new LocatedString("<init>", className.location()), Constraint.True, ! new TypeIdent(className), params, Contract.noContract); ! this.className = className; ! this.body = body; ! User.error("custom constructors are not implemented yet"); } --- 26,40 ---- { super(new LocatedString("<init>", className.location()), Constraint.True, ! returnType(className), params, Contract.noContract); ! this.className = className; ! this.body = body; ! } ! private static Monotype returnType(LocatedString className) ! { ! Monotype res = new TypeIdent(className); ! res.nullness = Monotype.sure; ! return res; } |
From: <ar...@us...> - 2003-12-12 23:20:42
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv4603/F:/nice/src/bossa/syntax Modified Files: analyse.nice Log Message: Small refactoring. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** analyse.nice 12 Dec 2003 22:08:33 -0000 1.96 --- analyse.nice 12 Dec 2003 23:20:39 -0000 1.97 *************** *** 444,479 **** if (sym != null) { ! if (e.alwaysOverloadedSymbol) ! { ! if (sym instanceof MonoSymbol) ! { ! sym.used = true; ! ! if (sym instanceof Block.LocalVariable.Symbol) ! checkInitialized(sym, info, e.location()); ! } ! ! return new OverloadedSymbolExp(sym, e.ident); ! } ! else { ! if (sym instanceof MonoSymbol) ! { ! sym.used = true; ! ! if (assigned && sym.depth < info.anonFunDepth) ! sym.captured = true; ! if (sym instanceof Block.LocalVariable.Symbol) ! { ! if (assigned) ! setInitialized(sym, info, e.location()); ! else ! checkInitialized(sym, info, e.location()); ! } ! } ! return new SymbolExp(sym, e.location()); } } } --- 444,467 ---- if (sym != null) { ! if (sym instanceof MonoSymbol) { ! sym.used = true; ! if (assigned && sym.depth < info.anonFunDepth) ! sym.captured = true; ! if (sym instanceof Block.LocalVariable.Symbol) ! { ! if (assigned) ! setInitialized(sym, info, e.location()); ! else ! checkInitialized(sym, info, e.location()); ! } } + + if (e.alwaysOverloadedSymbol) + return new OverloadedSymbolExp(sym, e.ident); + else + return new SymbolExp(sym, e.location()); } } |
From: <ar...@us...> - 2003-12-12 22:08:36
|
Update of /cvsroot/nice/Nice/testsuite/compiler/statements/flow In directory sc8-pr-cvs1:/tmp/cvs-serv22997/F:/nice/testsuite/compiler/statements/flow Modified Files: initialization.testsuite Log Message: Fixed checking of local variables in a call position. Index: initialization.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/statements/flow/initialization.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** initialization.testsuite 28 Jul 2003 18:06:19 -0000 1.1 --- initialization.testsuite 12 Dec 2003 22:08:33 -0000 1.2 *************** *** 5,6 **** --- 5,10 ---- } while (false); int j = i; + + /// FAIL + ()->void f; + /* ///FAIL HERE */f(); |
From: <ar...@us...> - 2003-12-12 22:08:36
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv22997/F:/nice/src/bossa/syntax Modified Files: analyse.nice Log Message: Fixed checking of local variables in a call position. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** analyse.nice 12 Dec 2003 12:55:25 -0000 1.95 --- analyse.nice 12 Dec 2003 22:08:33 -0000 1.96 *************** *** 446,449 **** --- 446,457 ---- if (e.alwaysOverloadedSymbol) { + if (sym instanceof MonoSymbol) + { + sym.used = true; + + if (sym instanceof Block.LocalVariable.Symbol) + checkInitialized(sym, info, e.location()); + } + return new OverloadedSymbolExp(sym, e.ident); } |
From: <ar...@us...> - 2003-12-12 20:34:51
|
Update of /cvsroot/nice/Nice/testsuite/compiler/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv5547/F:/nice/testsuite/compiler/syntax Added Files: blockcall.testsuite Log Message: Added syntactic sugar for method calls with closures(single block only yet) like: loop(5) { print("abc"); } --- NEW FILE: blockcall.testsuite --- /// PASS int i = 0; loop(5) { i += 1; } assert i==5; /// Toplevel void loop(int n, ()->void block) { for(; n>0; n--) block(); } /// FAIL int x; /* ///FAIL HERE */(x = 0) { print("abc"); } |
From: <ar...@us...> - 2003-12-12 20:34:51
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv5547/F:/nice/src/bossa/syntax Modified Files: CallExp.java Arguments.java Log Message: Added syntactic sugar for method calls with closures(single block only yet) like: loop(5) { print("abc"); } Index: CallExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CallExp.java,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** CallExp.java 28 Nov 2003 13:52:08 -0000 1.85 --- CallExp.java 12 Dec 2003 20:34:46 -0000 1.86 *************** *** 92,95 **** --- 92,101 ---- } + public void addBlockArgument(Statement block, LocatedString name) + { + arguments.add(new FunExp(bossa.syntax.Constraint.True, new LinkedList(), + block), name); + } + /**************************************************************** * Type checking Index: Arguments.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Arguments.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Arguments.java 9 Dec 2003 15:21:05 -0000 1.22 --- Arguments.java 12 Dec 2003 20:34:46 -0000 1.23 *************** *** 70,78 **** } ! void add(Expression arg) { Argument[] newArgs = new Argument[arguments.length + 1]; System.arraycopy(arguments, 0, newArgs, 0, arguments.length); ! newArgs[arguments.length] = new Argument(arg); arguments = newArgs; } --- 70,78 ---- } ! void add(Expression arg, LocatedString name) { Argument[] newArgs = new Argument[arguments.length + 1]; System.arraycopy(arguments, 0, newArgs, 0, arguments.length); ! newArgs[arguments.length] = new Argument(arg, name); arguments = newArgs; } |
From: <ar...@us...> - 2003-12-12 20:34:49
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv5547/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Added syntactic sugar for method calls with closures(single block only yet) like: loop(5) { print("abc"); } Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.223 retrieving revision 1.224 diff -C2 -d -r1.223 -r1.224 *** Parser.jj 12 Dec 2003 14:55:01 -0000 1.223 --- Parser.jj 12 Dec 2003 20:34:46 -0000 1.224 *************** *** 1744,1748 **** { ( res = RootShortStatement() ! | res = StatementExpression() ) { return res; } --- 1744,1748 ---- { ( res = RootShortStatement() ! | res = ShortStatementExpression() ) { return res; } *************** *** 2268,2272 **** res=LabeledStatement() | res=Block() ! | res=StatementExpression() ";" | res=IfStatement() | res=WhileStatement() --- 2268,2272 ---- res=LabeledStatement() | res=Block() ! | res=RealStatementExpression() | res=IfStatement() | res=WhileStatement() *************** *** 2471,2481 **** } ! Statement StatementExpression() : ! /* ! * The last expansion of this production accepts more than the legal ! * Java expansions for StatementExpression. This expansion does not ! * use PostfixExpression for performance reasons. ! */ ! { Expression e1; Token first, last; } { { first = getToken(1); } --- 2471,2502 ---- } ! Statement RealStatementExpression() : ! { Expression e1; Token first, last; Statement block; } ! { ! { first = getToken(1); } ! ( ! e1=Pre_crementExpression() ";" ! | ! e1=PrimaryExpression() ! ( ! block=Block() ! { if ( e1 instanceof CallExp && ! (e1 instanceof NewExp) ) ! ((CallExp)e1).addBlockArgument(block, null); ! else ! throw bossa.util.User.error(e1,"Block arguments can only be added to normal function calls"); ! } ! | ! e1=PostfixStatementExpression(e1, first) ";" ! ) ! ) ! { ! last = getToken(0); ! e1.setLocation(Location.make(first, last)); ! return new ExpressionStmt(e1); ! } ! } ! ! Statement ShortStatementExpression() : ! { Expression e1; Token first, last; Statement block; } { { first = getToken(1); } *************** *** 2484,2487 **** --- 2505,2530 ---- | e1=PrimaryExpression() + ( + block=Block() + { if ( e1 instanceof CallExp && ! (e1 instanceof NewExp) ) + ((CallExp)e1).addBlockArgument(block, null); + else + throw bossa.util.User.error(e1,"Block arguments can only be added to normal function calls"); + } + | + e1=PostfixStatementExpression(e1, first) + ) + ) + { + last = getToken(0); + e1.setLocation(Location.make(first, last)); + return new ExpressionStmt(e1); + } + + } + + Expression PostfixStatementExpression(Expression e1, Token first) : + {} + { [ "++" { e1=new IncrementExp(e1, false, true); } *************** *** 2497,2510 **** if(op.image.length()!=1) e2=CallExp.create(symb(op.image.substring(0, 1),op),e1,e2); ! e1=AssignExp.create(e1,e2); } ] ! ) ! { ! last = getToken(0); ! e1.setLocation(Location.make(first, last)); ! return new ExpressionStmt(e1); ! } } --- 2540,2548 ---- if(op.image.length()!=1) e2=CallExp.create(symb(op.image.substring(0, 1),op),e1,e2); ! e1=AssignExp.create(e1,e2); } ] ! { return e1; } } *************** *** 2573,2577 **** LOOKAHEAD( "var" | "let" | monotype() <IDENT>) init=LocalDeclarationList() ! | statexp=StatementExpression() ";" {init.add(statexp);} | ";" ) --- 2611,2615 ---- LOOKAHEAD( "var" | "let" | monotype() <IDENT>) init=LocalDeclarationList() ! | statexp=ShortStatementExpression() ";" {init.add(statexp);} | ";" ) *************** *** 2614,2619 **** { Statement s; List statements=new LinkedList(); } { ! s=StatementExpression() { statements.add(s); } ! ( "," s=StatementExpression() { statements.add(s); } )* { return new Block(statements); } --- 2652,2657 ---- { Statement s; List statements=new LinkedList(); } { ! s=ShortStatementExpression() { statements.add(s); } ! ( "," s=ShortStatementExpression() { statements.add(s); } )* { return new Block(statements); } |
From: <bo...@us...> - 2003-12-12 20:03:24
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv18064/src/bossa/syntax Modified Files: SuperExp.java Log Message: Correct typing of super when the parent implementation is not known. Index: SuperExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/SuperExp.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** SuperExp.java 12 Dec 2003 14:53:30 -0000 1.14 --- SuperExp.java 12 Dec 2003 18:51:31 -0000 1.15 *************** *** 142,152 **** monotype.domain()); else ! { ! // Our safe bet is to assert that the argument is Object. ! Monotype[] domain = (Monotype[]) monotype.domain().clone(); ! domain[0] = bossa.syntax.Monotype.sure(TopMonotype.instance); ! monotype = new FunType(domain, monotype.codomain()); ! constraint = type.getConstraint(); ! } } } --- 142,150 ---- monotype.domain()); else ! // Our safe bet is to assert that the argument is Object. ! constraint = addLeqFirstArg ! (type.getConstraint(), ! bossa.syntax.Monotype.sure(TopMonotype.instance), ! monotype.domain()); } } *************** *** 178,181 **** --- 176,197 ---- AtomicConstraint[] atoms = (AtomicConstraint[]) newAtoms.toArray(new AtomicConstraint[newAtoms.size()]); + + return new Constraint(c.binders(), atoms); + } + + private static Constraint addLeqFirstArg(Constraint c, Monotype first, + Monotype[] m) + { + AtomicConstraint[] oldAtoms = c.atoms(); + + AtomicConstraint[] atoms; + if (oldAtoms == null) + atoms = new AtomicConstraint[1]; + else + { + atoms = new AtomicConstraint[oldAtoms.length + 1]; + System.arraycopy(oldAtoms, 0, atoms, 1, oldAtoms.length); + } + atoms[0] = new mlsub.typing.MonotypeLeqCst(first, m[0]); return new Constraint(c.binders(), atoms); |
From: <bo...@us...> - 2003-12-12 19:24:56
|
Update of /cvsroot/nice/Nice/src/mlsub/typing/lowlevel In directory sc8-pr-cvs1:/tmp/cvs-serv24923/src/mlsub/typing/lowlevel Modified Files: Engine.java Log Message: Make sure that type variables that have been deconstructed are correctly recognized as rigid. Index: Engine.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/lowlevel/Engine.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Engine.java 3 Dec 2003 21:50:41 -0000 1.27 --- Engine.java 12 Dec 2003 19:24:53 -0000 1.28 *************** *** 42,45 **** --- 42,46 ---- if(dbg) Debug.println("Enter"); floating.mark(); + soft.mark(); frozenLeqs.mark(); for(Iterator i = constraints.iterator(); *************** *** 133,136 **** --- 134,138 ---- } floating.backtrack(); + soft.backtrack(); for(Iterator i = floating.iterator();i.hasNext();) ((Element)i.next()).setKind(null); *************** *** 280,284 **** else { ! e.setId(FLOATING); // for debugging purposes floating.add(e); } --- 282,286 ---- else { ! e.setId(FLOATING); floating.add(e); } *************** *** 286,289 **** --- 288,292 ---- private static final int FLOATING = -3; + private static final int RIGID = -4; public static boolean isRigid(Element e) *************** *** 432,435 **** --- 435,440 ---- floating.remove(e); + if (e.getId() == FLOATING) + soft.add(e); // Propagates the kind to all comparable elements *************** *** 529,532 **** --- 534,549 ---- { try{ + for (Iterator i = soft.iterator(); i.hasNext();) + { + Element e = (Element) i.next(); + e.setId(RIGID); + } + } + finally{ + soft.endOfIteration(); + } + soft.clear(); + + try { for(Iterator i = floating.iterator(); i.hasNext();) *************** *** 536,540 **** // useful for nullness head on monotype vars if (e.getKind() != null) ! continue; if(dbg) Debug.println("Registering variable "+e); --- 553,557 ---- // useful for nullness head on monotype vars if (e.getKind() != null) ! continue; if(dbg) Debug.println("Registering variable "+e); *************** *** 599,602 **** --- 616,622 ---- /** The elements that have not yet been added to a Kind */ private static final BackableList floating = new BackableList(); + + /** The elements that have not yet been rigidified. */ + private static final BackableList soft = new BackableList(); /** The constraint of monotype variables */ |
From: <bo...@us...> - 2003-12-12 19:24:56
|
Update of /cvsroot/nice/Nice/testsuite/compiler/typing In directory sc8-pr-cvs1:/tmp/cvs-serv24923/testsuite/compiler/typing Modified Files: object.testsuite Log Message: Make sure that type variables that have been deconstructed are correctly recognized as rigid. Index: object.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/object.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** object.testsuite 11 Dec 2003 23:41:55 -0000 1.3 --- object.testsuite 12 Dec 2003 19:24:53 -0000 1.4 *************** *** 72,73 **** --- 72,80 ---- ?Object[] o1 = new Object[1]; Object[] o0 = new Object[0]; + + /// FAIL + String s = foo(""); + /// Toplevel + let Object o = 2; + <T> T foo(T x) = x; + foo(#String s) = /*/// FAIL HERE*/ o; |
From: <ar...@us...> - 2003-12-12 17:33:51
|
Update of /cvsroot/nice/swing/src/nice/ui/common In directory sc8-pr-cvs1:/tmp/cvs-serv2904/D:/nice/nice/ui/common Modified Files: common.nice Log Message: Make niceswing compile again. Index: common.nice =================================================================== RCS file: /cvsroot/nice/swing/src/nice/ui/common/common.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** common.nice 20 Mar 2003 15:21:26 -0000 1.4 --- common.nice 12 Dec 2003 17:33:48 -0000 1.5 *************** *** 93,97 **** list = new LinkedList(); notNull(list).add(listener); ! map.put(key.object(),list); } } --- 93,97 ---- list = new LinkedList(); notNull(list).add(listener); ! map.put(key,list); } } *************** *** 116,120 **** list = new LinkedList(); notNull(list).add(listener); ! map.put((this.object(),key),list); } } --- 116,120 ---- list = new LinkedList(); notNull(list).add(listener); ! map.put((this,key),list); } } |