nice-commit Mailing List for The Nice Programming Language (Page 22)
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: Daniel B. <bo...@us...> - 2005-02-08 13:01:39
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30795/web Modified Files: manual.xml Log Message: Cleanups. Index: manual.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xml,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** manual.xml 28 Dec 2004 16:48:49 -0000 1.44 --- manual.xml 8 Feb 2005 13:01:25 -0000 1.45 *************** *** 780,786 **** <programlisting lang="nice"><![CDATA[ String digitToString(int digit, String language) ! requires digit < 10 && digit >= 0; ! digitToString(digit, language) { throw new Exception("Couldn't convert " + digit + " to language " + language); } digitToString(1, "english") = "one"; --- 780,789 ---- <programlisting lang="nice"><![CDATA[ String digitToString(int digit, String language) ! requires 0 <= digit < 10; ! digitToString(digit, language) ! { ! throw new Exception("Couldn't convert "digit" to language "language); ! } digitToString(1, "english") = "one"; *************** *** 825,834 **** let Person BOB = new Person(); ! void greet(Person p) { println("Hello, anonymous person!"); } ! greet(BOB) { println("Hi Bob!"); --- 828,837 ---- let Person BOB = new Person(); ! void greet(Person p) { println("Hello, anonymous person!"); } ! greet(BOB) { println("Hi Bob!"); |
From: Francis B. <fb...@us...> - 2005-02-08 10:42:00
|
Update of /cvsroot/nice/Nice/src/nice/tools/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6026/src/nice/tools/doc Modified Files: main.nice Log Message: Move compilation variable to be a global var (allows to work out if we are compiling a given package later on). Index: main.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/doc/main.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** main.nice 10 Oct 2004 12:38:57 -0000 1.8 --- main.nice 8 Feb 2005 10:41:39 -0000 1.9 *************** *** 12,15 **** --- 12,21 ---- import bossa.modules.*; + /** + * Compilation object allows us to dynamically find out what we are compiling. + * It is initialised by the main method. + */ + var Compilation compilation = cast(null); + void main(String[] args) { *************** *** 18,22 **** ConsoleOutput consOutput = new ConsoleOutput(); ! Compilation compilation = new Compilation (listener: consOutput, parser: new bossa.parser.JavaccParser(true)); --- 24,28 ---- ConsoleOutput consOutput = new ConsoleOutput(); ! compilation = new Compilation (listener: consOutput, parser: new bossa.parser.JavaccParser(true)); *************** *** 78,79 **** --- 84,86 ---- generate(compilation, mainPackage, outdir); } + |
From: Daniel B. <bo...@us...> - 2005-02-07 17:38:04
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5277 Modified Files: Makefile Log Message: Avoid non-POSIX option of cp (-a). Index: Makefile =================================================================== RCS file: /cvsroot/nice/Nice/Makefile,v retrieving revision 1.156 retrieving revision 1.157 diff -C2 -d -r1.156 -r1.157 *** Makefile 4 Jan 2005 18:20:55 -0000 1.156 --- Makefile 7 Feb 2005 17:37:54 -0000 1.157 *************** *** 167,171 **** src/nice/tools/{code/*.java,util/JDK.java} $(JAVAC_GENERIC) -d classes-inline stdlib/nice/lang/inline/*.java ! cp -a classes-inline/* classes # We put code used by inline methods inside classes-inline so that it is # used when running the inline methods, not the versions in the running --- 167,171 ---- src/nice/tools/{code/*.java,util/JDK.java} $(JAVAC_GENERIC) -d classes-inline stdlib/nice/lang/inline/*.java ! cp -R -p classes-inline/* classes # We put code used by inline methods inside classes-inline so that it is # used when running the inline methods, not the versions in the running |
From: Daniel B. <bo...@us...> - 2005-02-07 17:07:05
|
Update of /cvsroot/nice/Nice/src/gnu/bytecode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30750/src/gnu/bytecode Modified Files: TryState.java CodeAttr.java Log Message: Properly execute finally clauses when breaking out of a loop (fixes #1090881). Index: CodeAttr.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/CodeAttr.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** CodeAttr.java 15 Apr 2004 10:03:21 -0000 1.24 --- CodeAttr.java 7 Feb 2005 17:06:54 -0000 1.25 *************** *** 68,71 **** --- 68,73 ---- TryState try_stack; + public final TryState getTryStack() { return try_stack; } + public final Method getMethod() { return (Method) getContainer(); } Index: TryState.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/TryState.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** TryState.java 7 Sep 2000 17:55:11 -0000 1.1.1.1 --- TryState.java 7 Feb 2005 17:06:54 -0000 1.2 *************** *** 9,13 **** public class TryState { /** The surrounding TryState, if any. */ ! TryState previous; /** The label for the code following the entire try-statement. */ --- 9,13 ---- public class TryState { /** The surrounding TryState, if any. */ ! public final TryState previous; /** The label for the code following the entire try-statement. */ *************** *** 15,19 **** /** If this "try" has a "finally", the Label of the "finally" sub-routine. */ ! Label finally_subr; /** Used for the return address of the finally subroutine (if any). */ --- 15,19 ---- /** If this "try" has a "finally", the Label of the "finally" sub-routine. */ ! public Label finally_subr; /** Used for the return address of the finally subroutine (if any). */ |
From: Daniel B. <bo...@us...> - 2005-02-07 17:07:05
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30750/src/gnu/expr Modified Files: ExitExp.java BlockExp.java Log Message: Properly execute finally clauses when breaking out of a loop (fixes #1090881). Index: ExitExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/ExitExp.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExitExp.java 30 Oct 2001 15:16:50 -0000 1.2 --- ExitExp.java 7 Feb 2005 17:06:53 -0000 1.3 *************** *** 33,37 **** Expression res = result == null ? QuoteExp.voidExp : result; res.compileWithPosition(comp, block.subTarget); ! code.emitGoto(block.exitLabel); } --- 33,37 ---- Expression res = result == null ? QuoteExp.voidExp : result; res.compileWithPosition(comp, block.subTarget); ! block.exit(code); } Index: BlockExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/BlockExp.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BlockExp.java 28 Jan 2002 20:36:54 -0000 1.4 --- BlockExp.java 7 Feb 2005 17:06:53 -0000 1.5 *************** *** 59,63 **** --- 59,66 ---- exitLabel = new Label(code); this.subTarget = exitBody == null ? subTarget : Target.Ignore; + + initialTryState = code.getTryStack(); body.compileWithPosition(comp, subTarget); + if (exitBody != null) { *************** *** 74,77 **** --- 77,96 ---- } + // The try state in place at the beginning of the block + TryState initialTryState; + + void exit(CodeAttr code) + { + // Run enclosing finally clauses + for (TryState st = code.getTryStack(); st != initialTryState; + st = st.previous) + { + if (st.finally_subr != null) + code.emitJsr(st.finally_subr); + } + + code.emitGoto(exitLabel); + } + protected Expression walk (ExpWalker walker) { |
From: Daniel B. <bo...@us...> - 2005-02-07 17:07:02
|
Update of /cvsroot/nice/Nice/testsuite/compiler/statements/loops In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30750/testsuite/compiler/statements/loops Modified Files: break.testsuite Log Message: Properly execute finally clauses when breaking out of a loop (fixes #1090881). Index: break.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/statements/loops/break.testsuite,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** break.testsuite 17 Jan 2005 18:26:13 -0000 1.6 --- break.testsuite 7 Feb 2005 17:06:52 -0000 1.7 *************** *** 43,47 **** continue /*/// FAIL HERE */ undefined_label; ! /// PASS bug boolean doneFinally = false; for(;;) --- 43,47 ---- continue /*/// FAIL HERE */ undefined_label; ! /// PASS boolean doneFinally = false; for(;;) *************** *** 53,56 **** --- 53,74 ---- assert doneFinally; + /// PASS + boolean doneFinally = false; + try { + for(;;) + break; + assert !doneFinally; + } finally { + doneFinally = true; + } + + /// PASS + let s = "abc"; + while(true) { + synchronized(s){ + if (s == "abc") break; + } + } + /// FAIL label: |
From: Arjan B. <ar...@us...> - 2005-02-07 15:42:06
|
Update of /cvsroot/nice/Nice/testsuite/compiler/designByContract In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10966/F:/nice/testsuite/compiler/designByContract Modified Files: assert.testsuite Log Message: Testcase for compilation of bug #1113263. Index: assert.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/designByContract/assert.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** assert.testsuite 25 Dec 2004 15:51:44 -0000 1.3 --- assert.testsuite 7 Feb 2005 15:41:56 -0000 1.4 *************** *** 48,49 **** --- 48,70 ---- foo(0) { assert false; } foo(x) = 1; + + /// PASS + // testcase for compilation of bug #1113263 + boolean af = false; + try { + (new AssertCaseFail()).aMethod(); + } catch(AssertionFailed e) { af = true; } + assert af; + /// Toplevel + class AssertCaseFail { + void?->void _aFirstPointer = null; + void?->void _aSecondPointer = null; + void aMethod(){ + let void->void fun; + let first = _aFirstPointer; let second = _aSecondPointer; + if ( null != first ) fun = first; + else if( null != second ) fun = second; + else assert false; + fun(); + } + } |
From: Francis B. <fb...@us...> - 2005-02-07 15:08:32
|
Update of /cvsroot/nice/Nice/src/nice/tools/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3902/src/nice/tools/doc Modified Files: utilities.nice Log Message: Added method isSourceAvailable(String packageName) Index: utilities.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/doc/utilities.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** utilities.nice 26 Nov 2004 14:54:56 -0000 1.1 --- utilities.nice 7 Feb 2005 15:08:22 -0000 1.2 *************** *** 7,10 **** --- 7,20 ---- * @date 26/11/2004 */ + + /** + * Checks to see if you have the source code for a package available. + * If we have the source code for a package, then we can provide hyperlinks to + * the method, variables, etc within that package. + */ + boolean isSourceAvailable(String packageName) { + let pkg = compilation.packages.get(packageName); + return pkg != null && pkg.compiling; + } /** |
From: Arjan B. <ar...@us...> - 2005-02-01 23:02:13
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6414/F:/nice/stdlib/nice/lang/inline Modified Files: Assert.java Log Message: Workaround for bug #1113263 Index: Assert.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/Assert.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Assert.java 22 Dec 2003 01:30:59 -0000 1.7 --- Assert.java 1 Feb 2005 23:01:35 -0000 1.8 *************** *** 52,56 **** Label end = new Label(code); ! if (this.assertEnableCheck) code.ifAssertionsDisabledGoto (((ClassExp)comp.topLambda).getAssertionEnabledField(), end); --- 52,56 ---- Label end = new Label(code); ! if (this.assertEnableCheck && args[0] != QuoteExp.falseExp) code.ifAssertionsDisabledGoto (((ClassExp)comp.topLambda).getAssertionEnabledField(), end); *************** *** 61,64 **** --- 61,68 ---- branchOp.compileJump(comp, ((ApplyExp)args[0]).getArgs(), end); } + else if (args[0] == QuoteExp.falseExp) + { + //always continue to throwing exception + } else { |
From: Francis B. <fb...@us...> - 2005-01-23 15:22:48
|
Update of /cvsroot/nice/Nice/src/nice/tools/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11524/src/nice/tools/doc Modified Files: comment.nice Log Message: Fixed a bug whereby an @tag alone on a line would cause an uncaught IndexArrayOutOfBounds exception. Index: comment.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/doc/comment.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** comment.nice 4 Aug 2004 14:54:21 -0000 1.6 --- comment.nice 23 Jan 2005 15:22:36 -0000 1.7 *************** *** 107,114 **** if(line.charAt(0) == '@') { //find the first space - this tells us the range of the tag int index = line.indexOf(' '); ! String tag = line.substring(1, index); //skip the '@' ! String comment = line.substring(index+1); //+1 because we need to skip the space ! Node n = new Node(value: (tag, comment)); root.insert(n); --- 107,123 ---- if(line.charAt(0) == '@') { //find the first space - this tells us the range of the tag + //alternatively, there might be no space int index = line.indexOf(' '); ! String tag, comment; ! if(index != -1 && index + 1 <= line.length()) { ! //skip the '@' ! tag = line.substring(1, index); ! //+1 because we need to skip the space ! comment = line.substring(index+1); ! } ! else { ! tag = line; ! comment = ""; ! } Node n = new Node(value: (tag, comment)); root.insert(n); |
From: Arjan B. <ar...@us...> - 2005-01-17 18:27:13
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12611/F:/nice/src/bossa/syntax Modified Files: analyse.nice assign.nice call.nice customConstructor.nice increment.nice new.nice Log Message: Various additional testcases. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -d -r1.128 -r1.129 *** analyse.nice 16 Jan 2005 00:28:21 -0000 1.128 --- analyse.nice 17 Jan 2005 18:26:14 -0000 1.129 *************** *** 374,378 **** e.isCallTo("assert") && args.size() > 0 && args.getExp(0).isFalse(); ! markAsCallFun(e.function, e.infix); e.function = analyse(e.function, info); --- 374,378 ---- e.isCallTo("assert") && args.size() > 0 && args.getExp(0).isFalse(); ! markAsCallFun(notNull(e.function), e.infix); e.function = analyse(e.function, info); Index: customConstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/customConstructor.nice,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** customConstructor.nice 16 Jan 2005 00:28:21 -0000 1.20 --- customConstructor.nice 17 Jan 2005 18:26:18 -0000 1.21 *************** *** 225,228 **** call.function = createOverloadedSymbolExp(new ArrayList(cast(classe).getConstructorCallSymbols()), thisName); ! call.function.setLocation(ident.location()); } --- 225,228 ---- call.function = createOverloadedSymbolExp(new ArrayList(cast(classe).getConstructorCallSymbols()), thisName); ! notNull(call.function).setLocation(ident.location()); } Index: new.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/new.nice,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** new.nice 20 Dec 2004 16:05:18 -0000 1.10 --- new.nice 17 Jan 2005 18:26:18 -0000 1.11 *************** *** 21,25 **** public class NewExp extends CallExp { - private final TypeIdent ti; --- 21,24 ---- *************** *** 27,30 **** --- 26,31 ---- ?mlsub.typing.TypeConstructor tc = null; + isAssignable() = false; + void resolve(TypeMap typeScope) { *************** *** 88,91 **** public Expression createNewExp(TypeIdent ti, Arguments arguments) { ! return new NewExp(function: cast(null), arguments: arguments, ti: ti); ! } \ No newline at end of file --- 89,92 ---- public Expression createNewExp(TypeIdent ti, Arguments arguments) { ! return new NewExp(function: null, arguments: arguments, ti: ti); ! } Index: increment.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/increment.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** increment.nice 15 Jan 2005 20:27:33 -0000 1.7 --- increment.nice 17 Jan 2005 18:26:18 -0000 1.8 *************** *** 48,52 **** CallExp call = cast(variable); ! let access = call.function.getFieldAccessMethod(); if (access == null) Internal.error(this, "\"var\" is assignable and not a local, " + --- 48,52 ---- CallExp call = cast(variable); ! let access = notNull(call.function).getFieldAccessMethod(); if (access == null) Internal.error(this, "\"var\" is assignable and not a local, " + Index: assign.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/assign.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** assign.nice 16 Jan 2005 21:51:15 -0000 1.8 --- assign.nice 17 Jan 2005 18:26:18 -0000 1.9 *************** *** 39,43 **** { // Rewrite "get(e, i, ...) = v" into "set(e, i, ... , v)" ! if (to instanceof CallExp && "get".equals(to.function.toString())) { let args = new Arguments(arguments: new ArrayList(to.arguments.arguments)); --- 39,43 ---- { // Rewrite "get(e, i, ...) = v" into "set(e, i, ... , v)" ! if (to instanceof CallExp && to.function != null &&"get".equals(notNull(to.function).toString())) { let args = new Arguments(arguments: new ArrayList(to.arguments.arguments)); *************** *** 45,49 **** return new CallExp( ! function: createIdentExp(new LocatedString("set", to.function.location())), arguments: args); } --- 45,49 ---- return new CallExp( ! function: createIdentExp(new LocatedString("set", notNull(to.function).location())), arguments: args); } Index: call.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/call.nice,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** call.nice 16 Jan 2005 00:28:21 -0000 1.12 --- call.nice 17 Jan 2005 18:26:18 -0000 1.13 *************** *** 21,25 **** public class CallExp extends Expression { ! Expression function; Arguments arguments; /** true iff the first argument was written before the application: e.f(x) */ --- 21,25 ---- public class CallExp extends Expression { ! ?Expression function; Arguments arguments; /** true iff the first argument was written before the application: e.f(x) */ *************** *** 52,58 **** arguments.noOverloading(); ! function = function.resolveOverloading(this); ! function.checkSpecialRequirements(cast(arguments.computedExpressions)); // make sure computedExpressions is valid. --- 52,58 ---- arguments.noOverloading(); ! function = notNull(function).resolveOverloading(this); ! notNull(function).checkSpecialRequirements(cast(arguments.computedExpressions)); // make sure computedExpressions is valid. *************** *** 62,66 **** // Important for litteral arrays and tuples. Expression.adjustToExpectedType(cast(arguments.computedExpressions), ! nice.tools.typing.Types.parameters(function.getType())); } --- 62,66 ---- // Important for litteral arrays and tuples. Expression.adjustToExpectedType(cast(arguments.computedExpressions), ! nice.tools.typing.Types.parameters(notNull(function).getType())); } *************** *** 73,77 **** // no default arguments { ! this.setComputedType(notNull(getTypeAndReportErrors(this.location(), function, arguments.inOrder())), null); arguments.computedExpressions = arguments.inOrder(); } --- 73,77 ---- // no default arguments { ! this.setComputedType(notNull(getTypeAndReportErrors(this.location(), notNull(function), arguments.inOrder())), null); arguments.computedExpressions = arguments.inOrder(); } *************** *** 111,115 **** { this.resolveOverloading(); ! let fa = function.getFieldAccessMethod(); return fa != null && ! fa.isFinal(); } --- 111,115 ---- { this.resolveOverloading(); ! let fa = notNull(function).getFieldAccessMethod(); return fa != null && ! fa.isFinal(); } *************** *** 123,127 **** { this.resolveOverloading(); ! return function.getFieldAccessMethod(); } --- 123,127 ---- { this.resolveOverloading(); ! return notNull(function).getFieldAccessMethod(); } *************** *** 155,163 **** gnu.expr.Expression res; ! let fa = function.getFieldAccessMethod(); if (fa != null) res = fa.compileAccess(this.compileParams()); else ! res = new gnu.expr.ApplyExp(function.generateCodeInCallPosition(), this.compileParams()); this.location().write(res); --- 155,163 ---- gnu.expr.Expression res; ! let fa = notNull(function).getFieldAccessMethod(); if (fa != null) res = fa.compileAccess(this.compileParams()); else ! res = new gnu.expr.ApplyExp(notNull(function).generateCodeInCallPosition(), this.compileParams()); this.location().write(res); *************** *** 196,200 **** compileAssign(gnu.expr.Expression value) { ! let access = function.getFieldAccessMethod(); if (access == null) throw Internal.error(this, "Assignment to a call that is not a field access"); --- 196,200 ---- compileAssign(gnu.expr.Expression value) { ! let access = notNull(function).getFieldAccessMethod(); if (access == null) throw Internal.error(this, "Assignment to a call that is not a field access"); *************** *** 215,219 **** { if (!infix) ! return function.toString(Printable.parsable) + arguments; if (declaringClass == null) --- 215,219 ---- { if (!infix) ! return notNull(function).toString(Printable.parsable) + arguments; if (declaringClass == null) |
From: Arjan B. <ar...@us...> - 2005-01-17 18:27:12
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12611/F:/nice/testsuite/compiler/methods Modified Files: ambiguity.testsuite coverage.testsuite integer.testsuite string.testsuite Log Message: Various additional testcases. Index: ambiguity.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/ambiguity.testsuite,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ambiguity.testsuite 15 Sep 2004 12:58:57 -0000 1.4 --- ambiguity.testsuite 17 Jan 2005 18:26:10 -0000 1.5 *************** *** 22,23 **** --- 22,32 ---- void foo(int x, ?int y) {} override void foo(int x, int y) {} + + /// FAIL + /// Toplevel + class A {} + class B extends A {} + void /*/// FAIL HERE */ foo(A x, A y) {} + foo(B x, B y) {} + foo(B x, B y) {} + \ No newline at end of file Index: string.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/string.testsuite,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** string.testsuite 30 Nov 2003 14:24:35 -0000 1.6 --- string.testsuite 17 Jan 2005 18:26:12 -0000 1.7 *************** *** 85,86 **** --- 85,95 ---- assert foo(x, "xy\"#z", x) == 3; assert foo(x, "", x) == 4; + + /// PASS + /// package a + /// Toplevel + let String test = "\b\t\n\f\r\"\'\\\035abc1\77xyz\44"; + boolean foo(String x) = false; + foo("\b\t\n\f\r\"\'\\\035abc1\77xyz\44") = true; + /// package b import a + assert foo(test); Index: coverage.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/coverage.testsuite,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** coverage.testsuite 7 Aug 2004 14:20:28 -0000 1.4 --- coverage.testsuite 17 Jan 2005 18:26:12 -0000 1.5 *************** *** 43,44 **** --- 43,53 ---- <T> boolean foo(T x) = false; foo(Object x) = true; + + /// PASS + /// Toplevel + interface I {} + class A implements I {} + interface K extends I {} + void foo(I x) {} + foo(A x) {} + foo(K x) {} Index: integer.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/integer.testsuite,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** integer.testsuite 30 Nov 2003 14:24:35 -0000 1.15 --- integer.testsuite 17 Jan 2005 18:26:12 -0000 1.16 *************** *** 230,231 **** --- 230,237 ---- assert foo('\\') == 1; assert foo('\'') == 2; + + /// PASS + /// Toplevel + void foo(int x, int y) {} + foo(3, y>5) {} + foo(x>5, 3) {} |
From: Arjan B. <ar...@us...> - 2005-01-17 18:26:58
|
Update of /cvsroot/nice/Nice/testsuite/compiler/statements/loops In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12611/F:/nice/testsuite/compiler/statements/loops Modified Files: break.testsuite Log Message: Various additional testcases. Index: break.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/statements/loops/break.testsuite,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** break.testsuite 19 Aug 2004 14:38:15 -0000 1.5 --- break.testsuite 17 Jan 2005 18:26:13 -0000 1.6 *************** *** 52,53 **** --- 52,62 ---- } assert doneFinally; + + /// FAIL + label: + { + /*/// FAIL HERE */ label: while (true) + { + break label; + } + } |
From: Arjan B. <ar...@us...> - 2005-01-17 18:26:57
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes/constructors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12611/F:/nice/testsuite/compiler/classes/constructors Modified Files: custom.testsuite Log Message: Various additional testcases. Index: custom.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/constructors/custom.testsuite,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** custom.testsuite 25 Dec 2004 23:26:19 -0000 1.16 --- custom.testsuite 17 Jan 2005 18:26:00 -0000 1.17 *************** *** 150,151 **** --- 150,159 ---- class A {} new A(int) { this(); } + + /// FAIL + let x = /*/// FAIL HERE */ new A(); + /// Toplevel + class A { + int x; + String s = "abc"; + } |
From: Arjan B. <ar...@us...> - 2005-01-17 18:26:51
|
Update of /cvsroot/nice/Nice/testsuite/compiler/expressions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12611/F:/nice/testsuite/compiler/expressions Modified Files: new.testsuite Log Message: Various additional testcases. Index: new.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/expressions/new.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** new.testsuite 16 Dec 2003 12:34:32 -0000 1.3 --- new.testsuite 17 Jan 2005 18:26:09 -0000 1.4 *************** *** 12,13 **** --- 12,18 ---- class Param<T> {} <Param P, T> P<T> f() = /*/// FAIL HERE */ new P(); + + /// FAIL + /*/// FAIL HERE */ (new A()) = 5; + /// Toplevel + class A {} |
From: Arjan B. <ar...@us...> - 2005-01-17 18:26:49
|
Update of /cvsroot/nice/Nice/testsuite/compiler/abstractInterfaces In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12611/F:/nice/testsuite/compiler/abstractInterfaces Modified Files: interface.testsuite Log Message: Various additional testcases. Index: interface.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/abstractInterfaces/interface.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** interface.testsuite 2 Jun 2003 17:43:11 -0000 1.1 --- interface.testsuite 17 Jan 2005 18:25:58 -0000 1.2 *************** *** 13,14 **** --- 13,18 ---- } + /// FAIL + /// Toplevel + abstract interface I<T> {} + abstract interface /*/// FAIL HERE */ K extends I {} |
From: Arjan B. <ar...@us...> - 2005-01-17 13:17:09
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16708/F:/nice/src/bossa/syntax Modified Files: break.nice constant.nice formalParameters.nice overloadedsymbol.nice pattern.nice symbolexp.nice Log Message: Conversion cleanup part 5. Index: break.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/break.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** break.nice 13 Aug 2004 21:04:41 -0000 1.3 --- break.nice 17 Jan 2005 13:16:57 -0000 1.4 *************** *** 38,42 **** toString() = "continue " + (label != null ? notNull(label).toString() : "") + ";"; - } --- 38,41 ---- *************** *** 49,66 **** } - public Statement createContinueStmt(LocatedString label) - { - return new ContinueStmt(label: label); - } - /** A statement anotated by a label (used by break and continue). - */ public class LabeledStmt extends Statement { private final LocatedString label; private final Statement statement; ! private final ?LoopStmt loop = null; public String name() = label.toString(); --- 48,62 ---- } /** A statement anotated by a label (used by break and continue). + */ public class LabeledStmt extends Statement { private final LocatedString label; private final Statement statement; ! private final ?LoopStmt loop; ! ! ?gnu.expr.BlockExp block = null; public String name() = label.toString(); *************** *** 69,87 **** /** @return the loop targeted by this label, or null. */ ! ?LoopStmt getLoop() ! { ! if (loop != null) ! return loop; ! if (statement instanceof LoopStmt) ! return cast(statement); ! return null; ! } ! ! /**************************************************************** ! * Code generation ! ****************************************************************/ ! ! ?gnu.expr.BlockExp block = null; ! generateCode() { --- 65,70 ---- /** @return the loop targeted by this label, or null. */ ! ?LoopStmt getLoop() = loop; ! generateCode() { *************** *** 94,100 **** toString() = this.name() + ":\n" + statement; } - - public new LabeledStmt(LocatedString label, Statement statement, LoopStmt loop) - { - this(label:label, statement:statement, loop: loop, block: null); - } --- 77,78 ---- Index: formalParameters.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/formalParameters.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** formalParameters.nice 16 Jan 2005 00:28:21 -0000 1.7 --- formalParameters.nice 17 Jan 2005 13:16:57 -0000 1.8 *************** *** 21,38 **** public class FormalParameters extends Node { ! private Parameter[] parameters; ! int size; void addThis(Monotype type) { ! if (parameters[0] != null) ! Internal.error("No room for \"this\""); ! ! parameters[0] = new NamedParameter(type: type, name: thisName); } boolean hasThis() { ! return parameters.length > 0 && parameters[0].match("this"); } --- 21,36 ---- public class FormalParameters extends Node { ! private List<Parameter> parameters; ! ! int size() = parameters.size(); void addThis(Monotype type) { ! parameters.add(0, new NamedParameter(type: type, name: thisName)); } boolean hasThis() { ! return parameters.size() > 0 && parameters[0].match("this"); } *************** *** 53,104 **** boolean hasDefaultValue() ! { ! for (int i = size; --i>=0; ) ! if (parameters[i].value() != null) ! return true; ! ! return false; } boolean containsAlike() { ! for (int i = size; --i>=0; ) ! if (parameters[i] != null && parameters[i].type.containsAlike()) ! return true; ! ! return false; } void substitute(Map<java.lang.String, Monotype> map) { ! for (int i = size; --i>=0; ) ! if (parameters[i] != null) // it is the case for "this" placeholder ! parameters[i].type = parameters[i].type.substitute(map); } Monotype[?] types() { ! if (parameters.length == 0) return null; ! ! Monotype[] res = cast(new Monotype[size]); ! for (int i = 0; i < size; i++) ! res[i] = parameters[i].type; ! ! return res; } public MonoSymbol[] getMonoSymbols() { ! MonoSymbol[] res = cast(new MonoSymbol[size]); ! for (int i = 0; i < size; i++) ! res[i] = parameters[i].getSymbol(); ! ! return res; } void typecheck(mlsub.typing.Monotype[] domain) { ! for (int i = 0; i<size; i++) parameters[i].typecheck(domain[i]); } --- 51,85 ---- boolean hasDefaultValue() ! { //why different condition than in previous method??? ! return parameters.any(Parameter param => param.value != null); } boolean containsAlike() { ! return parameters.any(Parameter param => param.type.containsAlike()); } void substitute(Map<java.lang.String, Monotype> map) { ! for (param : parameters) ! param.substitute(map); } Monotype[?] types() { ! if (parameters.isEmpty()) return null; ! ! return parameters.mapToArray(Parameter param => param.type); } public MonoSymbol[] getMonoSymbols() { ! return parameters.mapToArray(Parameter param => param.getSymbol()); } void typecheck(mlsub.typing.Monotype[] domain) { ! for (int i = 0; i<this.size(); i++) parameters[i].typecheck(domain[i]); } *************** *** 106,115 **** resolve() { ! for (int i = 0; i<size; i++) ! parameters[i].resolve(scope, typeScope); ! for (int i = 0; i<size; i++) ! if (parameters[i].symbol != null) ! notNull(parameters[i].symbol).state = ACCESSIBLE; } --- 87,96 ---- resolve() { ! for (param : parameters) ! param.resolve(scope, typeScope); ! for (param : parameters) ! if (param.symbol != null) ! notNull(param.symbol).state = ACCESSIBLE; } *************** *** 119,124 **** void resolveCalledFromAnalyse(Info info) { ! for (int i = 0; i<size; i++) ! parameters[i].resolve(info); } --- 100,105 ---- void resolveCalledFromAnalyse(Info info) { ! for (param : parameters) ! param.resolve(info); } *************** *** 133,137 **** boolean match(Arguments args, VarSymbol symbol) { ! int[] map = new int[size]; // first pass, fill holes with names given at the call site --- 114,118 ---- boolean match(Arguments args, VarSymbol symbol) { ! int[] map = new int[this.size()]; // first pass, fill holes with names given at the call site *************** *** 155,160 **** // check that each parameter is either supplied or optional // stores the invocation expressions ! ?Expression[] exps = new Expression[size]; ! for (int i = 0; i < size; i++) if (map[i] == 0) { --- 136,141 ---- // check that each parameter is either supplied or optional // stores the invocation expressions ! ?Expression[] exps = new Expression[this.size()]; ! for (int i = 0; i < this.size(); i++) if (map[i] == 0) { *************** *** 199,231 **** public boolean hasMatchFor(String s) { ! for (int i = 0; i<size; i++) ! if (parameters[i].match(s)) ! return true; ! ! return false; } toString() = Util.map("", ", ", "", parameters); ! public List<Parameter> asList() ! { ! if (parameters.length != 0) ! return Arrays.asList(parameters); ! ! return new ArrayList(); ! } public List<Parameter> getRequiredParameters() { ! LinkedList<Parameter> res = new LinkedList(); ! for(int i = 0; i < size; i++) ! { ! Parameter param = parameters[i]; ! if (!(param instanceof OptionalParameter)) ! { ! res.add(parameters[i]); ! } ! } ! return res; } --- 180,194 ---- public boolean hasMatchFor(String s) { ! return parameters.any(Parameter param => param.match(s)); } toString() = Util.map("", ", ", "", parameters); ! public List<Parameter> asList() = new ArrayList(parameters); public List<Parameter> getRequiredParameters() { ! return parameters.filter(Parameter param => ! !(param instanceof OptionalParameter)); } *************** *** 234,238 **** java.util.Stack<gnu.bytecode.Variable>[?] res = null; ! for(int i = 0; i < size; i++) { Parameter param = parameters[i]; --- 197,201 ---- java.util.Stack<gnu.bytecode.Variable>[?] res = null; ! for(int i = 0; i < this.size(); i++) { Parameter param = parameters[i]; *************** *** 240,244 **** { if (res == null) ! res = cast(new java.util.Stack[parameters.length]); notNull(res)[i] = notNull(notNull(param.symbol).copies); } --- 203,207 ---- { if (res == null) ! res = cast(new java.util.Stack[this.size()]); notNull(res)[i] = notNull(notNull(param.symbol).copies); } *************** *** 250,261 **** List<Parameter> getParameters(TypeScope scope) { ! ArrayList<Parameter> res = new ArrayList(size); ! for (int i = 0; i < size; i++) { ! Parameter p = parameters[i].cloneParam(); p.type = new MonotypeWrapper(type: p.type.resolve(scope)); ! res.add(p); ! } ! return res; } --- 213,222 ---- List<Parameter> getParameters(TypeScope scope) { ! return parameters.map(Parameter param => { ! let p = param.cloneParam(); p.type = new MonotypeWrapper(type: p.type.resolve(scope)); ! return p; ! }); } *************** *** 266,276 **** } ! public FormalParameters createFormalParameters(?List<Parameter> parameters) { ! if (parameters == null) ! return new FormalParameters(Node.none, parameters: [], size: 0); ! ! return new FormalParameters(Node.none, parameters: parameters.toArray(), ! size: parameters.size()); } --- 227,233 ---- } ! public FormalParameters createFormalParameters(List<Parameter> parameters) { ! return new FormalParameters(Node.none, parameters: parameters); } *************** *** 317,320 **** --- 274,282 ---- boolean isOverriden() = false; + void substitute(Map<java.lang.String, Monotype> map) + { + type = type.substitute(map); + } + void resolve(?VarScope scope, ?TypeScope typeScope) { Index: constant.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/constant.nice,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** constant.nice 16 Jan 2005 00:28:21 -0000 1.10 --- constant.nice 17 Jan 2005 13:16:57 -0000 1.11 *************** *** 345,350 **** public class StringConstantExp extends ConstantExp { - final String escapedValue; - compile() { --- 345,348 ---- *************** *** 363,367 **** value = escapeEOL(value); ! let res = new StringConstantExp(value: unescapeLiteral(value), escapedValue: value, representation: "\""+value+"\"" , className: stringClassName); return res; } --- 361,365 ---- value = escapeEOL(value); ! let res = new StringConstantExp(value: unescapeLiteral(value), representation: "\""+value+"\"" , className: stringClassName); return res; } Index: pattern.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/pattern.nice,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** pattern.nice 16 Jan 2005 00:28:21 -0000 1.18 --- pattern.nice 17 Jan 2005 13:16:57 -0000 1.19 *************** *** 777,781 **** } bytecodeRepresentation(BoolPattern p) = p.atValue.isTrue() ? "@true" : "@false"; ! bytecodeRepresentation(StringPattern p) = "@\"" + p.atValue.escapedValue + "\""; bytecodeRepresentation(CharPattern p) = "@\'" + p.atValue.value + "\'"; bytecodeRepresentation(IntPattern p) = "@" + (p.atValue.longValue() >= 0 ? "+" : "") + p.atValue; --- 777,781 ---- } bytecodeRepresentation(BoolPattern p) = p.atValue.isTrue() ? "@true" : "@false"; ! bytecodeRepresentation(StringPattern p) = "@" + p.atValue.representation; bytecodeRepresentation(CharPattern p) = "@\'" + p.atValue.value + "\'"; bytecodeRepresentation(IntPattern p) = "@" + (p.atValue.longValue() >= 0 ? "+" : "") + p.atValue; Index: symbolexp.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/symbolexp.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** symbolexp.nice 14 Jan 2005 22:47:11 -0000 1.4 --- symbolexp.nice 17 Jan 2005 13:16:57 -0000 1.5 *************** *** 86,90 **** } ! Expression createSymbolExp(VarSymbol symbol, Location loc) { let res = new SymbolExp(symbol: symbol); --- 86,90 ---- } ! SymbolExp createSymbolExp(VarSymbol symbol, Location loc) { let res = new SymbolExp(symbol: symbol); Index: overloadedsymbol.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/overloadedsymbol.nice,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** overloadedsymbol.nice 16 Jan 2005 21:51:15 -0000 1.14 --- overloadedsymbol.nice 17 Jan 2005 13:16:57 -0000 1.15 *************** *** 40,44 **** private Expression uniqueExpression(VarSymbol sym, mlsub.typing.Polytype t) { ! SymbolExp res = cast(createSymbolExp(sym, this.location())); res.type = t; return res; --- 40,44 ---- private Expression uniqueExpression(VarSymbol sym, mlsub.typing.Polytype t) { ! SymbolExp res = createSymbolExp(sym, this.location()); res.type = t; return res; *************** *** 464,468 **** int len = symbols.size(); ! VarSymbol[] syms = new VarSymbol[len].fillWith(symbols); boolean[] remove = new boolean[len]; --- 464,468 ---- int len = symbols.size(); ! List<VarSymbol> syms = new ArrayList(symbols); boolean[] remove = new boolean[len]; *************** *** 531,535 **** int len = symbols.size(); ! VarSymbol[] syms = new VarSymbol[len].fillWith(symbols); boolean[] remove = new boolean[len]; --- 531,535 ---- int len = symbols.size(); ! List<VarSymbol> syms = new ArrayList(symbols); boolean[] remove = new boolean[len]; *************** *** 617,624 **** int len = symbols.size(); ! VarSymbol[] syms = cast(symbols.toArray(new VarSymbol[len])); ! for (int i = 0; i < syms.length; i++) ! for (int j = i+1; j < syms.length; j++) if (overlappingJavaMethods(syms[i].getMethodDeclaration(), syms[j].getMethodDeclaration())) --- 617,624 ---- int len = symbols.size(); ! List<VarSymbol> syms = new ArrayList(symbols); ! for (int i = 0; i < len; i++) ! for (int j = i+1; j < len; j++) if (overlappingJavaMethods(syms[i].getMethodDeclaration(), syms[j].getMethodDeclaration())) |
From: Arjan B. <ar...@us...> - 2005-01-17 13:17:07
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16708/F:/nice/src/bossa/parser Modified Files: JavaccParser.java Parser.jj Log Message: Conversion cleanup part 5. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.307 retrieving revision 1.308 diff -C2 -d -r1.307 -r1.308 *** Parser.jj 16 Jan 2005 21:51:14 -0000 1.307 --- Parser.jj 17 Jan 2005 13:16:56 -0000 1.308 *************** *** 900,904 **** } ! FormalParameters formalParameters(boolean leaveRoomForThis, List statements): { List params = new LinkedList(); --- 900,904 ---- } ! FormalParameters formalParameters(List statements): { List params = new LinkedList(); *************** *** 906,915 **** } { - { if (leaveRoomForThis) params.add(null); } [ p = formalParameter(statements) { params.add(p); } ( "," p = formalParameter(statements) { params.add(p); } )* ] ! { return bossa.syntax.dispatch.createFormalParameters(params.isEmpty() ? null : params ); } } --- 906,914 ---- } { [ p = formalParameter(statements) { params.add(p); } ( "," p = formalParameter(statements) { params.add(p); } )* ] ! { return bossa.syntax.dispatch.createFormalParameters(params); } } *************** *** 928,932 **** returnType=monotype() name=identOrBackquoted() ! "(" parameters = formalParameters(true, statements) ")" contract = contract() ( ";" | body = code() {statements.add(body);} ) --- 927,931 ---- returnType=monotype() name=identOrBackquoted() ! "(" parameters = formalParameters(statements) ")" contract = contract() ( ";" | body = code() {statements.add(body);} ) *************** *** 1114,1118 **** } { ! "new" name=ident() "(" params=formalParameters(false, statements) ")" ( "=" exp=Expression() ";" { statements.add(bossa.syntax.dispatch.createExpressionStmt(exp)); } --- 1113,1117 ---- } { ! "new" name=ident() "(" params=formalParameters(statements) ")" ( "=" exp=Expression() ";" { statements.add(bossa.syntax.dispatch.createExpressionStmt(exp)); } *************** *** 1403,1407 **** returnType=monotype() name=identOrBackquoted() ! "(" parameters = formalParameters(false, statements) ")" ( LOOKAHEAD(2) --- 1402,1406 ---- returnType=monotype() name=identOrBackquoted() ! "(" parameters = formalParameters(statements) ")" ( LOOKAHEAD(2) *************** *** 2413,2418 **** if (forLoop && !(res instanceof LoopStmt)) return new LabeledStmt(label, res, (LoopStmt) ((Block) res).last()); else ! return new LabeledStmt(label, res); } } --- 2412,2419 ---- if (forLoop && !(res instanceof LoopStmt)) return new LabeledStmt(label, res, (LoopStmt) ((Block) res).last()); + else if (res instanceof LoopStmt) + return new LabeledStmt(label, res, (LoopStmt) res); else ! return new LabeledStmt(label, res, null); } } *************** *** 2496,2500 **** type = monotype() id=ident() ! "(" parameters=formalParameters(false, statements) ")" body=code() { statements.add(body); } { return bossa.syntax.dispatch.createLocalFunction(id, type, parameters, body!=null?bossa.syntax.dispatch.createBlock(statements):null); } --- 2497,2501 ---- type = monotype() id=ident() ! "(" parameters=formalParameters(statements) ")" body=code() { statements.add(body); } { return bossa.syntax.dispatch.createLocalFunction(id, type, parameters, body!=null?bossa.syntax.dispatch.createBlock(statements):null); } Index: JavaccParser.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/JavaccParser.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JavaccParser.java 3 Jan 2005 01:24:11 -0000 1.3 --- JavaccParser.java 17 Jan 2005 13:16:56 -0000 1.4 *************** *** 89,93 **** { try { ! return getParser(parameters).formalParameters(false, null); } catch(ParseException ex) { --- 89,93 ---- { try { ! return getParser(parameters).formalParameters(null); } catch(ParseException ex) { |
From: Arjan B. <ar...@us...> - 2005-01-16 21:51:27
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3874/F:/nice/src/bossa/syntax Modified Files: alternative.nice arguments.nice assign.nice constructor.nice contract.nice enum.nice expression.nice overloadedsymbol.nice retypedMethod.nice tools.nice typedef.nice Log Message: Conversion cleanup part 4. Index: arguments.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/arguments.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** arguments.nice 15 Jan 2005 20:27:33 -0000 1.2 --- arguments.nice 16 Jan 2005 21:51:15 -0000 1.3 *************** *** 13,17 **** package bossa.syntax; - import java.util.*; import bossa.util.*; --- 13,16 ---- *************** *** 22,26 **** public class Arguments { ! Argument[] arguments; /** Hold real parameter, after default parameters --- 21,25 ---- public class Arguments { ! List<Argument> arguments; /** Hold real parameter, after default parameters *************** *** 37,52 **** public void addReceiver(Expression value) { ! if (arguments[0] != null) ! Internal.error("No room for \"receiver\""); ! ! arguments[0] = new Argument(value: value); } void add(Expression arg, ?LocatedString name) { ! Argument[] newArgs = cast(new Argument[arguments.length + 1]); ! System.arraycopy(arguments, 0, newArgs, 0, arguments.length); ! newArgs[arguments.length] = new Argument(value: arg, name: name); ! arguments = newArgs; } --- 36,45 ---- public void addReceiver(Expression value) { ! arguments.add(0, new Argument(value: value)); } void add(Expression arg, ?LocatedString name) { ! arguments.add(new Argument(value: arg, name: name)); } *************** *** 56,60 **** return notNull(computedExpressions).length; else ! return arguments.length; } --- 49,53 ---- return notNull(computedExpressions).length; else ! return arguments.size(); } *************** *** 79,103 **** void noOverloading() { ! for (int i = arguments.length; --i>=0; ) ! arguments[i].value = arguments[i].value.noOverloading(); } void computeTypes() { ! for (int i = arguments.length; --i>=0; ) ! arguments[i].value.getType(); } Expression[] inOrder() { ! if (arguments.length == 0) ! return []; ! ! Expression[] res = cast(new Expression[arguments.length]); ! ! for (int i = arguments.length; --i>=0; ) ! res[i] = arguments[i].value; ! ! return res; } --- 72,88 ---- void noOverloading() { ! for (arg : arguments) ! arg.noOverloading(); } void computeTypes() { ! for (arg : arguments) ! arg.value.getType(); } Expression[] inOrder() { ! return arguments.mapToArray(Argument arg => arg.value); } *************** *** 108,116 **** if (res != null) // the first argument was fake, remove it ! { ! Argument[] newArgs = cast(new Argument[arguments.length - 1]); ! System.arraycopy(arguments, 1, newArgs, 0, newArgs.length); ! arguments = newArgs; ! } return res; --- 93,97 ---- if (res != null) // the first argument was fake, remove it ! arguments.removeAt(0); return res; *************** *** 126,135 **** boolean plainApplication(int arity, VarSymbol symbol) { ! if (arguments.length != arity) return false; ! for (int i = 0; i<arguments.length; i++) ! if (arguments[i].name != null) ! return false; applicationExpressions.put(symbol, this.inOrder()); --- 107,115 ---- boolean plainApplication(int arity, VarSymbol symbol) { ! if (arguments.size() != arity) return false; ! if (arguments.any(Argument arg => arg.name != null)) ! return false; applicationExpressions.put(symbol, this.inOrder()); *************** *** 137,140 **** --- 117,130 ---- } + List<String> getNames() + { + List<String> res = new ArrayList(); + for (arg : arguments) + if (arg.name != null) + res.add(notNull(arg.name).toString()); + + return res; + } + toString() = "(" + Util.map("", ", ", "", arguments) + ")"; *************** *** 142,148 **** { StringBuffer res = new StringBuffer("("); ! for (int i = 1; i<arguments.length; i++) res.append(arguments[i].toString() + ! (i + 1 < arguments.length ? ", " : "")); return res.append(")").toString(); } --- 132,138 ---- { StringBuffer res = new StringBuffer("("); ! for (int i = 1; i<arguments.size(); i++) res.append(arguments[i].toString() + ! (i + 1 < arguments.size() ? ", " : "")); return res.append(")").toString(); } *************** *** 151,165 **** { StringBuffer res = new StringBuffer("("); ! for (int i = 0; i<arguments.length; i++) ! res.append((arguments[i].name == null ? "" : notNull(arguments[i].name) + ":") + ! arguments[i].value.getType() + ! (i + 1 < arguments.length ? ", " : "")); return res.append(")").toString(); } } ! public Arguments createArguments(List<Argument> args) { ! return new Arguments(arguments: args.toArray()); } --- 141,154 ---- { StringBuffer res = new StringBuffer("("); ! for (int i = 0; i<arguments.size(); i++) ! res.append(arguments[i].printType() + ! (i + 1 < arguments.size() ? ", " : "")); return res.append(")").toString(); } } ! public Arguments createArguments(Argument[] args) { ! return new Arguments(arguments: new ArrayList(args)); } *************** *** 169,172 **** --- 158,168 ---- ?LocatedString name = null; + void noOverloading() + { + value = value.noOverloading(); + } + toString() = (name == null ? "" : notNull(name) + ":" ) + value; + + String printType() = (name==null ? "" : notNull(name) + ":") + value.getType(); } Index: enum.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/enum.nice,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** enum.nice 16 Jan 2005 00:28:21 -0000 1.16 --- enum.nice 16 Jan 2005 21:51:15 -0000 1.17 *************** *** 184,187 **** return new EnumSymbol(name, syntacticType: type, definition: def, value: ! createNewExp(new TypeIdent(name: enumName), new Arguments(arguments: args.toArray()))); } --- 184,187 ---- return new EnumSymbol(name, syntacticType: type, definition: def, value: ! createNewExp(new TypeIdent(name: enumName), new Arguments(arguments: args))); } Index: contract.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/contract.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** contract.nice 15 Jan 2005 20:27:33 -0000 1.3 --- contract.nice 16 Jan 2005 21:51:15 -0000 1.4 *************** *** 94,99 **** public gnu.expr.Expression compile(gnu.expr.Expression body) { ! return new gnu.expr.CheckContract(Expression_compile(pre.toArray()), ! Expression_compile(post.toArray()), body); } --- 94,99 ---- public gnu.expr.Expression compile(gnu.expr.Expression body) { ! return new gnu.expr.CheckContract(Expression_compile(pre), ! Expression_compile(post), body); } Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** tools.nice 16 Jan 2005 00:28:21 -0000 1.102 --- tools.nice 16 Jan 2005 21:51:15 -0000 1.103 *************** *** 193,196 **** --- 193,198 ---- ?gnu.bytecode.Type Types_get(mlsub.typing.TypeConstructor) = native gnu.bytecode.Type nice.tools.code.Types.get(mlsub.typing.TypeConstructor); gnu.bytecode.ClassType Type_pointer_type() = native gnu.bytecode.Type.pointer_type; + ?mlsub.typing.TypeConstructor TypeConstructor_fromTypeSymbol(mlsub.typing.TypeSymbol) = native mlsub.typing.TypeConstructor mlsub.typing.TypeConstructor.fromTypeSymbol(mlsub.typing.TypeSymbol); + ?gnu.bytecode.Type TypeImport_lookup(String, ?Location) = native gnu.bytecode.Type nice.tools.code.TypeImport.lookup(String, Location); // Retypings needed since java types are not strict. Index: overloadedsymbol.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/overloadedsymbol.nice,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** overloadedsymbol.nice 16 Jan 2005 00:28:21 -0000 1.13 --- overloadedsymbol.nice 16 Jan 2005 21:51:15 -0000 1.14 *************** *** 164,168 **** // store the expression (including default arguments) ! callExp.arguments.computedExpressions = cast(arguments.getExpressions(res)); //callExp.arguments = null; // free memory return this.uniqueExpression(); --- 164,168 ---- // store the expression (including default arguments) ! callExp.arguments.computedExpressions = arguments.getExpressions(res); //callExp.arguments = null; // free memory return this.uniqueExpression(); *************** *** 353,367 **** compile() { ! Internal.error("compile in "+this.getClass()+" "+this); ! return cast(null); } - toString() { if (symbols.size() <= 1) ! return "[" + Util.map("", "\n|", "", symbols.toArray()) + "]"; ! return "\n[" + Util.map("", "\n|", "", symbols.toArray()) + "]"; } --- 353,365 ---- compile() { ! throw Internal.error("compile in "+this.getClass()+" "+this); } toString() { if (symbols.size() <= 1) ! return "[" + Util.map("", "\n|", "", symbols) + "]"; ! return "\n[" + Util.map("", "\n|", "", symbols) + "]"; } *************** *** 404,408 **** ".\nArguments: " + arguments.printTypes() + "\nPossibilities:\n" + ! Util.map("", "\n", "", removed.toArray()); } --- 402,406 ---- ".\nArguments: " + arguments.printTypes() + "\nPossibilities:\n" + ! Util.map("", "\n", "", removed); } *************** *** 417,421 **** return "No symbol with name " + ident + " has type " + expectedType + ! ":\n" + Util.map("", "\n", "", removed.toArray()); } --- 415,419 ---- return "No symbol with name " + ident + " has type " + expectedType + ! ":\n" + Util.map("", "\n", "", removed); } *************** *** 455,459 **** "Ambiguity for symbol " + sym.ident + ". Possibilities are :\n" + ! Util.map("", "\n", "", toArray(sym.symbols))); } --- 453,457 ---- "Ambiguity for symbol " + sym.ident + ". Possibilities are :\n" + ! Util.map("", "\n", "", sym.symbols)); } *************** *** 647,655 **** ?String explainNoMatch(Arguments args, List<VarSymbol> noMatches) { ! List<String> argnames = new LinkedList(); ! for (int i = 0; i < args.arguments.length; i++) ! if (args.arguments[i].name != null) ! argnames.add(notNull(args.arguments[i].name).toString()); ! if (!argnames.isEmpty()) { --- 645,649 ---- ?String explainNoMatch(Arguments args, List<VarSymbol> noMatches) { ! List<String> argnames = args.getNames(); if (!argnames.isEmpty()) { *************** *** 667,679 **** List<String> noMatchByName(Arguments args, ?FormalParameters parameters) { ! List<String> res = new LinkedList(); ! for (int i = 0; i < args.arguments.length; i++) ! if (args.arguments[i].name != null) ! { ! String s = notNull(args.arguments[i].name).toString(); ! if (parameters == null || !parameters.hasMatchFor(s)) ! res.add(s); ! } ! return res; } --- 661,667 ---- List<String> noMatchByName(Arguments args, ?FormalParameters parameters) { ! if (parameters == null) ! return new ArrayList(); ! return args.getNames().filter(String n => !parameters.hasMatchFor(n)); } Index: retypedMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/retypedMethod.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** retypedMethod.nice 16 Jan 2005 00:28:21 -0000 1.6 --- retypedMethod.nice 16 Jan 2005 21:51:15 -0000 1.7 *************** *** 152,156 **** javaArity = javaTypes.size(); ! if (javaTypes != null && javaArity != arity) User.error(this, "Native method " + this.getSymbol().name + --- 152,156 ---- javaArity = javaTypes.size(); ! if (javaArity != arity) User.error(this, "Native method " + this.getSymbol().name + Index: typedef.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typedef.nice,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** typedef.nice 16 Jan 2005 00:28:21 -0000 1.16 --- typedef.nice 16 Jan 2005 21:51:15 -0000 1.17 *************** *** 13,33 **** package bossa.syntax; - // Abstract - // These are used by nice code only, therefore do not need to be in the - // java file. - int getBytecodeFlags(TypeDefinition c); - ?mlsub.typing.TypeConstructor getSuperClass(TypeDefinition c); - boolean implementsJavaInterface(TypeDefinition c, String name); - ?mlsub.typing.Monotype lowlevelMonotype(TypeDefinition c); - List<mlsub.typing.Interface> getInterfaces(TypeDefinition c); - mlsub.typing.TypeConstructor[?] getJavaInterfaces(TypeDefinition c); - ?ClassDefinition getSuperClassDefinition(TypeDefinition c); - int getVariance(TypeDefinition t); - InterfaceDefinition[] getImplementedInterfaces(TypeDefinition c); - /** Abstract syntax for a type definition. - */ public abstract class TypeDefinition extends MethodContainer { --- 13,20 ---- package bossa.syntax; /** Abstract syntax for a type definition. + */ public abstract class TypeDefinition extends MethodContainer { *************** *** 73,77 **** boolean isConcrete() = !modifiers.isAbstract(); ! implementsJavaInterface(name) { let ji = javaInterfaces; --- 60,64 ---- boolean isConcrete() = !modifiers.isAbstract(); ! boolean implementsJavaInterface(String name) { let ji = javaInterfaces; *************** *** 88,98 **** ?mlsub.typing.Interface getAssociatedInterface() = null; ! getSuperClass() = null; ! getSuperClassDefinition() = null; mlsub.typing.TypeConstructor getTC() = tc; ! getImplementedInterfaces() { if (interfaces.size() == 0) return new InterfaceDefinition[0]; --- 75,85 ---- ?mlsub.typing.Interface getAssociatedInterface() = null; ! ?mlsub.typing.TypeConstructor getSuperClass() = null; ! ?ClassDefinition getSuperClassDefinition() = null; mlsub.typing.TypeConstructor getTC() = tc; ! InterfaceDefinition[] getImplementedInterfaces() { if (interfaces.size() == 0) return new InterfaceDefinition[0]; *************** *** 164,168 **** ****************************************************************/ ! lowlevelMonotype() { try { --- 151,155 ---- ****************************************************************/ ! ?mlsub.typing.Monotype lowlevelMonotype() { try { *************** *** 424,428 **** } ! getInterfaces() = interfaces.toArray(); void addInterfaceImplementation(mlsub.typing.Interface itf) --- 411,415 ---- } ! List<mlsub.typing.Interface> getInterfaces() = interfaces; void addInterfaceImplementation(mlsub.typing.Interface itf) *************** *** 431,435 **** } ! getJavaInterfaces() = javaInterfaces; void setJavaType(gnu.bytecode.Type javaType) --- 418,422 ---- } ! mlsub.typing.TypeConstructor[?] getJavaInterfaces() = javaInterfaces; void setJavaType(gnu.bytecode.Type javaType) *************** *** 448,452 **** ClassImplementation getImplementation() = notNull(implementation); ! getBytecodeFlags() = modifiers.getBits(); } --- 435,439 ---- ClassImplementation getImplementation() = notNull(implementation); ! int getBytecodeFlags() = modifiers.getBits(); } *************** *** 798,802 **** // Variance lookup ! getVariance(TypeDefinition t) { int arity = getVariance(t.implementations); --- 785,789 ---- // Variance lookup ! int getVariance(TypeDefinition t) { int arity = getVariance(t.implementations); Index: assign.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/assign.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** assign.nice 16 Jan 2005 00:28:21 -0000 1.7 --- assign.nice 16 Jan 2005 21:51:15 -0000 1.8 *************** *** 41,50 **** if (to instanceof CallExp && "get".equals(to.function.toString())) { ! List<Argument> args = new ArrayList(to.arguments.arguments); ! args.add(new Argument(value: value)); return new CallExp( function: createIdentExp(new LocatedString("set", to.function.location())), ! arguments: new Arguments(arguments: args.toArray())); } --- 41,50 ---- if (to instanceof CallExp && "get".equals(to.function.toString())) { ! let args = new Arguments(arguments: new ArrayList(to.arguments.arguments)); ! args.add(value, null); return new CallExp( function: createIdentExp(new LocatedString("set", to.function.location())), ! arguments: args); } Index: expression.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/expression.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** expression.nice 15 Jan 2005 20:27:33 -0000 1.1 --- expression.nice 16 Jan 2005 21:51:15 -0000 1.2 *************** *** 57,63 **** * Maps {@link #generateCode()} over an array of expressions. */ ! public gnu.expr.Expression[] Expression_compile(Expression[] expressions) { ! gnu.expr.Expression[] res = cast(new gnu.expr.Expression[expressions.length]); for (int i=0; i<res.length; i++) res[i] = expressions[i].generateCode(); --- 57,63 ---- * Maps {@link #generateCode()} over an array of expressions. */ ! public gnu.expr.Expression[] Expression_compile(List<Expression> expressions) { ! gnu.expr.Expression[] res = cast(new gnu.expr.Expression[expressions.size()]); for (int i=0; i<res.length; i++) res[i] = expressions[i].generateCode(); Index: alternative.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/alternative.nice,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** alternative.nice 16 Jan 2005 00:28:21 -0000 1.9 --- alternative.nice 16 Jan 2005 21:51:15 -0000 1.10 *************** *** 376,389 **** public void readImportedAlternative(gnu.bytecode.ClassType c, gnu.bytecode.Method method, Location location) { ! ?gnu.bytecode.MiscAttr attr = cast(gnu.bytecode.Attribute.get(method, "definition")); ! if (attr == null) // this must be a toplevel function, a constructor, ... return; ! String fullName = new String(attr.data); registerJavaMethod(fullName); ! attr = cast(gnu.bytecode.Attribute.get(method, "patterns")); if (attr == null) throw Internal.error("Method " + method.getName() + --- 376,389 ---- public void readImportedAlternative(gnu.bytecode.ClassType c, gnu.bytecode.Method method, Location location) { ! ?gnu.bytecode.MiscAttr defattr = cast(gnu.bytecode.Attribute.get(method, "definition")); ! if (defattr == null) // this must be a toplevel function, a constructor, ... return; ! String fullName = new String(defattr.data); registerJavaMethod(fullName); ! ?gnu.bytecode.MiscAttr attr = cast(gnu.bytecode.Attribute.get(method, "patterns")); if (attr == null) throw Internal.error("Method " + method.getName() + Index: constructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/constructor.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** constructor.nice 14 Jan 2005 16:41:27 -0000 1.8 --- constructor.nice 16 Jan 2005 21:51:15 -0000 1.9 *************** *** 137,163 **** { List<Parameter> missing = new LinkedList(); - Iterator<Parameter> reqParams = parameters.getRequiredParameters().iterator(); int lastUsedPositional = -1; ! while(reqParams.hasNext()) { boolean found = false; - let param = reqParams.next(); if (param.value() != null) continue; if (param instanceof NamedParameter) { ! for (int i = 0; i < args.arguments.length; i++) ! if (args.arguments[i].name != null) ! { ! String s = notNull(args.arguments[i].name).toString(); ! if (param.match(s)) ! { ! found = true; ! break; ! } ! } } else { ! for(int i = lastUsedPositional + 1; i <args.arguments.length; i++) { if (args.arguments[i].name == null) --- 137,153 ---- { List<Parameter> missing = new LinkedList(); int lastUsedPositional = -1; ! for (param : parameters.getRequiredParameters()) { boolean found = false; if (param.value() != null) continue; if (param instanceof NamedParameter) { ! if (args.getNames().any(String n => param.match(n))) ! found = true; } else { ! for (int i = lastUsedPositional + 1; i <args.arguments.size(); i++) { if (args.arguments[i].name == null) *************** *** 172,175 **** --- 162,166 ---- missing.add(param); } + return missing; } |
From: Arjan B. <ar...@us...> - 2005-01-16 21:51:26
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3874/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Conversion cleanup part 4. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.306 retrieving revision 1.307 diff -C2 -d -r1.306 -r1.307 *** Parser.jj 16 Jan 2005 00:28:20 -0000 1.306 --- Parser.jj 16 Jan 2005 21:51:14 -0000 1.307 *************** *** 1698,1702 **** ( { Arguments arguments; } ! arguments = arguments(false) { e = bossa.syntax.fun.createNewExp(classe, arguments); e.setLocation(makeLocation(t)); --- 1698,1702 ---- ( { Arguments arguments; } ! arguments = arguments() { e = bossa.syntax.fun.createNewExp(classe, arguments); e.setLocation(makeLocation(t)); *************** *** 2242,2255 **** ( "," res=Expression() {bracketArgs.add(new Argument(res));} )* "]" ! { return bossa.syntax.dispatch.createCallExp(symb("get",t,false),bossa.syntax.dispatch.createArguments(bracketArgs)); } | "." res=identExp() [ LOOKAHEAD(1) // a.f(x) is parsed as f(a, x), not as (f(a))(x) ! args = arguments(true) ] { boolean hasBrackets = args != null; if (args == null) ! args = new Arguments(new Argument[]{new Argument(start)}); else args.addReceiver(start); --- 2242,2255 ---- ( "," res=Expression() {bracketArgs.add(new Argument(res));} )* "]" ! { return bossa.syntax.dispatch.createCallExp(symb("get",t,false),new Arguments(bracketArgs)); } | "." res=identExp() [ LOOKAHEAD(1) // a.f(x) is parsed as f(a, x), not as (f(a))(x) ! args = arguments() ] { boolean hasBrackets = args != null; if (args == null) ! args = bossa.syntax.dispatch.createArguments(new Argument[]{new Argument(start)}); else args.addReceiver(start); *************** *** 2258,2262 **** } | ! args = arguments(false) { return bossa.syntax.dispatch.createCallExp(start, args); } } --- 2258,2262 ---- } | ! args = arguments() { return bossa.syntax.dispatch.createCallExp(start, args); } } *************** *** 2299,2303 **** { (t="@") ! { return bossa.syntax.dispatch.createCallExp(symb(t), new Arguments(new Argument[0])); } } --- 2299,2303 ---- { (t="@") ! { return bossa.syntax.dispatch.createCallExp(symb(t), bossa.syntax.dispatch.createArguments(new Argument[0])); } } *************** *** 2351,2355 **** } ! Arguments arguments(boolean leaveRoomForReceiver): { List res = new ArrayList(); --- 2351,2355 ---- } ! Arguments arguments(): { List res = new ArrayList(); *************** *** 2358,2362 **** { "(" - { if (leaveRoomForReceiver) res.add(null); } [ a = argument() { res.add(a); } --- 2358,2361 ---- *************** *** 2364,2368 **** ] ")" ! { return bossa.syntax.dispatch.createArguments(res); } } --- 2363,2367 ---- ] ")" ! { return new Arguments(res); } } |
From: Daniel B. <bo...@us...> - 2005-01-16 01:03:58
|
Update of /cvsroot/nice/Nice/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6709/bin Modified Files: niceunit.bat nicedoc.bat niceclasspath.bat nicec.bat Log Message: Added quotes around classpathes (fixes #1102993). Index: nicec.bat =================================================================== RCS file: /cvsroot/nice/Nice/bin/nicec.bat,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** nicec.bat 30 Jul 2004 15:38:45 -0000 1.18 --- nicec.bat 16 Jan 2005 01:03:35 -0000 1.19 *************** *** 15,19 **** :gotNice ! java -Xms8M -classpath %NICEPATH%\nice.jar;%CLASSPATH% nice.tools.compiler.console.dispatch --runtime=%NICEPATH%\nice.jar %1 %2 %3 %4 %5 %6 %7 %8 %9 :end --- 15,19 ---- :gotNice ! java -Xms8M -classpath "%NICEPATH%\nice.jar;%CLASSPATH%" nice.tools.compiler.console.dispatch --runtime="%NICEPATH%\nice.jar" %1 %2 %3 %4 %5 %6 %7 %8 %9 :end Index: niceclasspath.bat =================================================================== RCS file: /cvsroot/nice/Nice/bin/niceclasspath.bat,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** niceclasspath.bat 16 Feb 2004 13:52:57 -0000 1.1 --- niceclasspath.bat 16 Jan 2005 01:03:35 -0000 1.2 *************** *** 8,27 **** set NICEPATH=c:\nice ! if exist %NICEPATH%\nice.jar goto end set NICEPATH="c:\Program Files\nice" ! if exist %NICEPATH%\nice.jar goto end set NICEPATH=c:\programs\nice ! if exist %NICEPATH%\nice.jar goto end set NICEPATH=d:\nice ! if exist %NICEPATH%\nice.jar goto end set NICEPATH="d:\Program Files\nice" ! if exist %NICEPATH%\nice.jar goto end set NICEPATH=d:\programs\nice ! if exist %NICEPATH%\nice.jar goto end goto error --- 8,27 ---- set NICEPATH=c:\nice ! if exist "%NICEPATH%\nice.jar" goto end set NICEPATH="c:\Program Files\nice" ! if exist "%NICEPATH%\nice.jar" goto end set NICEPATH=c:\programs\nice ! if exist "%NICEPATH%\nice.jar" goto end set NICEPATH=d:\nice ! if exist "%NICEPATH%\nice.jar" goto end set NICEPATH="d:\Program Files\nice" ! if exist "%NICEPATH%\nice.jar" goto end set NICEPATH=d:\programs\nice ! if exist "%NICEPATH%\nice.jar" goto end goto error *************** *** 39,43 **** :gotNiceEnvVar ! if not exist %NICE%\nice.jar goto envError set NICEPATH=%NICE% --- 39,43 ---- :gotNiceEnvVar ! if not exist "%NICE%\nice.jar" goto envError set NICEPATH=%NICE% Index: nicedoc.bat =================================================================== RCS file: /cvsroot/nice/Nice/bin/nicedoc.bat,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** nicedoc.bat 30 Jul 2004 15:38:45 -0000 1.2 --- nicedoc.bat 16 Jan 2005 01:03:35 -0000 1.3 *************** *** 15,19 **** :gotNice ! java -classpath %NICEPATH%\nice.jar;%CLASSPATH% nice.tools.doc.dispatch %1 %2 %3 %4 %5 %6 %7 %8 %9 :end --- 15,19 ---- :gotNice ! java -classpath "%NICEPATH%\nice.jar;%CLASSPATH%" nice.tools.doc.dispatch %1 %2 %3 %4 %5 %6 %7 %8 %9 :end Index: niceunit.bat =================================================================== RCS file: /cvsroot/nice/Nice/bin/niceunit.bat,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** niceunit.bat 30 Jul 2004 15:38:45 -0000 1.2 --- niceunit.bat 16 Jan 2005 01:03:34 -0000 1.3 *************** *** 15,19 **** :gotNice ! java -classpath %NICEPATH%\nice.jar;%CLASSPATH% nice.tools.unit.console.dispatch %1 %2 %3 %4 %5 %6 %7 %8 %9 :end --- 15,19 ---- :gotNice ! java -classpath "%NICEPATH%\nice.jar;%CLASSPATH%" nice.tools.unit.console.dispatch %1 %2 %3 %4 %5 %6 %7 %8 %9 :end |
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30903/F:/nice/src/bossa/syntax Modified Files: ai.nice alternative.nice analyse.nice assign.nice block.nice call.nice constant.nice constraint.nice customConstructor.nice enum.nice exceptions.nice formalParameters.nice funexp.nice globalvar.nice inline.nice javaMethod.nice javaclass.nice locals.nice loop.nice methodContainer.nice methodImplementation.nice methodbody.nice monotype.nice newarray.nice niceMethod.nice niceclass.nice nicefield.nice overloadedsymbol.nice pattern.nice retypedMethod.nice rewrite.nice super.nice symbol.nice tools.nice try.nice tuple.nice typeConstructors.nice typeIdent.nice typecheck.nice typedef.nice Log Message: Conversion cleanup part 3. Index: typeIdent.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typeIdent.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** typeIdent.nice 14 Jan 2005 16:41:28 -0000 1.5 --- typeIdent.nice 16 Jan 2005 00:28:21 -0000 1.6 *************** *** 89,93 **** return res; ! if (res instanceof TypeConstructor) { let def = getTypeDefinition(res); --- 89,93 ---- return res; ! if (res instanceof mlsub.typing.TypeConstructor) { let def = getTypeDefinition(res); Index: constraint.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/constraint.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** constraint.nice 10 Jan 2005 23:58:04 -0000 1.2 --- constraint.nice 16 Jan 2005 00:28:21 -0000 1.3 *************** *** 23,27 **** public class Constraint extends Node { ! private List<TypeSymbol> binders; private List<AtomicConstraint> atomics; --- 23,27 ---- public class Constraint extends Node { ! private List<mlsub.typing.TypeSymbol> binders; private List<AtomicConstraint> atomics; *************** *** 60,72 **** while (i.hasNext()) { ! TypeSymbol s = i.next(); ! if (!(s instanceof TypeConstructor)) // Handle the ! constraint { ! MonotypeVar mv = cast(s); let j = c.atomics.iterator(); while (j.hasNext()) { ! AtomicConstraint atom = j.next(); if (atom.isSureConstraintFor(mv)) { --- 60,72 ---- while (i.hasNext()) { ! let s = i.next(); ! if (!(s instanceof mlsub.typing.TypeConstructor)) // Handle the ! constraint { ! mlsub.typing.MonotypeVar mv = cast(s); let j = c.atomics.iterator(); while (j.hasNext()) { ! let atom = j.next(); if (atom.isSureConstraintFor(mv)) { *************** *** 85,89 **** } ! TypeConstructor tc = s; boolean ok = false; let j = c.atomics.iterator(); --- 85,89 ---- } ! let tc = s; boolean ok = false; let j = c.atomics.iterator(); *************** *** 117,121 **** Add the binder to the front of the list of binders. */ ! void addFirstBinder(TypeSymbol s) { binders.add(0, s); --- 117,121 ---- Add the binder to the front of the list of binders. */ ! void addFirstBinder(mlsub.typing.TypeSymbol s) { binders.add(0, s); *************** *** 126,130 **** Add the binder if it is not already there. */ ! void addBinder(TypeSymbol s) { if (!binders.contains(s)) --- 126,130 ---- Add the binder if it is not already there. */ ! void addBinder(mlsub.typing.TypeSymbol s) { if (!binders.contains(s)) *************** *** 140,144 **** * @param b a collection of TypeSymbol */ ! void addBinders(TypeSymbol[?] bs) { if (bs==null) --- 140,144 ---- * @param b a collection of TypeSymbol */ ! void addBinders(mlsub.typing.TypeSymbol[?] bs) { if (bs==null) *************** *** 161,165 **** public boolean isTrivial() = binders.isEmpty() && atomics.isEmpty(); ! List<TypeSymbol> getBinders() = binders; List<AtomicConstraint> getAtoms() = atomics; } --- 161,165 ---- public boolean isTrivial() = binders.isEmpty() && atomics.isEmpty(); ! List<mlsub.typing.TypeSymbol> getBinders() = binders; List<AtomicConstraint> getAtoms() = atomics; } *************** *** 171,175 **** * @param atomics a collection of AtomicConstraints */ ! public Constraint createConstraint(?List<TypeSymbol> binders, ?List<AtomicConstraint> atomics) { if (binders == null && atomics == null) --- 171,175 ---- * @param atomics a collection of AtomicConstraints */ ! public Constraint createConstraint(?List<mlsub.typing.TypeSymbol> binders, ?List<AtomicConstraint> atomics) { if (binders == null && atomics == null) *************** *** 301,305 **** */ ! public class TypeConstructorLeqCst extends bossa.syntax.AtomicConstraint { mlsub.typing.TypeConstructor t1; --- 301,305 ---- */ ! public class TypeConstructorLeqCst extends AtomicConstraint { mlsub.typing.TypeConstructor t1; *************** *** 354,361 **** 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"); --- 354,360 ---- resolve(scope) { ! let stc = tc.resolveToTC(scope); ! let sitf = itf.resolveToTypeSymbol(scope); ! if (! (sitf instanceof mlsub.typing.Interface)) throw User.error(itf, itf+" should be an interface"); Index: block.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/block.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** block.nice 20 Dec 2004 13:56:16 -0000 1.3 --- block.nice 16 Jan 2005 00:28:21 -0000 1.4 *************** *** 91,98 **** } - /**************************************************************** - * Code generation - ****************************************************************/ - generateCode() { --- 91,94 ---- *************** *** 130,137 **** } - /**************************************************************** - * Printing - ****************************************************************/ - toString() { --- 126,129 ---- *************** *** 144,148 **** } ! public Statement createBlock(List<Statement> statements) { let res = new Block(statements: cast(null)); --- 136,140 ---- } ! public Block createBlock(List<Statement> statements) { let res = new Block(statements: cast(null)); Index: funexp.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/funexp.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** funexp.nice 13 Jan 2005 14:06:15 -0000 1.7 --- funexp.nice 16 Jan 2005 00:28:21 -0000 1.8 *************** *** 39,45 **** public class FunExp extends Expression implements Function { - final MonoSymbol[] formals; ! ?bossa.syntax.Constraint constraint; final Statement body; --- 39,44 ---- public class FunExp extends Expression implements Function { final MonoSymbol[] formals; ! ?Constraint constraint; final Statement body; *************** *** 50,54 **** private ?mlsub.typing.Polytype _inferredReturnType = null; - getExpectedType() { --- 49,52 ---- *************** *** 110,117 **** } - /**************************************************************** - * Code generation - ****************************************************************/ - compile() { --- 108,111 ---- Index: tuple.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tuple.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tuple.nice 15 Jan 2005 20:27:33 -0000 1.5 --- tuple.nice 16 Jan 2005 00:28:21 -0000 1.6 *************** *** 18,22 **** A tuple of types. */ ! public class TupleType extends bossa.syntax.Monotype { List<Monotype> types; --- 18,22 ---- A tuple of types. */ ! public class TupleType extends Monotype { List<Monotype> types; *************** *** 28,32 **** substitute(map) { ! bossa.syntax.Monotype res = new bossa.syntax.TupleType ( types : types.mapToArray(Monotype t => t.substitute(map)), location : location); res.nullness = this.nullness; --- 28,32 ---- substitute(map) { ! Monotype res = new TupleType ( types : types.mapToArray(Monotype t => t.substitute(map)), location : location); res.nullness = this.nullness; *************** *** 44,50 **** Creation of a tuple. */ ! public class TupleExp extends bossa.syntax.Expression { ! final bossa.syntax.Expression[] expressions; private mlsub.typing.Monotype[?] components = null; private mlsub.typing.Monotype[?] expectedComponents= null; --- 44,50 ---- Creation of a tuple. */ ! public class TupleExp extends Expression { ! final Expression[] expressions; private mlsub.typing.Monotype[?] components = null; private mlsub.typing.Monotype[?] expectedComponents= null; *************** *** 88,93 **** // Do the same for the elements of the tuple, since they might be // tuples themselves, literal arrays, ... ! bossa.syntax.Expression.adjustToExpectedType ! (expressions, expectedComponents); } } --- 88,92 ---- // Do the same for the elements of the tuple, since they might be // tuples themselves, literal arrays, ... ! Expression.adjustToExpectedType(expressions, expectedComponents); } } *************** *** 103,107 **** computeType() { ! let types = bossa.syntax.Expression.getType(expressions); // should create a new <tt>and</tt> method without the last dummy parameters let cst = mlsub.typing.Constraint.and(mlsub.typing.Polytype.getConstraint(types), --- 102,106 ---- computeType() { ! let types = Expression.getType(expressions); // should create a new <tt>and</tt> method without the last dummy parameters let cst = mlsub.typing.Constraint.and(mlsub.typing.Polytype.getConstraint(types), *************** *** 184,188 **** } ! public new TupleExp(List<bossa.syntax.Expression> expressions) { this(expressions: toArray(expressions)); --- 183,187 ---- } ! public new TupleExp(List<Expression> expressions) { this(expressions: toArray(expressions)); Index: javaclass.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/javaclass.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** javaclass.nice 13 Jan 2005 23:56:06 -0000 1.5 --- javaclass.nice 16 Jan 2005 00:28:21 -0000 1.6 *************** *** 85,90 **** * associated TypeConstructor in which case it is returned. */ ! ?TypeConstructor setTypeConstructorForJavaClass ! (bossa.modules.Compilation compilation, TypeConstructor tc, gnu.bytecode.Type type) = compilation.javaTypeConstructors.put(type, tc); --- 85,90 ---- * associated TypeConstructor in which case it is returned. */ ! ?mlsub.typing.TypeConstructor setTypeConstructorForJavaClass ! (bossa.modules.Compilation compilation, mlsub.typing.TypeConstructor tc, gnu.bytecode.Type type) = compilation.javaTypeConstructors.put(type, tc); *************** *** 105,109 **** } ! boolean excludedInterface(TypeConstructor itf) { ?gnu.bytecode.Type t = nice.tools.code.Types.get(itf); --- 105,109 ---- } ! boolean excludedInterface(mlsub.typing.TypeConstructor itf) { ?gnu.bytecode.Type t = nice.tools.code.Types.get(itf); *************** *** 114,118 **** } ! TypeConstructor createJavaType(bossa.modules.Compilation compilation, String className, gnu.bytecode.Type javaType) { --- 114,118 ---- } ! mlsub.typing.TypeConstructor createJavaType(bossa.modules.Compilation compilation, String className, gnu.bytecode.Type javaType) { *************** *** 123,129 **** // (thus used at link test with an error) // these late TCs should be avoided ! boolean instantiable = !Typing.isInRigidContext() && instantiable(javaType); ! TypeConstructor res = new TypeConstructor(className, null, instantiable, true); let old = compilation.javaTypeConstructors.put(javaType, res); --- 123,129 ---- // (thus used at link test with an error) // these late TCs should be avoided ! boolean instantiable = !mlsub.typing.Typing.isInRigidContext() && instantiable(javaType); ! let res = new mlsub.typing.TypeConstructor(className, null, instantiable, true); let old = compilation.javaTypeConstructors.put(javaType, res); *************** *** 133,137 **** nice.tools.code.Types.set(res, javaType); ! if(Typing.isInRigidContext()) // We should not add new classes at this point. // It doesn't matter, as this type is not used explicitely. --- 133,137 ---- nice.tools.code.Types.set(res, javaType); ! if(mlsub.typing.Typing.isInRigidContext()) // We should not add new classes at this point. // It doesn't matter, as this type is not used explicitely. *************** *** 143,147 **** } ! Typing.introduce(res); // Recursive search for java super-classes --- 143,147 ---- } ! mlsub.typing.Typing.introduce(res); // Recursive search for java super-classes *************** *** 159,166 **** { try { ! TypeConstructor superTC = nice.tools.code.Types.typeConstructor(superClass); ! Typing.initialLeq(res, superTC); } ! catch(TypingEx e) { Internal.warning("Invalid java super-class "+superClass+" for "+className); } --- 159,166 ---- { try { ! let superTC = nice.tools.code.Types.typeConstructor(superClass); ! mlsub.typing.Typing.initialLeq(res, superTC); } ! catch(mlsub.typing.TypingEx e) { Internal.warning("Invalid java super-class "+superClass+" for "+className); } *************** *** 187,194 **** try { ! TypeConstructor superTC = nice.tools.code.Types.typeConstructor(itf); ! Typing.initialLeq(res, superTC); } ! catch(TypingEx e) { Internal.warning(res+" cannot implement " + itf /* + ": " + e.toString()*/); } --- 187,194 ---- try { ! let superTC = nice.tools.code.Types.typeConstructor(itf); ! mlsub.typing.Typing.initialLeq(res, superTC); } ! catch(mlsub.typing.TypingEx e) { Internal.warning(res+" cannot implement " + itf /* + ": " + e.toString()*/); } *************** *** 212,220 **** } ! void setArity(TypeConstructor tc, int arity) { try { ! Variance variance = arity == 0 ? ! Variance.empty() : Variance.make(new int[arity]); mlsub.typing.lowlevel.Engine.setKind(tc, variance.getConstraint()); } --- 212,220 ---- } ! void setArity(mlsub.typing.TypeConstructor tc, int arity) { try { ! let variance = arity == 0 ? ! mlsub.typing.Variance.empty() : mlsub.typing.Variance.make(new int[arity]); mlsub.typing.lowlevel.Engine.setKind(tc, variance.getConstraint()); } *************** *** 234,245 **** } ! ?TypeConstructor lookupJavaClass(String className, ?Location loc) { ! ?gnu.bytecode.Type classType = nice.tools.code.TypeImport.lookup(className, loc); if (classType == null) return null; ! bossa.modules.Compilation compilation = notNull(Node.compilation); if (compilation.javaTypeConstructors.containsKey(classType)) --- 234,245 ---- } ! ?mlsub.typing.TypeConstructor lookupJavaClass(String className, ?Location loc) { ! let classType = nice.tools.code.TypeImport.lookup(className, loc); if (classType == null) return null; ! let compilation = notNull(Node.compilation); if (compilation.javaTypeConstructors.containsKey(classType)) Index: niceclass.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceclass.nice,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** niceclass.nice 14 Jan 2005 22:47:11 -0000 1.21 --- niceclass.nice 16 Jan 2005 00:28:21 -0000 1.22 *************** *** 215,219 **** try { ! Typing.leq(value.getType(), declaredType); } catch (mlsub.typing.TypingEx ex) { --- 215,219 ---- try { ! mlsub.typing.Typing.leq(value.getType(), declaredType); } catch (mlsub.typing.TypingEx ex) { *************** *** 326,330 **** mlsub.typing.Typing.leave(); } ! catch(TypingEx ex) { User.error(this.definition, "Type error in field declarations"); } --- 326,330 ---- mlsub.typing.Typing.leave(); } ! catch(mlsub.typing.TypingEx ex) { User.error(this.definition, "Type error in field declarations"); } *************** *** 393,397 **** */ private List<(?MethodDeclaration, List<Parameter>)> ! getNativeConstructorParameters(TypeConstructor tc) { let constructors = getConstructors(tc); --- 393,397 ---- */ private List<(?MethodDeclaration, List<Parameter>)> ! getNativeConstructorParameters(mlsub.typing.TypeConstructor tc) { let constructors = getConstructors(tc); *************** *** 433,437 **** { TypeScope scope = Node.getGlobalTypeScope(); ! ?Map<TypeSymbol,TypeSymbol> map = null; if (typeParameters != null) --- 433,437 ---- { TypeScope scope = Node.getGlobalTypeScope(); ! ?Map<mlsub.typing.TypeSymbol,mlsub.typing.TypeSymbol> map = null; if (typeParameters != null) *************** *** 444,449 **** for (int i = 0; i < ourTypeParameters.length; i++) try { ! TypeSymbol ourSym = asTypeSymbol(ourTypeParameters[i]); ! TypeSymbol sym = asTypeSymbol(typeParameters[i]); scope.addMapping(ourSym.toString(), sym); notNull(map).put(ourSym, sym); --- 444,449 ---- for (int i = 0; i < ourTypeParameters.length; i++) try { ! let ourSym = asTypeSymbol(ourTypeParameters[i]); ! let sym = asTypeSymbol(typeParameters[i]); scope.addMapping(ourSym.toString(), sym); notNull(map).put(ourSym, sym); *************** *** 751,757 **** NiceClass createNiceClass(TypeDefinition cdef) = new NiceClass(definition: cdef); ! private TypeSymbol asTypeSymbol(mlsub.typing.Monotype type) { ! if (type instanceof TypeSymbol) return type; --- 751,757 ---- NiceClass createNiceClass(TypeDefinition cdef) = new NiceClass(definition: cdef); ! private mlsub.typing.TypeSymbol asTypeSymbol(mlsub.typing.Monotype type) { ! if (type instanceof mlsub.typing.TypeSymbol) return type; *************** *** 760,764 **** } ! private gnu.expr.Expression typeExpression(TypeConstructor tc) { let c = getTypeDefinition(tc); --- 760,764 ---- } ! private gnu.expr.Expression typeExpression(mlsub.typing.TypeConstructor tc) { let c = getTypeDefinition(tc); *************** *** 772,776 **** } ! ?NiceClass getNiceClass(TypeConstructor tc) { let res = getTypeDefinition(tc); --- 772,776 ---- } ! ?NiceClass getNiceClass(mlsub.typing.TypeConstructor tc) { let res = getTypeDefinition(tc); Index: javaMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/javaMethod.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** javaMethod.nice 14 Jan 2005 22:47:11 -0000 1.7 --- javaMethod.nice 16 Jan 2005 00:28:21 -0000 1.8 *************** *** 208,212 **** * to make them available to the nice code. */ ! void fetchMethods(TypeConstructor tc, gnu.bytecode.ClassType classType) { try { --- 208,212 ---- * to make them available to the nice code. */ ! void fetchMethods(mlsub.typing.TypeConstructor tc, gnu.bytecode.ClassType classType) { try { *************** *** 238,242 **** } ! void fetchMethod(gnu.bytecode.Method m, TypeConstructor tc, gnu.bytecode.ClassType classType) { if (m.isConstructor()) --- 238,242 ---- } ! void fetchMethod(gnu.bytecode.Method m, mlsub.typing.TypeConstructor tc, gnu.bytecode.ClassType classType) { if (m.isConstructor()) Index: rewrite.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/rewrite.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** rewrite.nice 14 Jan 2005 22:47:11 -0000 1.8 --- rewrite.nice 16 Jan 2005 00:28:21 -0000 1.9 *************** *** 11,14 **** --- 11,16 ---- /**************************************************************************/ + package bossa.syntax; + /* Rewriting on the abstract syntax tree. *************** *** 30,35 **** */ - package bossa.syntax; - Statement rewrite(Statement); rewrite(Statement s) = s; --- 32,35 ---- *************** *** 69,73 **** ifExp(ExpressionStmt s) { ! if (s.exp instanceof bossa.syntax.IfExp) return cast(s.exp); else --- 69,73 ---- ifExp(ExpressionStmt s) { ! if (s.exp instanceof IfExp) return cast(s.exp); else Index: retypedMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/retypedMethod.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** retypedMethod.nice 14 Jan 2005 16:41:27 -0000 1.5 --- retypedMethod.nice 16 Jan 2005 00:28:21 -0000 1.6 *************** *** 270,274 **** void registerNativeConstructor(RetypedJavaMethod m, gnu.bytecode.Method reflectMethod, ! TypeConstructor classe) { ?MethodDeclaration auto = retyped.put(reflectMethod, m); --- 270,274 ---- void registerNativeConstructor(RetypedJavaMethod m, gnu.bytecode.Method reflectMethod, ! mlsub.typing.TypeConstructor classe) { ?MethodDeclaration auto = retyped.put(reflectMethod, m); Index: niceMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceMethod.nice,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** niceMethod.nice 14 Jan 2005 16:41:27 -0000 1.17 --- niceMethod.nice 16 Jan 2005 00:28:21 -0000 1.18 *************** *** 279,284 **** if (hasAlike || tc == null) { ! TypeConstructor alikeTC = ! new TypeConstructor("Alike", c.variance, false, false); // Add in front. Important for rebinding in method alternatives --- 279,283 ---- if (hasAlike || tc == null) { ! let alikeTC = new mlsub.typing.TypeConstructor("Alike", c.variance, false, false); // Add in front. Important for rebinding in method alternatives *************** *** 299,303 **** if (hasAlike) { ! Map<String, bossa.syntax.Monotype> map = new HashMap(); map.put(getAlikeID(), createMonotypeConstructor(alikeTC, --- 298,302 ---- if (hasAlike) { ! Map<String, Monotype> map = new HashMap(); map.put(getAlikeID(), createMonotypeConstructor(alikeTC, Index: pattern.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/pattern.nice,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** pattern.nice 14 Jan 2005 22:47:11 -0000 1.17 --- pattern.nice 16 Jan 2005 00:28:21 -0000 1.18 *************** *** 44,48 **** if (typeConstructor != null) { ! TypeSymbol sym = notNull(typeConstructor).resolveToTypeSymbol(scope); if (sym instanceof mlsub.typing.TypeConstructor) --- 44,48 ---- if (typeConstructor != null) { ! let sym = notNull(typeConstructor).resolveToTypeSymbol(scope); if (sym instanceof mlsub.typing.TypeConstructor) *************** *** 62,66 **** if (additional != null) { ! TypeSymbol sym = notNull(additional).resolveToTypeSymbol(scope); if (sym instanceof mlsub.typing.TypeConstructor) --- 62,66 ---- if (additional != null) { ! let sym = notNull(additional).resolveToTypeSymbol(scope); if (sym instanceof mlsub.typing.TypeConstructor) *************** *** 351,355 **** // don't allow integer primitive types in @type and #type patterns ! if (!equal && Typing.testRigidLeq(tc, nice.tools.typing.PrimitiveType.longTC)) User.error(this.location, "A pattern cannot have a primitive type that is different from the declaration."); --- 351,355 ---- // don't allow integer primitive types in @type and #type patterns ! if (!equal && mlsub.typing.Typing.testRigidLeq(tc, nice.tools.typing.PrimitiveType.longTC)) User.error(this.location, "A pattern cannot have a primitive type that is different from the declaration."); *************** *** 395,399 **** { if (domaintc != null) ! if ( Typing.testRigidLeq(domaintc, nice.tools.typing.PrimitiveType.charTC)) return; --- 395,399 ---- { if (domaintc != null) ! if (mlsub.typing.Typing.testRigidLeq(domaintc, nice.tools.typing.PrimitiveType.charTC)) return; *************** *** 410,419 **** if (domaintc != null) { ! if (Typing.testRigidLeq(domaintc, nice.tools.typing.PrimitiveType.intTC)) { tc = nice.tools.typing.PrimitiveType.intTC; return; } ! else if (Typing.testRigidLeq(domaintc, nice.tools.typing.PrimitiveType.longTC)) { tc = nice.tools.typing.PrimitiveType.longTC; --- 410,419 ---- if (domaintc != null) { ! if (mlsub.typing.Typing.testRigidLeq(domaintc, nice.tools.typing.PrimitiveType.intTC)) { tc = nice.tools.typing.PrimitiveType.intTC; return; } ! else if (mlsub.typing.Typing.testRigidLeq(domaintc, nice.tools.typing.PrimitiveType.longTC)) { tc = nice.tools.typing.PrimitiveType.longTC; *************** *** 556,560 **** return this.exactlyAt || ! that.exactlyAt; ! return Typing.testRigidLeq(this.tc, that.tc); } leq(Pattern this, Pattern that) --- 556,560 ---- return this.exactlyAt || ! that.exactlyAt; ! return mlsub.typing.Typing.testRigidLeq(this.tc, that.tc); } leq(Pattern this, Pattern that) *************** *** 563,567 **** return true; ! return Typing.testRigidLeq(this.tc, that.tc); } --- 563,567 ---- return true; ! return mlsub.typing.Typing.testRigidLeq(this.tc, that.tc); } *************** *** 604,609 **** if (isClassTC(notNull(this.tc)) && isClassTC(notNull(that.tc))) ! return (! Typing.testRigidLeq(this.tc, that.tc)) && ! (! Typing.testRigidLeq(that.tc, this.tc)); //TODO: check disjoints for all tc's with a <T | T <: TC_PA, T <: TC_PB> constraint --- 604,609 ---- if (isClassTC(notNull(this.tc)) && isClassTC(notNull(that.tc))) ! return (! mlsub.typing.Typing.testRigidLeq(this.tc, that.tc)) && ! (! mlsub.typing.Typing.testRigidLeq(that.tc, this.tc)); //TODO: check disjoints for all tc's with a <T | T <: TC_PA, T <: TC_PB> constraint *************** *** 614,619 **** { if (isClassTC(notNull(this.tc)) && isClassTC(notNull(that.tc))) ! return (! Typing.testRigidLeq(this.tc, that.tc)) && ! (! Typing.testRigidLeq(that.tc, this.tc)); //TODO: check disjoints for all tc's with a <T | T <: TC_PA, T <: TC_PB> constraint --- 614,619 ---- { if (isClassTC(notNull(this.tc)) && isClassTC(notNull(that.tc))) ! return (! mlsub.typing.Typing.testRigidLeq(this.tc, that.tc)) && ! (! mlsub.typing.Typing.testRigidLeq(that.tc, this.tc)); //TODO: check disjoints for all tc's with a <T | T <: TC_PA, T <: TC_PB> constraint *************** *** 716,720 **** { ConstantExp val = cast(symbol.getValue()); ! if (Typing.testRigidLeq(val.tc, nice.tools.typing.PrimitiveType.longTC)) return createPattern(pattern.kind.prefix, pattern.name, val, null, pattern.location); } --- 716,720 ---- { ConstantExp val = cast(symbol.getValue()); ! if (mlsub.typing.Typing.testRigidLeq(val.tc, nice.tools.typing.PrimitiveType.longTC)) return createPattern(pattern.kind.prefix, pattern.name, val, null, pattern.location); } *************** *** 860,864 **** return createPattern(createBooleanConstant(name.equals("true"), loc)); ! ?TypeSymbol sym = Node.getGlobalTypeScope().lookup(name); if (sym == null) --- 860,864 ---- return createPattern(createBooleanConstant(name.equals("true"), loc)); ! let sym = Node.getGlobalTypeScope().lookup(name); if (sym == null) Index: formalParameters.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/formalParameters.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** formalParameters.nice 13 Jan 2005 16:47:34 -0000 1.6 --- formalParameters.nice 16 Jan 2005 00:28:21 -0000 1.7 *************** *** 70,74 **** } ! void substitute(Map<java.lang.String, bossa.syntax.Monotype> map) { for (int i = size; --i>=0; ) --- 70,74 ---- } ! void substitute(Map<java.lang.String, Monotype> map) { for (int i = size; --i>=0; ) Index: super.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/super.nice,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** super.nice 14 Jan 2005 22:47:11 -0000 1.11 --- super.nice 16 Jan 2005 00:28:21 -0000 1.12 *************** *** 131,139 **** for (int i = 0; i < p.length; i++) if (p[i].tc != null) ! newAtoms.add(new TypeConstructorLeqMonotypeCst(p[i].tc, m[i])); } else { ! ?TypeConstructor superTC = null; try { superTC = nice.tools.code.Types.typeConstructor(notNull(superMethod).getDeclaringClass()); --- 131,139 ---- for (int i = 0; i < p.length; i++) if (p[i].tc != null) ! newAtoms.add(new mlsub.typing.TypeConstructorLeqMonotypeCst(p[i].tc, m[i])); } else { ! ?mlsub.typing.TypeConstructor superTC = null; try { superTC = nice.tools.code.Types.typeConstructor(notNull(superMethod).getDeclaringClass()); *************** *** 142,146 **** if (superTC != null) ! newAtoms.add(new TypeConstructorLeqMonotypeCst(superTC, m[0])); else // Our safe bet is to assert that the argument is Object. --- 142,146 ---- if (superTC != null) ! newAtoms.add(new mlsub.typing.TypeConstructorLeqMonotypeCst(superTC, m[0])); else // Our safe bet is to assert that the argument is Object. Index: customConstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/customConstructor.nice,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** customConstructor.nice 14 Jan 2005 22:47:11 -0000 1.19 --- customConstructor.nice 16 Jan 2005 00:28:21 -0000 1.20 *************** *** 82,86 **** } ! private Map<String, Monotype> typeParamMap(TypeSymbol[] source, mlsub.typing.Monotype[] destination) { Map<String, Monotype> res = new HashMap(source.length); --- 82,86 ---- } ! private Map<String, Monotype> typeParamMap(mlsub.typing.TypeSymbol[] source, mlsub.typing.Monotype[] destination) { Map<String, Monotype> res = new HashMap(source.length); *************** *** 170,174 **** return classe; ! List<TypeSymbol> syms = cst.getBinders(); Monotype[] params = cast(new Monotype[syms.size()]); --- 170,174 ---- return classe; ! List<mlsub.typing.TypeSymbol> syms = cst.getBinders(); Monotype[] params = cast(new Monotype[syms.size()]); Index: globalvar.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/globalvar.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** globalvar.nice 14 Jan 2005 22:47:11 -0000 1.5 --- globalvar.nice 16 Jan 2005 00:28:21 -0000 1.6 *************** *** 35,41 **** value = value.resolveOverloading(left.getType()); typecheck(value); ! Typing.leq(value.getType(),left.getType()); } ! catch(TypingEx e){ User.error(this,"Typing error : "+left+" cannot be assigned value "+value+ " of type "+value.getType()+" : \n"+ --- 35,41 ---- value = value.resolveOverloading(left.getType()); typecheck(value); ! mlsub.typing.Typing.leq(value.getType(),left.getType()); } ! catch(mlsub.typing.TypingEx e){ User.error(this,"Typing error : "+left+" cannot be assigned value "+value+ " of type "+value.getType()+" : \n"+ Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** typecheck.nice 15 Jan 2005 20:27:33 -0000 1.123 --- typecheck.nice 16 Jan 2005 00:28:21 -0000 1.124 *************** *** 17,22 **** package bossa.syntax; - import mlsub.typing.*; - // Interface --- 17,20 ---- *************** *** 55,59 **** checkAssignment(to.getType(), e.value); } ! catch(TypingEx t){ if (variable != null) { let originalType = getOriginalType(variable); --- 53,57 ---- checkAssignment(to.getType(), e.value); } ! catch(mlsub.typing.TypingEx t){ if (variable != null) { let originalType = getOriginalType(variable); *************** *** 70,74 **** return; } ! catch (TypingEx newError) { t = newError; } } --- 68,72 ---- return; } ! catch (mlsub.typing.TypingEx newError) { t = newError; } } *************** *** 94,98 **** try { checkAssignment(originalType, e.value); ! } catch (TypingEx t) { throw assignmentError(e, to.toString(), to.getType().toString(), e.value); --- 92,96 ---- try { checkAssignment(originalType, e.value); ! } catch (mlsub.typing.TypingEx t) { throw assignmentError(e, to.toString(), to.getType().toString(), e.value); *************** *** 233,237 **** if (t.getConstraint() != mlsub.typing.Constraint.True) try{ ! Typing.enter(); try{ mlsub.typing.Constraint.enter(t.getConstraint()); --- 231,235 ---- if (t.getConstraint() != mlsub.typing.Constraint.True) try{ ! mlsub.typing.Typing.enter(); try{ mlsub.typing.Constraint.enter(t.getConstraint()); *************** *** 239,246 **** } finally{ ! Typing.leave(); } } ! catch(TypingEx te){ } } --- 237,244 ---- } finally{ ! mlsub.typing.Typing.leave(); } } ! catch(mlsub.typing.TypingEx te){ } } *************** *** 621,625 **** checkAssignment(nice.tools.typing.PrimitiveType.longType, e.variable); } ! catch(TypingEx t){ if (notNullError(t, e, String.valueOf(e.variable))) throw new bossa.util.UserError --- 619,623 ---- checkAssignment(nice.tools.typing.PrimitiveType.longType, e.variable); } ! catch(mlsub.typing.TypingEx t){ if (notNullError(t, e, String.valueOf(e.variable))) throw new bossa.util.UserError *************** *** 646,650 **** checkAssignment(nice.tools.typing.PrimitiveType.intType, dim); } ! catch(TypingEx ex){ if (notNullError(ex, dim, dim.toString())) --- 644,648 ---- checkAssignment(nice.tools.typing.PrimitiveType.intType, dim); } ! catch(mlsub.typing.TypingEx ex){ if (notNullError(ex, dim, dim.toString())) *************** *** 710,714 **** checkAssignment(type, value); } ! catch(TypingEx t){ reportNullAssignmentError(decl, t, value: value, target.getName.toString(), --- 708,712 ---- checkAssignment(type, value); } ! catch(mlsub.typing.TypingEx t){ reportNullAssignmentError(decl, t, value: value, target.getName.toString(), *************** *** 786,790 **** checkAssignment(type, value); } ! catch(TypingEx t){ reportNullAssignmentError(decl, t, value: value, target.getName().toString(), --- 784,788 ---- checkAssignment(type, value); } ! catch(mlsub.typing.TypingEx t){ reportNullAssignmentError(decl, t, value: value, target.getName().toString(), *************** *** 817,823 **** typecheck(decl.value); try{ ! Typing.leq(decl.inferredReturnType(), decl.declaredReturnType()); } ! catch(TypingEx t){ if (notNullError(t, decl, "returned value")) wrongReturnType(decl, --- 815,821 ---- typecheck(decl.value); try{ ! mlsub.typing.Typing.leq(decl.inferredReturnType(), decl.declaredReturnType()); } ! catch(mlsub.typing.TypingEx t){ if (notNullError(t, decl, "returned value")) wrongReturnType(decl, *************** *** 956,963 **** checkNotNull(type); } ! catch(TypingEx ex) { bossa.util.User.error(s.object, "Synchonization must be done on a non-null object.\n" + s.object + " might be null."); } - typecheck(s.body); --- 954,960 ---- checkNotNull(type); } ! catch(mlsub.typing.TypingEx ex) { bossa.util.User.error(s.object, "Synchonization must be done on a non-null object.\n" + s.object + " might be null."); } typecheck(s.body); *************** *** 982,986 **** { typecheck(right); ! Typing.leq(right.getType(), left); } } --- 979,983 ---- { typecheck(right); ! mlsub.typing.Typing.leq(right.getType(), left); } } *************** *** 989,997 **** { typecheck(right); ! Typing.leq(right.getType(), left); } ! boolean isNullError(TypingEx ex) = false; ! isNullError(MonotypeLeqEx ex) { /* --- 986,995 ---- { typecheck(right); ! mlsub.typing.Typing.leq(right.getType(), left); } ! boolean isNullError(mlsub.typing.TypingEx ex) = false; ! ! isNullError(mlsub.typing.MonotypeLeqEx ex) { /* *************** *** 1000,1005 **** to keep track of the lowlevel exception. */ ! ?TypeConstructor tc1 = notNull(ex.getM1()).head(); ! ?TypeConstructor tc2 = notNull(ex.getM2()).head(); if (tc1 == tc2) return false; --- 998,1003 ---- to keep track of the lowlevel exception. */ ! let tc1 = notNull(ex.getM1()).head(); ! let tc2 = notNull(ex.getM2()).head(); if (tc1 == tc2) return false; *************** *** 1017,1021 **** Returns true the error is not related to null types. */ ! boolean notNullError(TypingEx ex, bossa.util.Located resp, ?String value) { if (isNullError(ex)) throw new bossa.util.UserError(resp, "" + value + " might be null"); --- 1015,1019 ---- Returns true the error is not related to null types. */ ! boolean notNullError(mlsub.typing.TypingEx ex, bossa.util.Located resp, ?String value) { if (isNullError(ex)) throw new bossa.util.UserError(resp, "" + value + " might be null"); *************** *** 1028,1032 **** checkAssignment(nice.tools.typing.PrimitiveType.boolType, condition); } ! catch(TypingEx t){ throw new bossa.util.UserError(condition, "The condition must be a boolean.\n" + --- 1026,1030 ---- checkAssignment(nice.tools.typing.PrimitiveType.boolType, condition); } ! catch(mlsub.typing.TypingEx t){ throw new bossa.util.UserError(condition, "The condition must be a boolean.\n" + *************** *** 1054,1067 **** { if (type.isMonomorphic()) ! Typing.leq(type.getMonotype(), nice.tools.typing.PrimitiveType.sureTC); else try { ! Typing.enter(); notNull(type.getConstraint()).enter(); ! Typing.leq(type.getMonotype(), nice.tools.typing.PrimitiveType.sureTC); ! Typing.implies(); } finally { ! Typing.leave(); } } --- 1052,1065 ---- { if (type.isMonomorphic()) ! mlsub.typing.Typing.leq(type.getMonotype(), nice.tools.typing.PrimitiveType.sureTC); else try { ! mlsub.typing.Typing.enter(); notNull(type.getConstraint()).enter(); ! mlsub.typing.Typing.leq(type.getMonotype(), nice.tools.typing.PrimitiveType.sureTC); ! mlsub.typing.Typing.implies(); } finally { ! mlsub.typing.Typing.leave(); } } Index: try.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/try.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** try.nice 12 Jan 2005 18:50:38 -0000 1.5 --- try.nice 16 Jan 2005 00:28:21 -0000 1.6 *************** *** 15,23 **** import bossa.util.*; - /** A try/catch/finally statement */ - public class TryStmt extends Statement { --- 15,21 ---- Index: alternative.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/alternative.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** alternative.nice 14 Jan 2005 22:47:11 -0000 1.8 --- alternative.nice 16 Jan 2005 00:28:21 -0000 1.9 *************** *** 38,42 **** * Tests the matching of tags against a method alternative. */ ! public boolean matches(?TypeConstructor[] tags) { for(int i = 0; i < patterns.length; i++) --- 38,42 ---- * Tests the matching of tags against a method alternative. */ ! public boolean matches(?mlsub.typing.TypeConstructor[] tags) { for(int i = 0; i < patterns.length; i++) *************** *** 47,51 **** } ! public boolean matchesTypePart(?TypeConstructor[] tags, boolean[] isValue) { for(int i = 0; i < patterns.length; i++) --- 47,51 ---- } ! public boolean matchesTypePart(?mlsub.typing.TypeConstructor[] tags, boolean[] isValue) { for(int i = 0; i < patterns.length; i++) Index: call.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/call.nice,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** call.nice 15 Jan 2005 20:27:33 -0000 1.11 --- call.nice 16 Jan 2005 00:28:21 -0000 1.12 *************** *** 74,78 **** { this.setComputedType(notNull(getTypeAndReportErrors(this.location(), function, arguments.inOrder())), null); ! arguments.computedExpressions = cast(arguments.inOrder()); } --- 74,78 ---- { this.setComputedType(notNull(getTypeAndReportErrors(this.location(), function, arguments.inOrder())), null); ! arguments.computedExpressions = arguments.inOrder(); } *************** *** 111,115 **** { this.resolveOverloading(); ! let ?FieldAccess fa = function.getFieldAccessMethod(); return fa != null && ! fa.isFinal(); } --- 111,115 ---- { this.resolveOverloading(); ! let fa = function.getFieldAccessMethod(); return fa != null && ! fa.isFinal(); } *************** *** 155,160 **** gnu.expr.Expression res; ! if (function.isFieldAccess()) ! res = notNull(function.getFieldAccessMethod()).compileAccess(this.compileParams()); else res = new gnu.expr.ApplyExp(function.generateCodeInCallPosition(), this.compileParams()); --- 155,161 ---- gnu.expr.Expression res; ! let fa = function.getFieldAccessMethod(); ! if (fa != null) ! res = fa.compileAccess(this.compileParams()); else res = new gnu.expr.ApplyExp(function.generateCodeInCallPosition(), this.compileParams()); *************** *** 172,176 **** private gnu.expr.Expression[] compileParams() { ! bossa.syntax.Expression[] compexps = cast(arguments.computedExpressions); gnu.expr.Expression[] params = Expression_compile(compexps); --- 173,177 ---- private gnu.expr.Expression[] compileParams() { ! Expression[] compexps = cast(arguments.computedExpressions); gnu.expr.Expression[] params = Expression_compile(compexps); *************** *** 195,202 **** compileAssign(gnu.expr.Expression value) { ! if (!function.isFieldAccess()) ! Internal.error(this, "Assignment to a call that is not a field access"); ! ! FieldAccess access = notNull(function.getFieldAccessMethod()); if (access.isFinal()) --- 196,202 ---- compileAssign(gnu.expr.Expression value) { ! let access = function.getFieldAccessMethod(); ! if (access == null) ! throw Internal.error(this, "Assignment to a call that is not a field access"); if (access.isFinal()) *************** *** 209,214 **** return access.compileAssign(arguments.getExp(0).generateCode(), value); ! Internal.error(this, "A field access should have 0 or 1 parameter"); ! return cast(null); } --- 209,213 ---- return access.compileAssign(arguments.getExp(0).generateCode(), value); ! throw Internal.error(this, "A field access should have 0 or 1 parameter"); } *************** *** 290,294 **** return getType(function.getType(), paramTypes, false); } ! catch(BadSizeEx e){ User.error(loc, function.toString(Printable.detailed) + " expects " + e.expected + " parameters, " + --- 289,293 ---- return getType(function.getType(), paramTypes, false); } ! catch(mlsub.typing.BadSizeEx e){ User.error(loc, function.toString(Printable.detailed) + " expects " + e.expected + " parameters, " + *************** *** 298,303 **** User.error(loc, e.getMessage()); } ! catch(TypingEx e){ ! if (Typing.dbg) bossa.util.Debug.println(e.getMessage()); --- 297,302 ---- User.error(loc, e.getMessage()); } ! catch(mlsub.typing.TypingEx e){ ! if (mlsub.typing.Typing.dbg) bossa.util.Debug.println(e.getMessage()); *************** *** 343,347 **** mlsub.typing.Typing.leq(m.head(), nice.tools.typing.PrimitiveType.sureTC); } ! catch(TypingEx ex) { throw new ReportErrorEx("This function may be null"); } --- 342,346 ---- mlsub.typing.Typing.leq(m.head(), nice.tools.typing.PrimitiveType.sureTC); } ! catch(mlsub.typing.TypingEx ex) { throw new ReportErrorEx("This function may be null"); } Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.127 retrieving revision 1.128 diff -C2 -d -r1.127 -r1.128 *** analyse.nice 14 Jan 2005 22:47:11 -0000 1.127 --- analyse.nice 16 Jan 2005 00:28:21 -0000 1.128 *************** *** 18,22 **** import nice.tools.ast; - import mlsub.typing.*; // Interface --- 18,21 ---- *************** *** 30,34 **** buildInfo(varScope, typeScope) { ! let SymbolTable<TypeSymbol> t = new SymbolTable(); return new Info(vars: new SymbolTable(), typeVars: t, outerVarScope: varScope, outerTypeScope: typeScope, --- 29,33 ---- buildInfo(varScope, typeScope) { ! let SymbolTable<mlsub.typing.TypeSymbol> t = new SymbolTable(); return new Info(vars: new SymbolTable(), typeVars: t, outerVarScope: varScope, outerTypeScope: typeScope, *************** *** 73,77 **** { SymbolTable<VarSymbol> vars; ! SymbolTable<TypeSymbol> typeVars; VarScope outerVarScope; --- 72,76 ---- { SymbolTable<VarSymbol> vars; ! SymbolTable<mlsub.typing.TypeSymbol> typeVars; VarScope outerVarScope; *************** *** 180,186 **** this.outerVarScope.lookup(name); ! ?TypeSymbol lookupType(LocatedString name) { ! ?TypeSymbol res = this.typeVars[name.toString()]; if (res != null) return res; --- 179,185 ---- this.outerVarScope.lookup(name); ! ?mlsub.typing.TypeSymbol lookupType(LocatedString name) { ! let res = this.typeVars[name.toString()]; if (res != null) return res; *************** *** 223,228 **** symbols.foreach(MonoSymbol s => this.addVar(s)); ! void addTypeVars(TypeSymbol[] symbols) = ! symbols.foreach(TypeSymbol s => this.typeVars[s.toString()] = s); void checkNotDefined(VarSymbol symbol) --- 222,227 ---- symbols.foreach(MonoSymbol s => this.addVar(s)); ! void addTypeVars(mlsub.typing.TypeSymbol[] symbols) = ! symbols.foreach(mlsub.typing.TypeSymbol s => this.typeVars[s.toString()] = s); void checkNotDefined(VarSymbol symbol) *************** *** 615,627 **** return c; ! ?TypeSymbol s = info.lookupType(notNull(c.className)); if (s == null) ! bossa.util.Internal.error ! ("Base type " + c.className + " was not found in the standard library"); ! ?TypeConstructor tc = TypeConstructor.fromTypeSymbol(notNull(s)); if (tc == null) ! bossa.util.Internal.error("Base type " + c.className + " is not valid"); c.type = new mlsub.typing.Polytype --- 614,625 ---- return c; ! let s = info.lookupType(notNull(c.className)); if (s == null) ! throw Internal.error("Base type " + c.className + " was not found in the standard library"); ! let tc = mlsub.typing.TypeConstructor.fromTypeSymbol(s); if (tc == null) ! throw Internal.error("Base type " + c.className + " is not valid"); c.type = new mlsub.typing.Polytype *************** *** 649,653 **** } ! ?TypeConstructor tc = Node.getGlobalTypeScope().globalLookup(name, loc); if (tc == null) --- 647,651 ---- } ! ?mlsub.typing.TypeConstructor tc = Node.getGlobalTypeScope().globalLookup(name, loc); if (tc == null) *************** *** 656,660 **** return nice.tools.typing.PrimitiveType.objectPolytype(); ! if (info.typeVars[name] instanceof MonotypeVar) throw new bossa.util.UserError(loc, "A type variable cannot be used here"); else --- 654,658 ---- return nice.tools.typing.PrimitiveType.objectPolytype(); ! if (info.typeVars[name] instanceof mlsub.typing.MonotypeVar) throw new bossa.util.UserError(loc, "A type variable cannot be used here"); else Index: locals.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/locals.nice,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** locals.nice 14 Jan 2005 22:47:11 -0000 1.9 --- locals.nice 16 Jan 2005 00:28:21 -0000 1.10 *************** *** 52,57 **** if (value == null) return this.getSymbol().toString(); ! else ! return this.getSymbol().toString() + '=' + value; } } --- 52,57 ---- if (value == null) return this.getSymbol().toString(); ! ! return this.getSymbol().toString() + '=' + value; } } *************** *** 209,216 **** ! public Statement createLocalVariable(LocatedString name, ?Monotype type, boolean constant, ?Expression value) { if (type == null && value == null) ! User.error(name,"A local variable requires a type or a default value"); if (constant && type == null) --- 209,216 ---- ! public LocalValue createLocalVariable(LocatedString name, ?Monotype type, boolean constant, ?Expression value) { if (type == null && value == null) ! throw User.error(name,"A local variable requires a type or a default value"); if (constant && type == null) *************** *** 220,229 **** } - public void addNextLocal(Statement localValue, LocatedString name, ?Expression value) - { - LocalValue lv = cast(localValue); - lv.addNext(name, value); - } - public class ExpLocalVariable extends Expression { --- 220,223 ---- Index: methodbody.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodbody.nice,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** methodbody.nice 14 Jan 2005 16:41:27 -0000 1.11 --- methodbody.nice 16 Jan 2005 00:28:21 -0000 1.12 *************** *** 72,76 **** ?mlsub.typing.TypeConstructor[] additionalTags = formals.mapToArray(Pattern p => p.tc2); ! boolean hasAdditionalTags = additionalTags.any(?TypeConstructor tc => tc != null); // Try to remember what caused the error when no symbol could be found. --- 72,76 ---- ?mlsub.typing.TypeConstructor[] additionalTags = formals.mapToArray(Pattern p => p.tc2); ! boolean hasAdditionalTags = additionalTags.any(?mlsub.typing.TypeConstructor tc => tc != null); // Try to remember what caused the error when no symbol could be found. *************** *** 115,119 **** formals[p].inDomain(domain[p]); } ! catch (TypingEx e) { errorList.add(m, new LocatedString("Pattern " + formals[p] + " is incompatible with " + domain[p], --- 115,119 ---- formals[p].inDomain(domain[p]); } ! catch (mlsub.typing.TypingEx e) { errorList.add(m, new LocatedString("Pattern " + formals[p] + " is incompatible with " + domain[p], *************** *** 124,132 **** } finally{ ! if (Typing.leave() != level) Internal.error("Enter/Leave error"); } } ! catch(TypingEx e){ if (bossa.util.Debug.overloading) bossa.util.Debug.println("Not the right choice :"+e); i.remove(); --- 124,132 ---- } finally{ ! if (mlsub.typing.Typing.leave() != level) Internal.error("Enter/Leave error"); } } ! catch(mlsub.typing.TypingEx e){ if (bossa.util.Debug.overloading) bossa.util.Debug.println("Not the right choice :"+e); i.remove(); *************** *** 168,176 **** this.domainMonotypeLeq(dom1[i], dom2[i]); } ! catch (TypingEx e) { additionalsEqual = false; } } ! catch(TypingEx e) { remove = false; break; --- 168,176 ---- this.domainMonotypeLeq(dom1[i], dom2[i]); } ! catch (mlsub.typing.TypingEx e) { additionalsEqual = false; } } ! catch(mlsub.typing.TypingEx e) { remove = false; break; *************** *** 323,327 **** try { mlsub.typing.Constraint.enter(notNull(notNull(declaration).getType()).getConstraint()); ! Typing.implies(); mlsub.typing.Monotype[] domain = notNull(notNull(declaration).getType()).domain(); --- 323,327 ---- try { mlsub.typing.Constraint.enter(notNull(notNull(declaration).getType()).getConstraint()); ! mlsub.typing.Typing.implies(); mlsub.typing.Monotype[] domain = notNull(notNull(declaration).getType()).domain(); *************** *** 332,342 **** formals[n] = formals[n].setDomainEq(tc != null && nice.tools.typing.Types.isSure(domain[n]) && ! Typing.testLeq(tc, formals[n].tc)); } } finally { if (entered) ! Typing.leave(); } ! } catch(TypingEx ex) { Internal.warning(ex.toString()); } --- 332,342 ---- formals[n] = formals[n].setDomainEq(tc != null && nice.tools.typing.Types.isSure(domain[n]) && ! mlsub.typing.Typing.testLeq(tc, formals[n].tc)); } } finally { if (entered) ! mlsub.typing.Typing.leave(); } ! } catch(mlsub.typing.TypingEx ex) { Internal.warning(ex.toString()); } *************** *** 348,354 **** int level; if (bossa.util.Debug.typing) ! level = Typing.enter("METHOD BODY " + this + "\n\n"); else ! level = Typing.enter(); try { --- 348,354 ---- int level; if (bossa.util.Debug.typing) ! level = mlsub.typing.Typing.enter("METHOD BODY " + this + "\n\n"); else ! level = mlsub.typing.Typing.enter(); try { *************** *** 357,361 **** mlsub.typing.Constraint.enter(notNull(notNull(declaration).getType()).getConstraint()); } ! catch(TypingEx e){ throw User.error(name, "the constraint will never be satisfied", --- 357,361 ---- mlsub.typing.Constraint.enter(notNull(notNull(declaration).getType()).getConstraint()); } ! catch(mlsub.typing.TypingEx e){ throw User.error(name, "the constraint will never be satisfied", *************** *** 388,392 **** try { monotypes.inPattern(formals); ! } catch(TypingEx e){ throw User.error(name,"The patterns are not correct", e); } --- 388,392 ---- try { monotypes.inPattern(formals); ! } catch(mlsub.typing.TypingEx e){ throw User.error(name,"The patterns are not correct", e); } *************** *** 396,400 **** try { mlsub.typing.Typing.leq(monotypes[i], domain[i]); ! } catch(TypingEx e) { /* This type error originates from an inadequation between --- 396,400 ---- try { mlsub.typing.Typing.leq(monotypes[i], domain[i]); ! } catch(mlsub.typing.TypingEx e) { /* This type error originates from an inadequation between *************** *** 410,416 **** nice.tools.code.Types.setBytecodeType(monotypes); ! Typing.implies(); } ! catch(TypingEx e) { throw User.error(name, "Type error in method body \""+name+"\":\n"+e); } --- 410,416 ---- nice.tools.code.Types.setBytecodeType(monotypes); ! mlsub.typing.Typing.implies(); } ! catch(mlsub.typing.TypingEx e) { throw User.error(name, "Type error in method body \""+name+"\":\n"+e); } *************** *** 429,435 **** Node.thisExp = null; try { ! if (Typing.leave() != level) Internal.error("Unmatching enter/leave"); ! } catch(TypingEx e){ if (! errorFound) User.error(this, "Type error in method "+name, ": "+e); --- 429,435 ---- Node.thisExp = null; try { ! if (mlsub.typing.Typing.leave() != level) Internal.error("Unmatching enter/leave"); ! } catch(mlsub.typing.TypingEx e){ if (! errorFound) User.error(this, "Type error in method "+name, ": "+e); Index: assign.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/assign.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** assign.nice 13 Jan 2005 16:47:34 -0000 1.6 --- assign.nice 16 Jan 2005 00:28:21 -0000 1.7 *************** *** 44,50 **** args.add(new Argument(value: value)); ! return createCallExp( ! createIdentExp(new LocatedString("set", to.function.location())), ! new Arguments(arguments: args.toArray())); } --- 44,50 ---- args.add(new Argument(value: value)); ! return new CallExp( ! function: createIdentExp(new LocatedString("set", to.function.location())), ! arguments: new Arguments(arguments: args.toArray())); } Index: enum.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/enum.nice,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** enum.nice 14 Jan 2005 22:47:11 -0000 1.15 --- enum.nice 16 Jan 2005 00:28:21 -0000 1.16 *************** *** 149,153 **** typecheck(value); ... [truncated message content] |
From: Arjan B. <ar...@us...> - 2005-01-16 00:28:33
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30903/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Conversion cleanup part 3. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.305 retrieving revision 1.306 diff -C2 -d -r1.305 -r1.306 *** Parser.jj 14 Jan 2005 11:12:06 -0000 1.305 --- Parser.jj 16 Jan 2005 00:28:20 -0000 1.306 *************** *** 2465,2469 **** boolean constant = false; Token t = null; ! Statement res; } { --- 2465,2469 ---- boolean constant = false; Token t = null; ! LocalValue res; } { *************** *** 2478,2482 **** { res = bossa.syntax.dispatch.createLocalVariable(id,type,constant,e); } ( LOOKAHEAD( "," <IDENT> ( "=" | ";" | ",") ) ! "," id=ident() {e=null;} [ "=" e=Expression() ] { bossa.syntax.fun.addNextLocal(res,id,e); } )* { return res; } --- 2478,2482 ---- { res = bossa.syntax.dispatch.createLocalVariable(id,type,constant,e); } ( LOOKAHEAD( "," <IDENT> ( "=" | ";" | ",") ) ! "," id=ident() {e=null;} [ "=" e=Expression() ] { res.addNext(id, e); } )* { return res; } *************** *** 2717,2721 **** { "while" "(" cond=Expression() ")" body=Statement() ! { return bossa.syntax.dispatch.createWhileLoop(cond,body); } } --- 2717,2721 ---- { "while" "(" cond=Expression() ")" body=Statement() ! { return new LoopStmt(cond, body, /*testfirst*/true); } } *************** *** 2724,2732 **** { "do" body=Statement() "while" "(" cond=Expression() ")" ";" ! { return bossa.syntax.dispatch.createDoLoop(cond,body); } } Statement ForStatement() : ! { Statement update = null; Statement loop = null, body, statexp; Expression cond = null; --- 2724,2732 ---- { "do" body=Statement() "while" "(" cond=Expression() ")" ";" ! { return new LoopStmt(cond, body, /*testfirst*/false); } } Statement ForStatement() : ! { Block update = null; Statement loop = null, body, statexp; Expression cond = null; *************** *** 2774,2778 **** } ! Statement StatementExpressionList() : { Statement s; List statements=new LinkedList(); } { --- 2774,2778 ---- } ! Block StatementExpressionList() : { Statement s; List statements=new LinkedList(); } { *************** *** 2794,2798 **** { "continue" [ label=ident() ] ";" ! { return bossa.syntax.dispatch.createContinueStmt(label); } } --- 2794,2798 ---- { "continue" [ label=ident() ] ";" ! { return new ContinueStmt(label); } } |
From: Daniel B. <bo...@us...> - 2005-01-15 21:06:07
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16263/testsuite/compiler/classes Modified Files: fields.testsuite Log Message: Known bug: generated field accessors can conflict with methods. Index: fields.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/fields.testsuite,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** fields.testsuite 15 Mar 2004 15:27:15 -0000 1.18 --- fields.testsuite 15 Jan 2005 21:05:55 -0000 1.19 *************** *** 182,183 **** --- 182,196 ---- /// package b import a {} + + /// PASS bug + int x = new B().getFoo(); + /// Toplevel + class A + { + int getFoo() = 0; + } + + class B extends A + { + String foo = ""; + } |
From: Arjan B. <ar...@us...> - 2005-01-15 20:27:47
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7276/F:/nice/src/bossa/syntax Modified Files: Expression.java arguments.nice call.nice contract.nice dispatch.java.bootstrap increment.nice literalarray.nice newarray.nice tools.nice tuple.nice typecheck.nice Added Files: expression.nice Log Message: Moved some methods out of Expression. Index: arguments.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/arguments.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** arguments.nice 13 Jan 2005 16:47:34 -0000 1.1 --- arguments.nice 15 Jan 2005 20:27:33 -0000 1.2 *************** *** 92,96 **** { if (arguments.length == 0) ! return Expression.noExpressions; Expression[] res = cast(new Expression[arguments.length]); --- 92,96 ---- { if (arguments.length == 0) ! return []; Expression[] res = cast(new Expression[arguments.length]); Index: literalarray.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/literalarray.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** literalarray.nice 12 Jan 2005 18:50:37 -0000 1.5 --- literalarray.nice 15 Jan 2005 20:27:33 -0000 1.6 *************** *** 118,122 **** compile() { ! gnu.expr.Expression[] args = Expression.compile(elements); gnu.bytecode.ArrayType t = nice.tools.code.SpecialTypes.array (nice.tools.code.Types.lowestUpperBound(args)); --- 118,122 ---- compile() { ! gnu.expr.Expression[] args = Expression_compile(elements); gnu.bytecode.ArrayType t = nice.tools.code.SpecialTypes.array (nice.tools.code.Types.lowestUpperBound(args)); Index: tuple.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tuple.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tuple.nice 12 Jan 2005 22:06:54 -0000 1.4 --- tuple.nice 15 Jan 2005 20:27:33 -0000 1.5 *************** *** 132,136 **** (nice.tools.code.Types.lowestCommonSupertype(expectedComponents), nice.tools.code.Types.javaType(expectedComponents), ! bossa.syntax.Expression.compile(expressions)); } --- 132,136 ---- (nice.tools.code.Types.lowestCommonSupertype(expectedComponents), nice.tools.code.Types.javaType(expectedComponents), ! Expression_compile(expressions)); } Index: contract.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/contract.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** contract.nice 11 Jan 2005 21:45:46 -0000 1.2 --- contract.nice 15 Jan 2005 20:27:33 -0000 1.3 *************** *** 94,99 **** public gnu.expr.Expression compile(gnu.expr.Expression body) { ! return new gnu.expr.CheckContract(Expression.compile(pre.toArray()), ! Expression.compile(post.toArray()), body); } --- 94,99 ---- public gnu.expr.Expression compile(gnu.expr.Expression body) { ! return new gnu.expr.CheckContract(Expression_compile(pre.toArray()), ! Expression_compile(post.toArray()), body); } Index: Expression.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Expression.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** Expression.java 1 Jan 2005 16:36:31 -0000 1.58 --- Expression.java 15 Jan 2005 20:27:33 -0000 1.59 *************** *** 30,44 **** implements Located, Printable { - static final Expression[] toArray(List expressions) - { - if (expressions == null || expressions.size() == 0) - return noExpressions; - - return (Expression[]) - expressions.toArray(new Expression[expressions.size()]); - } - - public static final Expression[] noExpressions = new Expression[0]; - /** @return true iff this expression can be assigned a value. */ public boolean isAssignable() --- 30,33 ---- *************** *** 47,86 **** } - /** - @return true iff this expression is a method - to access to the field of a class. - */ - final boolean isFieldAccess() - { - return getFieldAccessMethod() != null; - } - - /** - * @return the FieldAccess behind this expression, or null - */ - /*FieldAccess*/Object getFieldAccessMethod() - { - return null; - } - - /** - @return the FieldAccess if this expression resolves to a field, - which is true if it is the application a of FieldAccess to an object - value. Returns null otherwise. - */ - /*FieldAccess*/Object getField() - { - return null; - } - - /** - @return null, or the underlying java class if this - expression is a constant class (used in static method calls). - */ - gnu.bytecode.ClassType staticClass() - { - return null; - } - boolean isZero() { --- 36,39 ---- *************** *** 193,269 **** } - /**************************************************************** - * Code generation - ****************************************************************/ - - /** - * Creates the bytecode expression to evaluate this Expression. - * - * This must be overrided in any Expression, but not called directly. - * Call {@link #generateCode()} instead. - */ - protected abstract gnu.expr.Expression compile(); - - /** - * Creates the bytecode expression to evaluate this Expression. - */ - final gnu.expr.Expression generateCode() - { - gnu.expr.Expression res = compile(); - location().write(res); - - return res; - } - - /** - Creates the bytecode expression to evaluate this Expression, - when it is used as a function that is immediately called. - */ - gnu.expr.Expression generateCodeInCallPosition() - { - // Default implementation. - return generateCode(); - } - - /** - * Maps {@link #generateCode()} over an array of expressions. - */ - public static gnu.expr.Expression[] compile(Expression[] expressions) - { - gnu.expr.Expression[] res = new gnu.expr.Expression[expressions.length]; - for (int i=0; i<res.length; i++) - res[i] = expressions[i].generateCode(); - - return res; - } - - /** @return the declaration of the local variable denoted by this expression, - or <code>null</code> if this expression is not a local variable. - */ - gnu.expr.Declaration getDeclaration() - { - return null; - } - - gnu.expr.Expression compileAssign(gnu.expr.Expression value) - // default implementation using getDeclaration() - { - gnu.expr.Declaration decl = getDeclaration(); - if (decl != null) - { - gnu.expr.SetExp res = new gnu.expr.SetExp(decl, value); - res.setHasValue(true); - return res; - } - - Internal.error(this, this + " doesn't know how to be modified, it is a " + - this.getClass()); - return null; - } - - /**************************************************************** - * Locations - ****************************************************************/ - public void setLocation(Location l) { --- 146,149 ---- Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -d -r1.122 -r1.123 *** typecheck.nice 14 Jan 2005 22:47:11 -0000 1.122 --- typecheck.nice 15 Jan 2005 20:27:33 -0000 1.123 *************** *** 73,77 **** } ! ?FieldAccess field = cast(to.getField()); String toName; if (field == null) --- 73,77 ---- } ! ?FieldAccess field = to.getField(); String toName; if (field == null) Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** tools.nice 14 Jan 2005 22:47:11 -0000 1.100 --- tools.nice 15 Jan 2005 20:27:33 -0000 1.101 *************** *** 164,174 **** native mlsub.typing.Polytype Expression.getType(); GlobalTypeScope getGlobalTypeScope() = native GlobalTypeScope Node.getGlobalTypeScope(); - ?gnu.bytecode.ClassType staticClass(Expression) = native gnu.bytecode.ClassType Expression.staticClass(); <T> String map(String, String, String, T[]) = native String bossa.util.Util.map(String, String, String, Object[]); <T> String map(String, String, String, ?Collection<T>) = native String bossa.util.Util.map(String, String, String, Collection); ?mlsub.typing.lowlevel.Kind getKind(mlsub.typing.lowlevel.Element) = native mlsub.typing.lowlevel.Kind mlsub.typing.lowlevel.Element.getKind(); - ?gnu.expr.Declaration getDeclaration(Expression) = native gnu.expr.Declaration Expression.getDeclaration(); - ?Object getFieldAccessMethod(Expression) = native Object Expression.getFieldAccessMethod(); - ?Object getField(Expression) = native Object Expression.getField(); ?mlsub.typing.Monotype Types_getTypeParameter(mlsub.typing.Polytype, int) = native mlsub.typing.Monotype nice.tools.typing.Types.getTypeParameter(mlsub.typing.Polytype, int); ?mlsub.typing.Monotype Types_getTypeParameter(mlsub.typing.Monotype, int) = native mlsub.typing.Monotype nice.tools.typing.Types.getTypeParameter(mlsub.typing.Monotype, int); --- 164,170 ---- Index: newarray.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/newarray.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** newarray.nice 12 Jan 2005 18:50:37 -0000 1.3 --- newarray.nice 15 Jan 2005 20:27:33 -0000 1.4 *************** *** 141,145 **** return new gnu.expr.ApplyExp( new nice.tools.code.MultiArrayNewProc(cast(t), knownDimensions.length), ! Expression.compile(knownDimensions)); } --- 141,145 ---- return new gnu.expr.ApplyExp( new nice.tools.code.MultiArrayNewProc(cast(t), knownDimensions.length), ! Expression_compile(knownDimensions)); } --- NEW FILE: expression.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; /** Methods on defined on Expressions. */ /** @return true iff this expression is a method to access to the field of a class. */ boolean isFieldAccess(Expression exp) { return exp.getFieldAccessMethod() != null; } /** * @return the FieldAccess behind this expression, or null */ ?FieldAccess getFieldAccessMethod(Expression exp) { return null; } /** @return the FieldAccess if this expression resolves to a field, which is true if it is the application a of FieldAccess to an object value. Returns null otherwise. */ ?FieldAccess getField(Expression exp) { return null; } /** @return null, or the underlying java class if this expression is a constant class (used in static method calls). */ ?gnu.bytecode.ClassType staticClass(Expression exp) { return null; } /** * Maps {@link #generateCode()} over an array of expressions. */ public gnu.expr.Expression[] Expression_compile(Expression[] expressions) { gnu.expr.Expression[] res = cast(new gnu.expr.Expression[expressions.length]); for (int i=0; i<res.length; i++) res[i] = expressions[i].generateCode(); return res; } /** * Creates the bytecode expression to evaluate this Expression. * * This must be overrided in any Expression, but not called directly. * Call {@link #generateCode()} instead. */ gnu.expr.Expression compile(Expression exp); /** * Creates the bytecode expression to evaluate this Expression. * This method should not be overriden. */ gnu.expr.Expression generateCode(Expression exp) { gnu.expr.Expression res = exp.compile(); exp.location().write(res); return res; } /** Creates the bytecode expression to evaluate this Expression, when it is used as a function that is immediately called. */ gnu.expr.Expression generateCodeInCallPosition(Expression exp) { // Default implementation. return exp.generateCode(); } /** @return the declaration of the local variable denoted by this expression, or <code>null</code> if this expression is not a local variable. */ ?gnu.expr.Declaration getDeclaration(Expression exp) { return null; } gnu.expr.Expression compileAssign(Expression exp, gnu.expr.Expression value) // default implementation using getDeclaration() { let decl = exp.getDeclaration(); if (decl != null) { let res = new gnu.expr.SetExp(decl, value); res.setHasValue(true); return res; } throw Internal.error(exp, exp + " doesn't know how to be modified, it is a " + exp.getClass()); } Index: dispatch.java.bootstrap =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/dispatch.java.bootstrap,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** dispatch.java.bootstrap 14 Jan 2005 11:12:10 -0000 1.52 --- dispatch.java.bootstrap 15 Jan 2005 20:27:33 -0000 1.53 *************** *** 26,32 **** public static void resetConstructorsMap() {} - public static mlsub.typing.TypeConstructor lookupJavaClass(String className, bossa.util.Location loc) - { return null; } - public static void resetJavaClasses() {} --- 26,29 ---- *************** *** 42,48 **** { return null; } - public static mlsub.typing.Monotype getTypeWithTC(mlsub.typing.TypeConstructor tc, mlsub.typing.Monotype[] sourceParams ) - { return null; } - public static AST createAST(Module module, List defs) { return null; } --- 39,42 ---- Index: increment.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/increment.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** increment.nice 14 Jan 2005 22:47:11 -0000 1.6 --- increment.nice 15 Jan 2005 20:27:33 -0000 1.7 *************** *** 48,52 **** CallExp call = cast(variable); ! let ?FieldAccess access = cast(call.function.getFieldAccessMethod()); if (access == null) Internal.error(this, "\"var\" is assignable and not a local, " + --- 48,52 ---- CallExp call = cast(variable); ! let access = call.function.getFieldAccessMethod(); if (access == null) Internal.error(this, "\"var\" is assignable and not a local, " + Index: call.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/call.nice,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** call.nice 13 Jan 2005 23:56:06 -0000 1.10 --- call.nice 15 Jan 2005 20:27:33 -0000 1.11 *************** *** 111,115 **** { this.resolveOverloading(); ! let ?FieldAccess fa = cast(function.getFieldAccessMethod()); return fa != null && ! fa.isFinal(); } --- 111,115 ---- { this.resolveOverloading(); ! let ?FieldAccess fa = function.getFieldAccessMethod(); return fa != null && ! fa.isFinal(); } *************** *** 156,160 **** gnu.expr.Expression res; if (function.isFieldAccess()) ! res = cast(function.getFieldAccessMethod()).compileAccess(this.compileParams()); else res = new gnu.expr.ApplyExp(function.generateCodeInCallPosition(), this.compileParams()); --- 156,160 ---- gnu.expr.Expression res; if (function.isFieldAccess()) ! res = notNull(function.getFieldAccessMethod()).compileAccess(this.compileParams()); else res = new gnu.expr.ApplyExp(function.generateCodeInCallPosition(), this.compileParams()); *************** *** 174,178 **** bossa.syntax.Expression[] compexps = cast(arguments.computedExpressions); ! gnu.expr.Expression[] params = Expression.compile(compexps); // Make sure the arguments have the expected bytecode type, --- 174,178 ---- bossa.syntax.Expression[] compexps = cast(arguments.computedExpressions); ! gnu.expr.Expression[] params = Expression_compile(compexps); // Make sure the arguments have the expected bytecode type, *************** *** 198,202 **** Internal.error(this, "Assignment to a call that is not a field access"); ! FieldAccess access = cast(function.getFieldAccessMethod()); if (access.isFinal()) --- 198,202 ---- Internal.error(this, "Assignment to a call that is not a field access"); ! FieldAccess access = notNull(function.getFieldAccessMethod()); if (access.isFinal()) |