nice-commit Mailing List for The Nice Programming Language (Page 40)
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: Arjan B. <ar...@us...> - 2004-08-07 14:20:37
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27902/F:/nice/testsuite/compiler/methods Modified Files: coverage.testsuite globalconstant.testsuite Log Message: Split up Pattern.java in subclasses and converted the subclasses to nice code. Index: coverage.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/coverage.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** coverage.testsuite 7 Aug 2004 11:17:43 -0000 1.3 --- coverage.testsuite 7 Aug 2004 14:20:28 -0000 1.4 *************** *** 37,41 **** foo(String s, o) = ""; ! /// PASS bug assert !foo(null); assert foo(""); --- 37,41 ---- foo(String s, o) = ""; ! /// PASS assert !foo(null); assert foo(""); Index: globalconstant.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/globalconstant.testsuite,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** globalconstant.testsuite 26 Nov 2003 09:04:56 -0000 1.9 --- globalconstant.testsuite 7 Aug 2004 14:20:28 -0000 1.10 *************** *** 85,89 **** let Color green = new Color(); String name(Color); ! name(color(Color)) = "unknown color"; name(red) = "red"; name(blue) = "blue"; --- 85,89 ---- let Color green = new Color(); String name(Color); ! name(Color color) = "unknown color"; name(red) = "red"; name(blue) = "blue"; |
From: Arjan B. <ar...@us...> - 2004-08-07 14:20:36
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27902/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Split up Pattern.java in subclasses and converted the subclasses to nice code. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.253 retrieving revision 1.254 diff -C2 -d -r1.253 -r1.254 *** Parser.jj 5 Aug 2004 10:45:29 -0000 1.253 --- Parser.jj 7 Aug 2004 14:20:28 -0000 1.254 *************** *** 1275,1281 **** TypeConstructor runtimeTC = null; ConstantExp val = null; ! boolean exactlyAt = false; ! int kind = Pattern.NONE; ! Location loc = null; } { --- 1275,1279 ---- TypeConstructor runtimeTC = null; ConstantExp val = null; ! Token t; } { *************** *** 1289,1305 **** ] name=ident() ! { loc = tc.location(); } | "#" tc=typeIdent() [ "(" additional=typeIdent() ")" ] [ name=ident() ] ! {exactlyAt = true; loc = tc.location();} | ( ! val=patternLiteral() { loc = val.location(); } | "@" tc=typeIdent() ! { loc = tc.location(); ! User.warning(loc, "This syntax is deprecated, use 'Type paramName' instead."); } | --- 1287,1306 ---- ] name=ident() ! { return bossa.syntax.dispatch.createPattern(tc, name, false, additional, runtimeTC); } | "#" tc=typeIdent() [ "(" additional=typeIdent() ")" ] [ name=ident() ] ! { return bossa.syntax.dispatch.createPattern(tc, name, true, additional, null); } | ( ! val=patternLiteral() ! [ "(" additional=typeIdent() ")" ] ! { return bossa.syntax.dispatch.createPattern(val, additional);} | "@" tc=typeIdent() ! [ "(" additional=typeIdent() ")" ] ! { User.warning(tc.location(), "This syntax is deprecated, use 'Type paramName' instead."); ! return bossa.syntax.dispatch.createPattern(tc, null, false, additional, null); } | *************** *** 1309,1337 **** tc=typeIdent() [ ":" runtimeTC=typeConstructor() ] | "#" tc=typeIdent() ! { exactlyAt = true; ! User.warning(name.location(), "This syntax is deprecated, use '#Type paramName' instead."); } | ! ( ">" {kind = Pattern.GT;} ! | ">=" {kind = Pattern.GE;} ! | "<" {kind = Pattern.LT;} ! | "<=" {kind = Pattern.LE;} ! ) ( val=negativeIntConstantExp() | val=intConstantExp() | refName=ident() ) | ! {} //name only ) - { loc = name.location(); } ) - [ "(" additional=typeIdent() ")" ] ) - { - return new Pattern(name, tc, val, refName, exactlyAt, kind, additional, runtimeTC, loc); - } } --- 1310,1333 ---- tc=typeIdent() [ ":" runtimeTC=typeConstructor() ] + [ "(" additional=typeIdent() ")" ] + { return bossa.syntax.dispatch.createPattern(tc, name, false, additional, runtimeTC); } | "#" tc=typeIdent() ! [ "(" additional=typeIdent() ")" ] ! { User.warning(name.location(), "This syntax is deprecated, use '#Type paramName' instead."); ! return bossa.syntax.dispatch.createPattern(tc, name, true, additional, null); } | ! ( t=">" | t=">=" | t="<" | t="<=" ) ( val=negativeIntConstantExp() | val=intConstantExp() | refName=ident() ) + { return bossa.syntax.dispatch.createPattern(t.toString(), name, val, refName, name.location()); } | ! { return bossa.syntax.dispatch.createPattern(name); } //name only ) ) ) } |
From: Arjan B. <ar...@us...> - 2004-08-07 14:20:36
|
Update of /cvsroot/nice/Nice/src/bossa/link In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27902/F:/nice/src/bossa/link Modified Files: Alternative.java Dispatch.java ImportedAlternative.java Log Message: Split up Pattern.java in subclasses and converted the subclasses to nice code. Index: ImportedAlternative.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/link/ImportedAlternative.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ImportedAlternative.java 9 Jun 2004 17:02:11 -0000 1.9 --- ImportedAlternative.java 7 Aug 2004 14:20:27 -0000 1.10 *************** *** 61,65 **** try { Pattern p; ! while ((p = Pattern.read(rep, at, fullName)) != null) { if (p.getTC() == bossa.syntax.PrimitiveType.arrayTC) --- 61,65 ---- try { Pattern p; ! while ((p = bossa.syntax.dispatch.readPattern(rep, at)) != null) { if (p.getTC() == bossa.syntax.PrimitiveType.arrayTC) Index: Alternative.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/link/Alternative.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** Alternative.java 3 Aug 2004 10:16:14 -0000 1.51 --- Alternative.java 7 Aug 2004 14:20:27 -0000 1.52 *************** *** 61,65 **** { for(int i = 0; i<a.patterns.length; i++) ! if (!a.patterns[i].leq(b.patterns[i])) return false; return true; --- 61,65 ---- { for(int i = 0; i<a.patterns.length; i++) ! if (! bossa.syntax.dispatch.leq(a.patterns[i], b.patterns[i])) return false; return true; *************** *** 74,80 **** for (int i = 0; i < a.patterns.length; i++) ! if (!a.patterns[i].leq(b.patterns[i])) return false; ! else if (!b.patterns[i].leq(a.patterns[i])) strictly = true; --- 74,80 ---- for (int i = 0; i < a.patterns.length; i++) ! if (! bossa.syntax.dispatch.leq(a.patterns[i], b.patterns[i])) return false; ! else if (! bossa.syntax.dispatch.leq(b.patterns[i], a.patterns[i])) strictly = true; *************** *** 85,89 **** { for(int i = 0; i<a.patterns.length; i++) ! if (a.patterns[i].disjoint(b.patterns[i])) return true; --- 85,89 ---- { for(int i = 0; i<a.patterns.length; i++) ! if (bossa.syntax.dispatch.disjoint(a.patterns[i], b.patterns[i])) return true; Index: Dispatch.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/link/Dispatch.java,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** Dispatch.java 5 Aug 2004 19:01:19 -0000 1.70 --- Dispatch.java 7 Aug 2004 14:20:27 -0000 1.71 *************** *** 364,367 **** --- 364,368 ---- failed = true; errors.add("no alternative matches "+ toString(tags, values, isValue)); + Debug.println(sortedAlternatives.toString() + "\n" + toString(tags, values, isValue)); break; } *************** *** 526,530 **** } ! /** Generate all combinations of non boolean values from the alternatives * @return List<ConstantExp> */ --- 527,531 ---- } ! /** Generate all combinations of values from the alternatives * @return List<ConstantExp> */ *************** *** 539,556 **** for (Iterator i = alternatives.iterator(); i.hasNext(); ) { ! Pattern pat = ((Alternative)i.next()).getPatterns()[pos]; ! if (pat.atEnumerableValue()) { isValue[pos] = true; ! for (Iterator it = pat.getEnumValues().iterator(); it.hasNext(); ) ! valuesAtPos.add(it.next()); ! } - else if (pat.atSimpleValue()) - { - isValue[pos] = true; - valuesAtPos.add(pat.atValue); - } } //remove duplicates /* for (int i = 0; i < valuesAtPos.size(); i++) --- 540,551 ---- for (Iterator i = alternatives.iterator(); i.hasNext(); ) { ! Pattern pat = ((Alternative)i.next()).getPatterns()[pos]; ! if (pat.atValue()) { isValue[pos] = true; ! pat.addValues(valuesAtPos); } } + //remove duplicates /* for (int i = 0; i < valuesAtPos.size(); i++) *************** *** 559,607 **** valuesAtPos.remove(j--); */ - for (Iterator i = alternatives.iterator(); i.hasNext(); ) - { - Pattern pat = ((Alternative)i.next()).getPatterns()[pos]; - if (pat.atIntCompare()) - { - isValue[pos] = true; - long val = pat.atValue.longValue(); - long lo,hi; - if (pat.compareKind == Pattern.LT || pat.compareKind == Pattern.GE) - { - lo = val-1; - hi = val; - } - else - { - lo = val; - hi = val+1; - } - - outer: - for (;true; lo--) - { - for (int j = 0; j<valuesAtPos.size(); j++) - if (((ConstantExp)valuesAtPos.get(j)).value instanceof Number && - ((ConstantExp)valuesAtPos.get(j)).longValue() == lo) - continue outer; - - break; - } - valuesAtPos.add(new ConstantExp(new Long(lo))); - - outer: - for (;true; hi++) - { - for (int j = 0; j<valuesAtPos.size(); j++) - if (((ConstantExp)valuesAtPos.get(j)).value instanceof Number && - ((ConstantExp)valuesAtPos.get(j)).longValue() == hi) - continue outer; - - break; - } - - valuesAtPos.add(new ConstantExp(new Long(hi))); - } - } int valueCount = valuesAtPos.size(); --- 554,557 ---- |
From: Daniel B. <bo...@us...> - 2004-08-07 14:19:39
|
Update of /cvsroot/nice/Nice/src/nice/tools/repository/publish In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27720/src/nice/tools/repository/publish Log Message: Directory /cvsroot/nice/Nice/src/nice/tools/repository/publish added to the repository |
From: Daniel B. <bo...@us...> - 2004-08-07 14:18:35
|
Update of /cvsroot/nice/Nice/src/nice/tools/repository In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27532/src/nice/tools/repository Log Message: Directory /cvsroot/nice/Nice/src/nice/tools/repository added to the repository |
From: Daniel B. <bo...@us...> - 2004-08-07 12:34:15
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12082/testsuite/compiler/methods Modified Files: implementations.testsuite Log Message: Clarify some comments, since there is no notion of function anymore. Index: implementations.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/implementations.testsuite,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** implementations.testsuite 15 Jan 2004 12:09:53 -0000 1.15 --- implementations.testsuite 7 Aug 2004 12:34:06 -0000 1.16 *************** *** 36,45 **** /// FAIL /// TOPLEVEL ! class A { ! void fA() {} // fA is a function } ! // Try to implement a function. This should fail gracefully. ! /*/// FAIL HERE */ fA(x@A) {} /// PASS --- 36,46 ---- /// FAIL /// TOPLEVEL ! class A { ! void fA() {} // default implementation } ! // Try to implement a method for a case equivalent to the default. ! // This should create an ambiguity. ! /*/// FAIL HERE */ fA(A a) {} /// PASS |
From: Daniel B. <bo...@us...> - 2004-08-07 11:17:52
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2002/testsuite/compiler/methods Modified Files: coverage.testsuite Log Message: An Object pattern is equivalent to non-nullness. Index: coverage.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/coverage.testsuite,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** coverage.testsuite 16 Dec 2003 11:39:10 -0000 1.2 --- coverage.testsuite 7 Aug 2004 11:17:43 -0000 1.3 *************** *** 36,37 **** --- 36,44 ---- <T> T foo(T x, Object o) = x; foo(String s, o) = ""; + + /// PASS bug + assert !foo(null); + assert foo(""); + /// Toplevel + <T> boolean foo(T x) = false; + foo(Object x) = true; |
From: Daniel B. <bo...@us...> - 2004-08-06 17:46:42
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12662/src/bossa/syntax Modified Files: typecheck.nice tools.nice Log Message: Fix array dimensions being overloaded symbols. Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** tools.nice 5 Aug 2004 10:45:30 -0000 1.44 --- tools.nice 6 Aug 2004 17:46:32 -0000 1.45 *************** *** 297,303 **** mlsub.typing.Polytype longPolytype() = native PrimitiveType.longPolytype; mlsub.typing.Monotype boolType() = native PrimitiveType.boolType; mlsub.typing.Monotype longType() = native PrimitiveType.longType; // Local Variables: ! // nice-xprogram: "../bin/nicec -d ../classes --sourcepath=../src" // End: --- 297,304 ---- mlsub.typing.Polytype longPolytype() = native PrimitiveType.longPolytype; mlsub.typing.Monotype boolType() = native PrimitiveType.boolType; + mlsub.typing.Monotype intType() = native PrimitiveType.intType; mlsub.typing.Monotype longType() = native PrimitiveType.longType; // Local Variables: ! // nice-xprogram: "../bin/nicec -d ../classes" // End: Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** typecheck.nice 5 Aug 2004 10:45:30 -0000 1.108 --- typecheck.nice 6 Aug 2004 17:46:32 -0000 1.109 *************** *** 630,642 **** { Expression[] knownDimensions = notNull(e.knownDimensions); ! typecheckExps(cast(knownDimensions)); for (int i=0; i<knownDimensions.length; i++) { ! Expression dim = knownDimensions[i]; try{ ! Typing.leq(dim.getType(), PrimitiveType.intPolytype); } catch(TypingEx ex){ ! if (notNullError(ex, dim, dim.toString())) bossa.util.User.error(dim, "" + dim + " should be an integer"); --- 630,643 ---- { Expression[] knownDimensions = notNull(e.knownDimensions); ! for (int i=0; i<knownDimensions.length; i++) { ! Expression dim = knownDimensions[i] = ! knownDimensions[i].resolveOverloading(PrimitiveType.intPolytype); try{ ! checkAssignment(PrimitiveType.intType, dim); } catch(TypingEx ex){ ! if (notNullError(ex, dim, dim.toString())) bossa.util.User.error(dim, "" + dim + " should be an integer"); |
From: Daniel B. <bo...@us...> - 2004-08-06 17:46:41
|
Update of /cvsroot/nice/Nice/testsuite/compiler/expressions/arrays In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12662/testsuite/compiler/expressions/arrays Modified Files: typing.testsuite Log Message: Fix array dimensions being overloaded symbols. Index: typing.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/expressions/arrays/typing.testsuite,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** typing.testsuite 21 Jul 2004 20:26:14 -0000 1.4 --- typing.testsuite 6 Aug 2004 17:46:32 -0000 1.5 *************** *** 20,21 **** --- 20,44 ---- /// PASS ?List<String>[] myArray = new List[10]; + + /// PASS + /// Toplevel + class ByteReader + { + int defaultSize = 100; + + byte[] alloc() = new byte[defaultSize]; + } + + class FastByteReader + { + int defaultSize = 1000; + } + + /// PASS + /// Toplevel + let int size = 10; + let String size = "size"; + + int size(String s) = s.length(); + + let byte[] buf = new byte[size]; |
From: Arjan B. <ar...@us...> - 2004-08-05 19:01:29
|
Update of /cvsroot/nice/Nice/src/bossa/link In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv389/F:/nice/src/bossa/link Modified Files: Dispatch.java Log Message: Don't use special tc's for testing boolean patterns. Index: Dispatch.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/link/Dispatch.java,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** Dispatch.java 3 Aug 2004 10:16:14 -0000 1.69 --- Dispatch.java 5 Aug 2004 19:01:19 -0000 1.70 *************** *** 450,455 **** List res = mlsub.typing.Enumeration.enumerate(cst, types, used); ! res = mergeNullCases(res, domains.length); ! return enumerateBooleans(res, domains.length); } --- 450,454 ---- List res = mlsub.typing.Enumeration.enumerate(cst, types, used); ! return mergeNullCases(res, domains.length); } *************** *** 527,560 **** } - /** Expand the 'boolean' case into 'true' and 'false'. - */ - private static List enumerateBooleans(List tags, int length) - { - if (tags.size() < 1) return tags; - - List res; - for (int pos = 0; pos < length; pos++) - { - res = new ArrayList(); - for (Iterator i = tags.iterator(); i.hasNext(); ) - { - TypeConstructor[] tc = (TypeConstructor[]) i.next(); - if (tc[pos] == PrimitiveType.boolTC) - { - // Create two copies of this case, one for true and one for false. - TypeConstructor[] tc2 = new TypeConstructor[tc.length]; - System.arraycopy(tc, 0, tc2, 0, tc.length); - tc[pos] = PrimitiveType.trueBoolTC; - res.add(tc); - tc2[pos] = PrimitiveType.falseBoolTC; - res.add(tc2); - } - else res.add(tc); - } - tags = res; - } - return tags; - } - /** Generate all combinations of non boolean values from the alternatives * @return List<ConstantExp> --- 526,529 ---- *************** *** 571,583 **** { Pattern pat = ((Alternative)i.next()).getPatterns()[pos]; ! if (pat.atNonBoolValue()) { isValue[pos] = true; ! if (pat.atEnum()) ! for (Iterator it = pat.getEnumValues().iterator(); it.hasNext(); ) ! valuesAtPos.add(it.next()); ! else ! valuesAtPos.add(pat.atValue); } } --- 540,554 ---- { Pattern pat = ((Alternative)i.next()).getPatterns()[pos]; ! if (pat.atEnumerableValue()) { isValue[pos] = true; ! for (Iterator it = pat.getEnumValues().iterator(); it.hasNext(); ) ! valuesAtPos.add(it.next()); ! } ! else if (pat.atSimpleValue()) ! { ! isValue[pos] = true; ! valuesAtPos.add(pat.atValue); } } |
From: Arjan B. <ar...@us...> - 2004-08-05 19:01:29
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv389/F:/nice/src/bossa/syntax Modified Files: ConstantExp.java Pattern.java PrimitiveType.java Log Message: Don't use special tc's for testing boolean patterns. Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** Pattern.java 4 Aug 2004 17:09:07 -0000 1.89 --- Pattern.java 5 Aug 2004 19:01:18 -0000 1.90 *************** *** 327,336 **** return false; - if (that.atBool()) - return this.atBool() && (this.atTrue() == that.atTrue()); - - if (this.atBool()) - return that.tc == PrimitiveType.boolTC; - if (this.atEnum() && that.atEnum()) return this.atValue.equals(that.atValue); --- 327,330 ---- *************** *** 351,356 **** return this.atIntValue() && that.matchesCompareValue(this.atValue.longValue()); ! if (that.atNonBoolValue()) ! return this.atNonBoolValue() && this.atValue.equals(that.atValue); if (this.tc == that.tc) --- 345,350 ---- return this.atIntValue() && that.matchesCompareValue(this.atValue.longValue()); ! if (that.atValue != null && !that.atNull() &&!that.atIntCompare()) ! return (this.atValue != null && !this.atNull() &&!this.atIntCompare()) && this.atValue.equals(that.atValue); if (this.tc == that.tc) *************** *** 373,377 **** if (this.atBool() && that.atBool()) ! return this.atTrue() ^ that.atTrue(); if (this.atReference() && that.atReference()) --- 367,371 ---- if (this.atBool() && that.atBool()) ! return ! this.atValue.equals(that.atValue); if (this.atReference() && that.atReference()) *************** *** 429,433 **** return false; ! if (atNonBoolValue() && !atEnum() ) return false; --- 423,427 ---- return false; ! if ((atValue != null) && ! atTypeMatchingValue()) return false; *************** *** 435,454 **** return Typing.testRigidLeq(tag, PrimitiveType.longTC); - if (tag == PrimitiveType.trueBoolTC) - { - if (atBool()) - return atTrue(); - - return tc == PrimitiveType.boolTC; - } - - if (tag == PrimitiveType.falseBoolTC) - { - if (atBool()) - return atFalse(); - - return tc == PrimitiveType.boolTC; - } - if (exactlyAt) return Typing.testRigidLeq(tag, tc) && Typing.testRigidLeq(tc, tag); --- 429,432 ---- *************** *** 465,469 **** return val.value instanceof Number && matchesCompareValue(val.longValue()); ! return atNonBoolValue() && atValue.equals(val); } --- 443,450 ---- return val.value instanceof Number && matchesCompareValue(val.longValue()); ! if (atNull()) ! return false; ! ! return (atValue != null) && atValue.equals(val); } *************** *** 523,529 **** { List res = new LinkedList(); - if (!atEnum()) - return res; List symbols = ((EnumDefinition)((EnumDefinition.EnumSymbol)atValue.value).getDefinition()).symbols; for (Iterator it = symbols.iterator(); it.hasNext(); ) --- 504,516 ---- { List res = new LinkedList(); + if (atBool()) + { + res.add(ConstantExp.makeBoolean(true, location)); + res.add(ConstantExp.makeBoolean(false, location)); + return res; + } + + // atEnum() List symbols = ((EnumDefinition)((EnumDefinition.EnumSymbol)atValue.value).getDefinition()).symbols; for (Iterator it = symbols.iterator(); it.hasNext(); ) *************** *** 769,773 **** if (atBool()) { ! if (atFalse()) return Gen.boolNotExp(parameter); --- 756,760 ---- if (atBool()) { ! if (atValue.isFalse()) return Gen.boolNotExp(parameter); *************** *** 832,838 **** atValue.value instanceof Character); } - public boolean atNonBoolValue() { - return atValue != null && !atBool() && !atNull() &&!atIntCompare(); - } public boolean atNull() { return (atValue != null) && atValue.isNull(); } /** This pattern only specifies that the vlaue is not null. --- 819,822 ---- *************** *** 846,851 **** return atValue != null && tc == PrimitiveType.boolTC; } - public boolean atTrue() { return atValue != null && atValue.isTrue(); } - public boolean atFalse() { return atValue != null && atValue.isFalse(); } public boolean atString() { return atValue instanceof StringConstantExp; } public boolean atReference() { return atValue != null && atValue.value instanceof VarSymbol; } --- 830,833 ---- *************** *** 853,856 **** public boolean atIntCompare() { return compareKind > 0;} public boolean atLess() { return compareKind == LT || compareKind == LE; } ! public boolean atTypeMatchingValue() { return atEnum() || atIntCompare(); } } --- 835,840 ---- public boolean atIntCompare() { return compareKind > 0;} public boolean atLess() { return compareKind == LT || compareKind == LE; } ! public boolean atTypeMatchingValue() { return atEnum() || atIntCompare() || atBool();} ! public boolean atSimpleValue() { return atString() || (atIntValue() && ! atIntCompare()); } ! public boolean atEnumerableValue() { return atBool() || atEnum(); } } Index: PrimitiveType.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/PrimitiveType.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PrimitiveType.java 30 Jul 2004 19:08:45 -0000 1.12 --- PrimitiveType.java 5 Aug 2004 19:01:18 -0000 1.13 *************** *** 95,100 **** { boolTC = tc; - trueBoolTC = new TypeConstructor("true"); - falseBoolTC = new TypeConstructor("false"); boolType = Monotype.sure(new MonotypeConstructor(tc, null)); boolPolytype = new Polytype(boolType); --- 95,98 ---- *************** *** 165,170 **** public static TypeConstructor byteTC, charTC, intTC, longTC, boolTC, shortTC, doubleTC, floatTC, arrayTC, voidTC; - //these two only for dispatch testing booleans - public static TypeConstructor trueBoolTC, falseBoolTC; public static mlsub.typing.Monotype byteType, charType, intType, longType, boolType, shortType, doubleType, floatType, voidType; --- 163,166 ---- Index: ConstantExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ConstantExp.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** ConstantExp.java 30 Jul 2004 19:08:45 -0000 1.50 --- ConstantExp.java 5 Aug 2004 19:01:18 -0000 1.51 *************** *** 313,316 **** --- 313,322 ---- } + public boolean equals(Object other) + { + return other instanceof ConstantExp.Boolean && + (isTrue() == ((ConstantExp.Boolean)other).isTrue()); + } + private QuoteExp compiledValue; } *************** *** 326,329 **** --- 332,338 ---- public boolean equals(Object other) { + if (other instanceof ConstantExp.Boolean) + return false; + return other instanceof ConstantExp && value.equals(((ConstantExp)other).value); |
From: Daniel B. <bo...@us...> - 2004-08-05 12:33:31
|
Update of /cvsroot/nice/Nice/src/nice/tools/testsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16051/src/nice/tools/testsuite Modified Files: TestCase.java NiceSourceFile.java Log Message: Cosmetic improvements on output. Index: TestCase.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/testsuite/TestCase.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** TestCase.java 5 Aug 2004 12:20:16 -0000 1.30 --- TestCase.java 5 Aug 2004 12:33:21 -0000 1.31 *************** *** 463,466 **** --- 463,468 ---- writer.close(); + TestNice.getOutput().log(""); + LineNumberReader lines = new LineNumberReader (new StringReader(contentWriter.toString())); Index: NiceSourceFile.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/testsuite/NiceSourceFile.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** NiceSourceFile.java 8 Dec 2003 18:37:11 -0000 1.18 --- NiceSourceFile.java 5 Aug 2004 12:33:21 -0000 1.19 *************** *** 47,51 **** * */ ! public static final String DEFAULT_PACKAGE = "defaultpackage"; /** --- 47,51 ---- * */ ! public static final String DEFAULT_PACKAGE = "testcase"; /** *************** *** 53,57 **** * */ ! private String _package = DEFAULT_PACKAGE + TestNice.getFileCounter(); /** * TODO --- 53,57 ---- * */ ! private String _package; /** * TODO *************** *** 235,252 **** */ public String getPackage() { return _package; } ! /** * Returns the file name. - * The file name is calculated prom the package name suffixed with - * <code>_main.nice</code> - * */ public String getFileName() { ! //return _fileName; ! return _package + "_main.nice"; } ! /** * Returns the class name. --- 235,251 ---- */ public String getPackage() { + if (_package == null) + _package = DEFAULT_PACKAGE + TestNice.getFileCounter(); + return _package; } ! /** * Returns the file name. */ public String getFileName() { ! return "main.nice"; } ! /** * Returns the class name. *************** *** 266,271 **** if (isEmpty()) return; ! ! File packageFolder = new File(TestNice.getTempFolder(), _package.replace('.', File.separatorChar)); if (! packageFolder.exists() && ! packageFolder.mkdirs()) throw new TestSuiteException("could not create folder: " + packageFolder); --- 265,270 ---- if (isEmpty()) return; ! ! File packageFolder = new File(TestNice.getTempFolder(), getPackage().replace('.', File.separatorChar)); if (! packageFolder.exists() && ! packageFolder.mkdirs()) throw new TestSuiteException("could not create folder: " + packageFolder); *************** *** 315,319 **** private void writePackage(BufferedWriter writer) throws IOException { writer.write("package "); ! writer.write(_package); writer.write(";"); writer.newLine(); --- 314,318 ---- private void writePackage(BufferedWriter writer) throws IOException { writer.write("package "); ! writer.write(getPackage()); writer.write(";"); writer.newLine(); *************** *** 393,395 **** --- 392,395 ---- // Local Variables: // tab-width: 2 + // indent-tabs-mode: t // End: |
From: Daniel B. <bo...@us...> - 2004-08-05 12:20:27
|
Update of /cvsroot/nice/Nice/src/nice/tools/testsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13643/src/nice/tools/testsuite Modified Files: TestCase.java Log Message: Provide source line numbers in stack traces when the generated code fails. Print line numbers when printing the testcase source. Index: TestCase.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/testsuite/TestCase.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** TestCase.java 30 Jun 2004 14:12:35 -0000 1.29 --- TestCase.java 5 Aug 2004 12:20:16 -0000 1.30 *************** *** 357,365 **** && ! _dontCompilePackages.contains(sourceFile.getPackage())) { try { Class c = Class.forName ! (sourceFile.getPackage() + ".fun", ! true, ! TestNice.getClassLoader()); Class[] parameterTypes = new Class[] {String[].class}; Method m = c.getMethod("main", parameterTypes); --- 357,364 ---- && ! _dontCompilePackages.contains(sourceFile.getPackage())) { + ClassLoader loader = TestNice.getClassLoader(); try { Class c = Class.forName ! (sourceFile.getPackage() + ".fun", true, loader); Class[] parameterTypes = new Class[] {String[].class}; Method m = c.getMethod("main", parameterTypes); *************** *** 371,375 **** } } catch(Throwable e) { ! e.printStackTrace(out); throw new TestSuiteException("Exception while invoking main()", e); } --- 370,375 ---- } } catch(Throwable e) { ! nice.lang.dispatch.printStackTraceWithSourceInfo ! (e, out, loader); throw new TestSuiteException("Exception while invoking main()", e); } *************** *** 462,468 **** contentWriter.close(); writer.close(); } catch(IOException e) {e.printStackTrace();} ! TestNice.getOutput().log("file " + sourceFile.getPackage() + "." + sourceFile.getFileName(), ! contentWriter.toString()); TestNice.getOutput().log(""); } --- 462,474 ---- contentWriter.close(); writer.close(); + + LineNumberReader lines = new LineNumberReader + (new StringReader(contentWriter.toString())); + String file = "file " + sourceFile.getPackage() + "." + sourceFile.getFileName(); + String line; + while ((line = lines.readLine()) != null) + TestNice.getOutput().log(file + ":" + lines.getLineNumber(), line); } catch(IOException e) {e.printStackTrace();} ! TestNice.getOutput().log(""); } *************** *** 540,542 **** --- 546,549 ---- // Local Variables: // tab-width: 2 + // indent-tabs-mode: t // End: |
From: Daniel B. <bo...@us...> - 2004-08-05 12:04:33
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10997/stdlib/nice/lang Modified Files: source-lines.nice Log Message: Accept a ClassLoader argument, which is useful when the code was loaded from a custom class loader. Index: source-lines.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/source-lines.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** source-lines.nice 25 Jun 2004 12:53:35 -0000 1.6 --- source-lines.nice 5 Aug 2004 12:04:21 -0000 1.7 *************** *** 32,38 **** public void printStackTraceWithSourceInfo(Throwable t, PrintStream s) = ! printStackTraceWithSourceInfo(t, new PrintWriter(s, true)); ! public void printStackTraceWithSourceInfo(Throwable t, PrintWriter w) { w.println("Exception in thread \"" Thread.currentThread().getName "\" " t); --- 32,46 ---- public void printStackTraceWithSourceInfo(Throwable t, PrintStream s) = ! printStackTraceWithSourceInfo(t, s, null); ! public void printStackTraceWithSourceInfo(Throwable t, PrintStream s, ! ?ClassLoader loader) = ! printStackTraceWithSourceInfo(t, new PrintWriter(s, true), loader); ! ! public void printStackTraceWithSourceInfo(Throwable t, PrintWriter w) = ! printStackTraceWithSourceInfo(t, w, null); ! ! public void printStackTraceWithSourceInfo(Throwable t, PrintWriter w, ! ?ClassLoader loader) { w.println("Exception in thread \"" Thread.currentThread().getName "\" " t); *************** *** 41,46 **** let Object[] elements = cast(getSTMethod.invoke(t, null)); elements.foreach(Object e => { ! (?String file, int line) = ! getSourceLocation__(e.call__("getClassName"), e.call__("getLineNumber")) || (e.call__("getFileName"), e.call__("getLineNumber")); let location = --- 49,54 ---- let Object[] elements = cast(getSTMethod.invoke(t, null)); elements.foreach(Object e => { ! (?String file, int line) = ! getSourceLocation__(e.call__("getClassName"), e.call__("getLineNumber"), loader) || (e.call__("getFileName"), e.call__("getLineNumber")); let location = *************** *** 94,101 **** /** Fetch the SourceDebugExtension attribute from a compiled class. */ ! ?String sourceDebugExtension__(String className) { let resourceName = className.replace('.', '/') + ".class"; ! let ?InputStream inputStream = java.lang.ClassLoader.getSystemResourceAsStream(resourceName); if (inputStream == null) return null; --- 102,114 ---- /** Fetch the SourceDebugExtension attribute from a compiled class. */ ! ?String sourceDebugExtension__(String className, ?ClassLoader loader) { let resourceName = className.replace('.', '/') + ".class"; ! ! let ?InputStream inputStream = ! loader == null ! ? java.lang.ClassLoader.getSystemResourceAsStream(resourceName) ! : loader.getResourceAsStream(resourceName); ! if (inputStream == null) return null; *************** *** 197,208 **** outStart = Integer.parseInt(line.substring(pos + 1)); outInc = 1; ! } return (start, id, repeat, outStart, outInc); } ! ?(String,int) getSourceLocation__(String className, int lineNumber) { ! let map = sourceDebugExtension__(className); if (map == null) return null; --- 210,222 ---- outStart = Integer.parseInt(line.substring(pos + 1)); outInc = 1; ! } return (start, id, repeat, outStart, outInc); } ! ?(String,int) getSourceLocation__(String className, int lineNumber, ! ?ClassLoader loader) { ! let map = sourceDebugExtension__(className, loader); if (map == null) return null; |
From: Daniel B. <bo...@us...> - 2004-08-05 11:24:12
|
Update of /cvsroot/nice/Nice/src/nice/tools/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4131/src/nice/tools/util Modified Files: DirectoryClassLoader.java Log Message: Make DirectoryClassLoader also find resources. Index: DirectoryClassLoader.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/util/DirectoryClassLoader.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DirectoryClassLoader.java 28 Nov 2003 02:57:13 -0000 1.1 --- DirectoryClassLoader.java 5 Aug 2004 11:24:02 -0000 1.2 *************** *** 37,41 **** * This is the method where the task of class loading * is delegated to our custom loader. ! * * @param name the name of the class * @return the resulting <code>Class</code> object --- 37,41 ---- * This is the method where the task of class loading * is delegated to our custom loader. ! * * @param name the name of the class * @return the resulting <code>Class</code> object *************** *** 78,80 **** --- 78,100 ---- } } + + protected java.net.URL findResource(String name) + { + for (int i = 0; i < dirs.length; i++) + { + File res = new File(dirs[i], name); + if (res.exists()) + try { + return res.toURL(); + } + catch(java.net.MalformedURLException e) { + // TODO: probably use the following when we drop JDK 1.3: + // throw new RuntimeException(e); + + return null; + } + } + + return null; + } } |
From: Arjan B. <ar...@us...> - 2004-08-05 10:45:42
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30128/F:/nice/src/bossa/syntax Modified Files: Contract.java Expression.java analyse.nice assign.nice dispatch.java.bootstrap loop.nice new.nice overloadedsymbol.nice tools.nice typecheck.nice Added Files: call.nice Removed Files: CallExp.java Log Message: Converted CallExp to nice code. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** analyse.nice 30 Jul 2004 19:08:45 -0000 1.107 --- analyse.nice 5 Aug 2004 10:45:29 -0000 1.108 *************** *** 512,518 **** if (sym.isNonStaticFieldAccess() && Node.thisExp != null) { ! CallExp res = new CallExp ! (createOverloadedSymbolExp(symbols, notNull(e.ident)), ! new Arguments([new Arguments.Argument(Node.thisExp)])); res.setLocation(e.location()); return res; --- 512,517 ---- if (sym.isNonStaticFieldAccess() && Node.thisExp != null) { ! CallExp res = new CallExp(function: createOverloadedSymbolExp(symbols, notNull(e.ident)), ! arguments: new Arguments([new Arguments.Argument(Node.thisExp)])); res.setLocation(e.location()); return res; *************** *** 522,528 **** { // Make an implicit call to fetch the static field's value. ! CallExp res = new CallExp ! (createOverloadedSymbolExp(symbols, notNull(e.ident)), ! Arguments.noArguments()); res.setLocation(e.location()); return res; --- 521,526 ---- { // Make an implicit call to fetch the static field's value. ! CallExp res = new CallExp(function: createOverloadedSymbolExp(symbols, notNull(e.ident)), ! arguments: Arguments.noArguments()); res.setLocation(e.location()); return res; --- CallExp.java DELETED --- Index: Expression.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Expression.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** Expression.java 3 Aug 2004 14:36:05 -0000 1.56 --- Expression.java 5 Aug 2004 10:45:29 -0000 1.57 *************** *** 104,118 **** /** - * Resolves overloading, taking into account the parameters - * the expressions is applied to. - * - * @return the resolved expression. Doesn't return if OR is not possible. - */ - Expression resolveOverloading(CallExp callExp) - { - return this; - } - - /** * Resolve overloading, assuming that this expression * should have some Type. --- 104,107 ---- Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** typecheck.nice 4 Aug 2004 08:45:45 -0000 1.107 --- typecheck.nice 5 Aug 2004 10:45:30 -0000 1.108 *************** *** 28,31 **** --- 28,39 ---- ****************************************************************/ + /** + * Resolves overloading, taking into account the parameters + * the expressions is applied to. + * + * @return the resolved expression. Doesn't return if OR is not possible. + */ + Expression resolveOverloading(Expression exp, CallExp callExp) = exp; + typecheck(null(Expression)) {} Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** tools.nice 4 Aug 2004 18:36:09 -0000 1.43 --- tools.nice 5 Aug 2004 10:45:30 -0000 1.44 *************** *** 283,287 **** List<VarSymbol> findJavaMethods(?gnu.bytecode.ClassType, String, int) = native List JavaClasses.findJavaMethods(gnu.bytecode.ClassType,java.lang.String,int); List<VarSymbol> findJavaMethods(?gnu.bytecode.ClassType, String) = native List JavaClasses.findJavaMethods(gnu.bytecode.ClassType,java.lang.String); - Arguments arguments(CallExp) = native CallExp.arguments; TypeParameters TypeParameters(List<Monotype>) = native new bossa.syntax.TypeParameters(List); Block Block(List<Statement>) = native new bossa.syntax.Block(List); --- 283,286 ---- Index: loop.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/loop.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** loop.nice 28 Jul 2004 14:40:33 -0000 1.1 --- loop.nice 5 Aug 2004 10:45:30 -0000 1.2 *************** *** 141,150 **** } ! let getiter = CallExp.create(new IdentExp(new LocatedString("forIterator", loc)), container); let iter = new LocatedString(loc.uniqueIdentifier("for_in_iter_"), loc); let init = new Block.LocalVariable(iter, itertype, true, getiter); let iterexp = new IdentExp(iter); ! let cond = CallExp.create(new IdentExp(new LocatedString("hasNext", loc)), iterexp); ! let getvar = CallExp.create(new IdentExp(new LocatedString("next", loc)), iterexp); let assign = new Block.LocalVariable(varName, vartype, true, getvar); let loop = createWhileLoop(cond, new Block(new LinkedList([assign, body]))); --- 141,150 ---- } ! let getiter = createCallExp(new IdentExp(new LocatedString("forIterator", loc)), container); let iter = new LocatedString(loc.uniqueIdentifier("for_in_iter_"), loc); let init = new Block.LocalVariable(iter, itertype, true, getiter); let iterexp = new IdentExp(iter); ! let cond = createCallExp(new IdentExp(new LocatedString("hasNext", loc)), iterexp); ! let getvar = createCallExp(new IdentExp(new LocatedString("next", loc)), iterexp); let assign = new Block.LocalVariable(varName, vartype, true, getvar); let loop = createWhileLoop(cond, new Block(new LinkedList([assign, body]))); Index: new.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/new.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** new.nice 4 Aug 2004 18:36:09 -0000 1.1 --- new.nice 5 Aug 2004 10:45:30 -0000 1.2 *************** *** 91,94 **** public Expression createNewExp(TypeIdent ti, Arguments arguments) { ! return new NewExp(null, arguments, ti: ti); } \ No newline at end of file --- 91,94 ---- public Expression createNewExp(TypeIdent ti, Arguments arguments) { ! return new NewExp(function: cast(null), arguments: arguments, ti: ti); } \ No newline at end of file Index: overloadedsymbol.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/overloadedsymbol.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** overloadedsymbol.nice 29 Jul 2004 18:30:08 -0000 1.2 --- overloadedsymbol.nice 5 Aug 2004 10:45:30 -0000 1.3 *************** *** 128,132 **** s.getClonedType(), arguments.getUsedArguments(s)); ! ?mlsub.typing.Polytype t = CallExp.wellTyped(s.getClonedType(), argsType); if (t == null) --- 128,132 ---- s.getClonedType(), arguments.getUsedArguments(s)); ! ?mlsub.typing.Polytype t = wellTyped(s.getClonedType(), argsType); if (t == null) *************** *** 166,170 **** let res = symbols[0]; // store the formal argument types for later use together with the type ! callExp.setComputedType(arguments.types.get(res), nice.tools.typing.Types.parameters(res.getClonedType())); res.releaseClonedType(); --- 166,170 ---- let res = symbols[0]; // store the formal argument types for later use together with the type ! callExp.setComputedType(notNull(arguments.types.get(res)), nice.tools.typing.Types.parameters(res.getClonedType())); res.releaseClonedType(); *************** *** 328,335 **** if (Node.thisExp != null) try { ! let res = new CallExp ! (createOverloadedSymbolExp(fieldAccesses, ident, true), //Arguments.noArguments()); ! new Arguments([new Arguments.Argument(Node.thisExp)])); res.setLocation(ident.location()); --- 328,334 ---- if (Node.thisExp != null) try { ! let res = new CallExp(function: createOverloadedSymbolExp(fieldAccesses, ident, true), //Arguments.noArguments()); ! arguments: new Arguments([new Arguments.Argument(Node.thisExp)])); res.setLocation(ident.location()); Index: assign.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/assign.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** assign.nice 28 Jul 2004 14:40:33 -0000 1.1 --- assign.nice 5 Aug 2004 10:45:30 -0000 1.2 *************** *** 40,44 **** // Rewrite "get(e, i) = v" into "set(e, i, v)" if (to instanceof CallExp && "get".equals(notNull(to.function).toString())) ! return CallExp.create( new IdentExp(new LocatedString("set", notNull(to.function).location())), to.arguments.getExp(0), --- 40,44 ---- // Rewrite "get(e, i) = v" into "set(e, i, v)" if (to instanceof CallExp && "get".equals(notNull(to.function).toString())) ! return createCallExp( new IdentExp(new LocatedString("set", notNull(to.function).location())), to.arguments.getExp(0), --- NEW FILE: call.nice --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2004 */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /**************************************************************************/ package bossa.syntax; import bossa.util.*; /** A function call. */ public class CallExp extends Expression { Expression function; Arguments arguments; /** true iff the first argument was written before the application: e.f(x) */ final boolean infix = false; /** true iff this call was made using brackets (i.e. not like 'x.f'). */ public final boolean hasBrackets = true; /** Class this static method is defined in, or null */ ?gnu.bytecode.ClassType declaringClass = null; ExpLocalVariable[?] localVars = null; /** The type of the function, constrained by the actual arguments. */ private ?mlsub.typing.Polytype instanciatedDomain = null; private boolean overloadingResolved = false; /**************************************************************** * Overloading resolution ****************************************************************/ void resolveOverloading() { // do not resolve twice if (overloadingResolved) return; overloadingResolved = true; arguments.noOverloading(); function = function.resolveOverloading(this); function.checkSpecialRequirements(cast(arguments.computedExpressions)); // make sure computedExpressions is valid. this.getType(); // Allow expressions to know in what context they are used. // Important for litteral arrays and tuples. Expression.adjustToExpectedType(cast(arguments.computedExpressions), nice.tools.typing.Types.parameters(function.getType())); } computeType() { this.resolveOverloading(); if (type == null) // function should be a function abstraction here // no default arguments { this.setComputedType(notNull(getTypeAndReportErrors(this.location(), function, arguments.inOrder())), null); arguments.computedExpressions = cast(arguments.inOrder()); } } /** @param argTypes The types of the formal arguments of the function, in the same polymorphic instance as the computed type. */ void setComputedType(mlsub.typing.Polytype type, mlsub.typing.Monotype[?] argTypes) { this.type = type; if (! type.isMonomorphic() && argTypes != null) { /* We construct the instantiated version of the function type: the type of the function, constrained by the actual arguments. Then we simplify it. It is useful to constrain the arguments to have the expected bytecode types. */ instanciatedDomain = new mlsub.typing.Polytype(type.getConstraint(), new mlsub.typing.TupleType(argTypes)); instanciatedDomain = notNull(instanciatedDomain).cloneType(); // By default, a polytype is supposed to be simplified. notNull(instanciatedDomain).setNotSimplified(); notNull(instanciatedDomain).simplify(); } if (! type.trySimplify()) User.warning(this, "This call might have a type error, or this might be a bug in the compiler. \nPlease contact bo...@us..."); } isAssignable() { this.resolveOverloading(); return function.isFieldAccess(); } /** @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. */ getField() { this.resolveOverloading(); return function.getFieldAccessMethod(); } /**************************************************************** * Code generation ****************************************************************/ compile() { ?gnu.expr.LetExp firstLetExp = null; ?gnu.expr.Expression letExpRes = null; if (localVars != null) { for(int i = notNull(localVars).length-1; i >= 0; i--) { gnu.expr.Expression[] eVal = cast(new gnu.expr.Expression[1]); gnu.expr.LetExp letExp = new gnu.expr.LetExp(eVal); eVal[0] = notNull(notNull(localVars)[i].variable).compile(letExp); if (i == notNull(localVars).length-1) { firstLetExp = letExp; } else { letExp.setBody(letExpRes); } letExpRes = letExp; } } gnu.expr.Expression res; if (function.isFieldAccess()) res = function.getFieldAccessMethod().compileAccess(this.compileParams()); else res = new gnu.expr.ApplyExp(function.generateCodeInCallPosition(), this.compileParams()); this.location().write(res); if (firstLetExp != null) { firstLetExp.setBody(res); res = notNull(letExpRes); } return nice.tools.code.EnsureTypeProc.ensure(res, nice.tools.code.Types.javaType(type)); } private gnu.expr.Expression[] compileParams() { bossa.syntax.Expression[] compexps = cast(arguments.computedExpressions); gnu.expr.Expression[] params = Expression.compile(compexps); // Make sure the arguments have the expected bytecode type, // matching the instantiated type of the (polymorphic) function. mlsub.typing.Monotype[?] domain = null; if (instanciatedDomain != null) { mlsub.typing.TupleType mtype = cast(notNull(instanciatedDomain).getMonotype()); domain = mtype.getComponents(); } if (domain != null) for (int i = 0; i < params.length; i++) params[i] = nice.tools.code.EnsureTypeProc.ensure (params[i], nice.tools.code.Types.javaType(domain[i])); return params; } compileAssign(gnu.expr.Expression value) { if (!function.isFieldAccess()) Internal.error(this, "Assignment to a call that is not a field access"); FieldAccess access = function.getFieldAccessMethod(); if (access.isFinal()) User.error(this, "Field " + access + " is final"); if (arguments.size() == 0) return access.compileAssign(value); if (arguments.size() == 1) return access.compileAssign(arguments.getExp(0).generateCode(), value); Internal.error(this, "A field access should have 0 or 1 parameter"); return cast(null); } toString() { if (!infix) return function.toString(Printable.parsable) + arguments; if (declaringClass == null) return arguments.getExp(0) + "." + function + arguments.toStringInfix(); if (function instanceof SymbolExp) { SymbolExp func = cast(function); Definition def = func.getSymbol().getDefinition(); if (def instanceof RetypedJavaMethod) return func.toString() + arguments; if (def instanceof JavaFieldAccess) return notNull(declaringClass).getName() + "." + def.fieldName + arguments; } return notNull(declaringClass).getName() + "." + function + arguments; } } public Expression createCallExp(Expression function, Expression param1) { let res = new CallExp(function:function, arguments:new Arguments([new Arguments.Argument(param1)])); res.setLocation(function.location()); return res; } public Expression createCallExp(Expression function, Expression param1, Expression param2) { let res = new CallExp(function:function, arguments:new Arguments([new Arguments.Argument(param1), new Arguments.Argument(param2)])); res.setLocation(function.location()); return res; } public Expression createCallExp(Expression function, Expression param1, Expression param2, Expression param3) { let res = new CallExp(function:function, arguments:new Arguments([new Arguments.Argument(param1), new Arguments.Argument(param2), new Arguments.Argument(param3)])); res.setLocation(function.location()); return res; } public Expression createCallExp(Expression func, Arguments args, boolean infix, boolean hasBrackets) { return new CallExp(function: func, arguments: args, infix: infix, hasBrackets: hasBrackets); } public Expression createCallExp(Expression func, Arguments args) { return new CallExp(function: func, arguments: args); } public void addBlockArgument(Expression callexp, Statement block, LocatedString name) { let CallExp exp = cast(callexp); exp.arguments.add(createFunExp(bossa.syntax.Constraint.True, [], block), name); } ?mlsub.typing.Polytype wellTyped(mlsub.typing.Polytype funt, mlsub.typing.Polytype[] parameters) { try{ return getType(funt, parameters, true); } catch(ReportErrorEx e){} catch(mlsub.typing.TypingEx e){} catch(mlsub.typing.BadSizeEx e){} return null; } ?mlsub.typing.Polytype getTypeAndReportErrors(bossa.util.Location loc, Expression function, Expression[] parameters) { mlsub.typing.Polytype[] paramTypes = Expression.getType(parameters); try{ return getType(function.getType(), paramTypes, false); } catch(BadSizeEx e){ User.error(loc, function.toString(Printable.detailed) + " expects " + e.expected + " parameters, " + "not " + e.actual); } catch(ReportErrorEx e){ User.error(loc, e.getMessage()); } catch(TypingEx e){ if (Typing.dbg) bossa.util.Debug.println(e.getMessage()); if (function.isFieldAccess()) { // There must be just one parameter in a field access User.error(loc, parameters[0] + " has no field " + function); } else { let end = "not within the domain of function \"" + function +"\""; if (parameters.length >= 2) User.error(loc,"Parameters \n"+ Util.map("(",", ",")",parameters) + "\n of types \n" + Util.map("(",",\n ",")",paramTypes) + "\n are "+end); else User.error(loc,"Parameter "+ Util.map("",", ","",parameters) + " of type " + Util.map("",", ","",paramTypes) + " is "+end); } } return null; } /** @param tentative whether we only want to check if the call is valid (as during overloading resolution). */ private mlsub.typing.Polytype getType(mlsub.typing.Polytype type, mlsub.typing.Polytype[] parameters, boolean tentative) { mlsub.typing.Monotype m = type.getMonotype(); // Check that the function cannot be null if (m.head() == null) throw new ReportErrorEx("Nullness check"); try{ mlsub.typing.Typing.leq(m.head(), PrimitiveType.sureTC); } catch(TypingEx ex) { throw new ReportErrorEx("This function may be null"); } m = nice.tools.typing.Types.rawType(m); // The function might not be of a functional kind. // Only usefull for null? // First reset the kind, that comes from a previous typing. if (m.getKind() == mlsub.typing.lowlevel.Engine.variablesConstraint) m.setKind(null); if (m.getKind() == null) m.setKind(mlsub.typing.FunTypeKind.get(parameters.length)); m = m.equivalent(); if (!(m instanceof mlsub.typing.FunType)) throw new ReportErrorEx("Not a function"); mlsub.typing.FunType funt = m; let dom = funt.domain(); let ?mlsub.typing.Constraint cst = type.getConstraint(); let doEnter = true; //Constraint.hasBinders(cst); if (doEnter) mlsub.typing.Typing.enter(tentative); boolean ok = false; try { try{ mlsub.typing.Constraint.enter(cst); } catch(mlsub.typing.TypingEx e) { throw new ReportErrorEx("The conditions for using this function are not fullfiled"); } if (mlsub.typing.Typing.dbg) { bossa.util.Debug.println("Parameters:\n" + Util.map("",", ","\n",parameters)); bossa.util.Debug.println("Domain:\n" + Util.map("",", ","\n",dom)); } mlsub.typing.Typing.in(parameters, dom); ok = true; } finally{ if(doEnter) // If we are in tentative mode and the call is valid, then // we make the effects last (that's only important when there are // existential type variables in the context). mlsub.typing.Typing.leave(tentative, tentative && ok); } return mlsub.typing.Polytype.apply(cst, funt, parameters); } class ReportErrorEx extends Exception {} Index: Contract.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Contract.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Contract.java 25 Feb 2004 11:23:29 -0000 1.8 --- Contract.java 5 Aug 2004 10:45:29 -0000 1.9 *************** *** 27,31 **** public void addRequire(Expression condition) { ! pre.add(CallExp.create(symbol(assertName, condition), condition)); requireRepr.append(condition).append(','); } --- 27,31 ---- public void addRequire(Expression condition) { ! pre.add(bossa.syntax.dispatch.createCallExp(symbol(assertName, condition), condition)); requireRepr.append(condition).append(','); } *************** *** 33,37 **** public void addRequire(Expression condition, Expression name) { ! pre.add(CallExp.create(symbol(assertName, condition), condition, name)); requireRepr.append(condition).append(':').append(name).append(','); } --- 33,37 ---- public void addRequire(Expression condition, Expression name) { ! pre.add(bossa.syntax.dispatch.createCallExp(symbol(assertName, condition), condition, name)); requireRepr.append(condition).append(':').append(name).append(','); } *************** *** 39,43 **** public void addEnsure(Expression condition) { ! post.add(CallExp.create(symbol(assertName, condition), condition)); ensureRepr.append(condition); } --- 39,43 ---- public void addEnsure(Expression condition) { ! post.add(bossa.syntax.dispatch.createCallExp(symbol(assertName, condition), condition)); ensureRepr.append(condition); } *************** *** 45,49 **** public void addEnsure(Expression condition, Expression name) { ! post.add(CallExp.create(symbol(assertName, condition), condition, name)); ensureRepr.append(condition).append(':').append(name).append(','); } --- 45,49 ---- public void addEnsure(Expression condition, Expression name) { ! post.add(bossa.syntax.dispatch.createCallExp(symbol(assertName, condition), condition, name)); ensureRepr.append(condition).append(':').append(name).append(','); } Index: dispatch.java.bootstrap =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/dispatch.java.bootstrap,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** dispatch.java.bootstrap 4 Aug 2004 18:36:09 -0000 1.17 --- dispatch.java.bootstrap 5 Aug 2004 10:45:30 -0000 1.18 *************** *** 31,34 **** --- 31,51 ---- { return null; } + public static Expression createCallExp(Expression function, Expression param1) + { return null; } + + public static Expression createCallExp(Expression function, Expression param1, Expression param2) + { return null; } + + public static Expression createCallExp(Expression function, Expression param1, Expression param2, Expression param3) + { return null; } + + public static Expression createCallExp(Expression func, Arguments args, boolean infix, boolean hasBrackets) + { return null; } + + public static Expression createCallExp(Expression func, Arguments args) + { return null; } + + public static void addBlockArgument(Expression callexp, Statement block, LocatedString name) {} + public static gnu.bytecode.Method getImplementationAbove(JavaMethod decl, gnu.bytecode.ClassType firstArg) { return null; } |
From: Arjan B. <ar...@us...> - 2004-08-05 10:45:38
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30128/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Converted CallExp to nice code. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.252 retrieving revision 1.253 diff -C2 -d -r1.252 -r1.253 *** Parser.jj 4 Aug 2004 18:36:06 -0000 1.252 --- Parser.jj 5 Aug 2004 10:45:29 -0000 1.253 *************** *** 1950,1954 **** { if(op.image.length()!=1) ! e2=CallExp.create(symb(op.image.substring(0, 1),op),e1,e2); e1=bossa.syntax.dispatch.createAssignExp(e1,e2); --- 1950,1954 ---- { if(op.image.length()!=1) ! e2=bossa.syntax.dispatch.createCallExp(symb(op.image.substring(0, 1),op),e1,e2); e1=bossa.syntax.dispatch.createAssignExp(e1,e2); *************** *** 2010,2014 **** e1=ConditionalAndExpression() ( t="||" e2=ConditionalOrExpression() ! { e1=CallExp.create(symb(t), e1, e2); } )? { return e1; } } --- 2010,2014 ---- e1=ConditionalAndExpression() ( t="||" e2=ConditionalOrExpression() ! { e1=bossa.syntax.dispatch.createCallExp(symb(t), e1, e2); } )? { return e1; } } *************** *** 2019,2023 **** e1=InclusiveOrExpression() ( t="&&" e2=ConditionalAndExpression() ! { e1=CallExp.create(symb(t), e1, e2); } )? { return e1; } } --- 2019,2023 ---- e1=InclusiveOrExpression() ( t="&&" e2=ConditionalAndExpression() ! { e1=bossa.syntax.dispatch.createCallExp(symb(t), e1, e2); } )? { return e1; } } *************** *** 2028,2032 **** e1=ExclusiveOrExpression() ( t="|" e2=ExclusiveOrExpression() ! { e1=CallExp.create(symb(t),e1,e2); } )* { return e1; } } --- 2028,2032 ---- e1=ExclusiveOrExpression() ( t="|" e2=ExclusiveOrExpression() ! { e1=bossa.syntax.dispatch.createCallExp(symb(t),e1,e2); } )* { return e1; } } *************** *** 2037,2041 **** e1=AndExpression() ( t="^" e2=AndExpression() ! { e1=CallExp.create(symb(t),e1,e2); } )* { return e1; } } --- 2037,2041 ---- e1=AndExpression() ( t="^" e2=AndExpression() ! { e1=bossa.syntax.dispatch.createCallExp(symb(t),e1,e2); } )* { return e1; } } *************** *** 2046,2050 **** e1=EqualityExpression() ( t="&" e2=EqualityExpression() ! { e1=CallExp.create(symb(t),e1,e2); } )* { return e1; } } --- 2046,2050 ---- e1=EqualityExpression() ( t="&" e2=EqualityExpression() ! { e1=bossa.syntax.dispatch.createCallExp(symb(t),e1,e2); } )* { return e1; } } *************** *** 2055,2059 **** e1=InstanceOfExpression() ( ( t="==" | t="!=" ) e2=InstanceOfExpression() ! { e1=CallExp.create(symb(t),e1,e2); } )* { return e1; } --- 2055,2059 ---- e1=InstanceOfExpression() ( ( t="==" | t="!=" ) e2=InstanceOfExpression() ! { e1=bossa.syntax.dispatch.createCallExp(symb(t),e1,e2); } )* { return e1; } *************** *** 2066,2070 **** [ { Token t; TypeConstantExp type; } t="instanceof" type=typeExpression() ! { type.isLiteral = true; return CallExp.create(symb(t), res, type); } ] { return res; } --- 2066,2070 ---- [ { Token t; TypeConstantExp type; } t="instanceof" type=typeExpression() ! { type.isLiteral = true; return bossa.syntax.dispatch.createCallExp(symb(t), res, type); } ] { return res; } *************** *** 2077,2084 **** ( (t=">"|t=">="|t="<"|t="<=") e2=RangeExpression() { ! if(e3 == null) e1=CallExp.create(symb(t),e1,e2); else { ! e1=CallExp.create(symb("&&",t),e1,CallExp.create(symb(t),e3,e2)); if (t.image.charAt(0) != t_prev.image.charAt(0)) User.error(makeLocation(t), "All chained comparisons should be in the same direction"); --- 2077,2084 ---- ( (t=">"|t=">="|t="<"|t="<=") e2=RangeExpression() { ! if(e3 == null) e1=bossa.syntax.dispatch.createCallExp(symb(t),e1,e2); else { ! e1=bossa.syntax.dispatch.createCallExp(symb("&&",t),e1,bossa.syntax.dispatch.createCallExp(symb(t),e3,e2)); if (t.image.charAt(0) != t_prev.image.charAt(0)) User.error(makeLocation(t), "All chained comparisons should be in the same direction"); *************** *** 2096,2100 **** e1=ShiftExpression() ( t=".." e2=ShiftExpression() ! { e1=CallExp.create(symb(t),e1,e2); } )* { return e1; } --- 2096,2100 ---- e1=ShiftExpression() ( t=".." e2=ShiftExpression() ! { e1=bossa.syntax.dispatch.createCallExp(symb(t),e1,e2); } )* { return e1; } *************** *** 2117,2121 **** else func = t1==null ? ">>" : ">>>"; ! e1=CallExp.create(symb(func,t),e1,e2); } )* { return e1; } --- 2117,2121 ---- else func = t1==null ? ">>" : ">>>"; ! e1=bossa.syntax.dispatch.createCallExp(symb(func,t),e1,e2); } )* { return e1; } *************** *** 2127,2131 **** e1=MultiplicativeExpression() ( ( t="+" | t="-" ) e2=MultiplicativeExpression() ! { e1=CallExp.create(symb(t),e1,e2); } )* { return e1; } --- 2127,2131 ---- e1=MultiplicativeExpression() ( ( t="+" | t="-" ) e2=MultiplicativeExpression() ! { e1=bossa.syntax.dispatch.createCallExp(symb(t),e1,e2); } )* { return e1; } *************** *** 2137,2141 **** e1=ExponentialExpression() ( (t="*"|t="/"|t="%") e2=ExponentialExpression() ! { e1=CallExp.create(symb(t),e1,e2); } )* { return e1; } --- 2137,2141 ---- e1=ExponentialExpression() ( (t="*"|t="/"|t="%") e2=ExponentialExpression() ! { e1=bossa.syntax.dispatch.createCallExp(symb(t),e1,e2); } )* { return e1; } *************** *** 2149,2153 **** // '**' has right associativity [ t="**" e2=ExponentialExpression() ! { e1=CallExp.create(symb(t),e1,e2); } ] { return e1; } --- 2149,2153 ---- // '**' has right associativity [ t="**" e2=ExponentialExpression() ! { e1=bossa.syntax.dispatch.createCallExp(symb(t),e1,e2); } ] { return e1; } *************** *** 2159,2163 **** ( ( ( t="~" | t="!" ) res=PrimaryExpression() ! { res=CallExp.create(symb(t),res); } | ( t="+" | t="-" ) res=PrimaryExpression() --- 2159,2163 ---- ( ( ( t="~" | t="!" ) res=PrimaryExpression() ! { res=bossa.syntax.dispatch.createCallExp(symb(t),res); } | ( t="+" | t="-" ) res=PrimaryExpression() *************** *** 2168,2172 **** } else ! res=CallExp.create(symb(t),res); } ) --- 2168,2172 ---- } else ! res=bossa.syntax.dispatch.createCallExp(symb(t),res); } ) *************** *** 2239,2243 **** { Token t; } t="[" res=Expression() "]" ! { return CallExp.create(symb("get",t,false),start,res); } | "." res=identExp() --- 2239,2243 ---- { Token t; } t="[" res=Expression() "]" ! { return bossa.syntax.dispatch.createCallExp(symb("get",t,false),start,res); } | "." res=identExp() *************** *** 2255,2263 **** else args.addReceiver(start); ! return new CallExp(res, args, true, hasBrackets); } | args = arguments(false) ! { return new CallExp(start, args); } } --- 2255,2263 ---- else args.addReceiver(start); ! return bossa.syntax.dispatch.createCallExp(res, args, true, hasBrackets); } | args = arguments(false) ! { return bossa.syntax.dispatch.createCallExp(start, args); } } *************** *** 2284,2290 **** | res=stringConstantExp() ( {Expression e;} e=StringLiteralSuffixExpression() ! { res = CallExp.create(symb("+", e.location()), res, e); } [ e=stringConstantExp() ! { res = CallExp.create(symb("+", e.location()), res, e); } ] )* --- 2284,2290 ---- | res=stringConstantExp() ( {Expression e;} e=StringLiteralSuffixExpression() ! { res = bossa.syntax.dispatch.createCallExp(symb("+", e.location()), res, e); } [ e=stringConstantExp() ! { res = bossa.syntax.dispatch.createCallExp(symb("+", e.location()), res, e); } ] )* *************** *** 2580,2584 **** block=Block() { if ( exp instanceof CallExp && ((CallExp)exp).hasBrackets && ! (exp instanceof NewExp) ) ! ((CallExp)exp).addBlockArgument(block, null); else throw bossa.util.User.error(exp,"Block arguments can only be added to normal function calls"); --- 2580,2584 ---- block=Block() { if ( exp instanceof CallExp && ((CallExp)exp).hasBrackets && ! (exp instanceof NewExp) ) ! bossa.syntax.dispatch.addBlockArgument(exp,block, null); else throw bossa.util.User.error(exp,"Block arguments can only be added to normal function calls"); *************** *** 2665,2669 **** { if(op.image.length()!=1) ! e2=CallExp.create(symb(op.image.substring(0, 1),op),e1,e2); e1=bossa.syntax.dispatch.createAssignExp(e1,e2); --- 2665,2669 ---- { if(op.image.length()!=1) ! e2=bossa.syntax.dispatch.createCallExp(symb(op.image.substring(0, 1),op),e1,e2); e1=bossa.syntax.dispatch.createAssignExp(e1,e2); *************** *** 2810,2814 **** { t="throw" e=Expression() ! { return new ExpressionStmt(CallExp.create(symb(t),e)); } } --- 2810,2814 ---- { t="throw" e=Expression() ! { return new ExpressionStmt(bossa.syntax.dispatch.createCallExp(symb(t),e)); } } *************** *** 2836,2840 **** Token t; Expression condition, message; ! CallExp call; } { --- 2836,2840 ---- Token t; Expression condition, message; ! Expression call; } { *************** *** 2842,2848 **** condition = SideEffectFreeExpression() ( ":" message = SideEffectFreeExpression() ! { call = CallExp.create(symb(t), condition, message); } | ! { call = CallExp.create(symb(t), condition); } ) { return new ExpressionStmt(call); } --- 2842,2848 ---- condition = SideEffectFreeExpression() ( ":" message = SideEffectFreeExpression() ! { call = bossa.syntax.dispatch.createCallExp(symb(t), condition, message); } | ! { call = bossa.syntax.dispatch.createCallExp(symb(t), condition); } ) { return new ExpressionStmt(call); } |
From: Arjan B. <ar...@us...> - 2004-08-04 18:36:18
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14627/F:/nice/src/bossa/syntax Modified Files: EnumDefinition.java dispatch.java.bootstrap tools.nice Added Files: new.nice Removed Files: NewExp.java Log Message: Converted NewExp to nice code. Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** tools.nice 4 Aug 2004 17:09:07 -0000 1.42 --- tools.nice 4 Aug 2004 18:36:09 -0000 1.43 *************** *** 291,295 **** Stack<bossa.link.Alternative> sortedAlternatives(MethodDeclaration) = native Stack bossa.link.Alternative.sortedAlternatives(MethodDeclaration); List<VarSymbol> getConstructorCallSymbols(NiceClass) = native List NiceClass.getConstructorCallSymbols(); ! // Retypings needed since java types are not strict. --- 291,295 ---- Stack<bossa.link.Alternative> sortedAlternatives(MethodDeclaration) = native Stack bossa.link.Alternative.sortedAlternatives(MethodDeclaration); List<VarSymbol> getConstructorCallSymbols(NiceClass) = native List NiceClass.getConstructorCallSymbols(); ! LinkedList<VarSymbol> getConstructors(mlsub.typing.TypeConstructor) = native LinkedList TypeConstructors.getConstructors(mlsub.typing.TypeConstructor); // Retypings needed since java types are not strict. Index: dispatch.java.bootstrap =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/dispatch.java.bootstrap,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dispatch.java.bootstrap 4 Aug 2004 17:09:07 -0000 1.16 --- dispatch.java.bootstrap 4 Aug 2004 18:36:09 -0000 1.17 *************** *** 28,31 **** --- 28,34 ---- { return null; } + public static Expression createNewExp(TypeIdent ti, Arguments arguments) + { return null; } + public static gnu.bytecode.Method getImplementationAbove(JavaMethod decl, gnu.bytecode.ClassType firstArg) { return null; } --- NEW FILE: new.nice --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2004 */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /**************************************************************************/ package bossa.syntax; import bossa.util.*; import java.util.*; /** Call of an object constructor. */ public class NewExp extends CallExp { private final TypeIdent ti; /** Can be null if the class instantiated is Object. */ ?mlsub.typing.TypeConstructor tc = null; void resolve(TypeMap typeScope) { mlsub.typing.TypeSymbol sym = ti.resolveToTypeSymbol(typeScope); if (sym == mlsub.typing.TopMonotype.instance) this.setObject(); else if (sym instanceof mlsub.typing.TypeConstructor) this.setTC(sym); else throw User.error(ti, ti + " is not a class" + sym.getClass()); } private void setTC(mlsub.typing.TypeConstructor tc) { this.tc = tc; if (! TypeConstructors.instantiable(tc)) { String message; if (TypeConstructors.isInterface(tc)) message = tc + " is an interface, it can't be instantiated"; else if (TypeConstructors.isClass(tc)) message = tc + " is an abstract class, it can't be instantiated"; else message = tc + " is a type variable, it can't be instantiated"; throw User.error(this, message); } // Make sure that the constructors have been created. ClassDefinition definition = ClassDefinition.get(tc); if (definition != null) definition.resolve(); LinkedList<VarSymbol> constructors = TypeConstructors.getConstructors(tc); if (constructors == null) { if (tc.arity() > 0) User.error(this, "Class " + tc + " has no constructor with " + tc.arity() + " type parameters.\n" + "A retyping is needed to use this constructor."); else User.error(this, "Class " + tc + " has no constructor"); } // the list of constructors must be cloned, as // OverloadedSymbolExp removes elements from it constructors = constructors.clone(); function = createOverloadedSymbolExp(constructors, new LocatedString("new " + tc, this.location())); } private void setObject() { JavaMethod method = JavaClasses.getObjectConstructor(); function = new SymbolExp(method.getSymbol(), ti.location()); } toString() = "new " + ti.toString() + arguments; } public Expression createNewExp(TypeIdent ti, Arguments arguments) { return new NewExp(null, arguments, ti: ti); } --- NewExp.java DELETED --- Index: EnumDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/EnumDefinition.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** EnumDefinition.java 28 Jul 2004 14:40:33 -0000 1.11 --- EnumDefinition.java 4 Aug 2004 18:36:08 -0000 1.12 *************** *** 108,112 **** ((MonoSymbol)fields.get(i)).getName())); ! this.value = new NewExp(new TypeIdent(enumName), new Arguments(args)); } --- 108,112 ---- ((MonoSymbol)fields.get(i)).getName())); ! this.value = bossa.syntax.dispatch.createNewExp(new TypeIdent(enumName), new Arguments(args)); } |
From: Arjan B. <ar...@us...> - 2004-08-04 18:36:18
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14627/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Converted NewExp to nice code. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.251 retrieving revision 1.252 diff -C2 -d -r1.251 -r1.252 *** Parser.jj 30 Jul 2004 19:08:45 -0000 1.251 --- Parser.jj 4 Aug 2004 18:36:06 -0000 1.252 *************** *** 1709,1713 **** { Arguments arguments; } arguments = arguments(false) ! { e = new NewExp(classe, arguments); e.setLocation(makeLocation(t)); return e; --- 1709,1713 ---- { Arguments arguments; } arguments = arguments(false) ! { e = bossa.syntax.dispatch.createNewExp(classe, arguments); e.setLocation(makeLocation(t)); return e; |
From: Arjan B. <ar...@us...> - 2004-08-04 17:09:17
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30696/F:/nice/src/bossa/syntax Modified Files: Pattern.java dispatch.java.bootstrap tools.nice Log Message: Moved resolveGlobalConstants() out of Pattern.java. Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** tools.nice 3 Aug 2004 14:36:05 -0000 1.41 --- tools.nice 4 Aug 2004 17:09:07 -0000 1.42 *************** *** 178,181 **** --- 178,266 ---- } + void resolveGlobalConstants(Pattern pattern) + { + ?VarSymbol findRefSymbol(LocatedString refName) + { + for (sym : Node.getGlobalScope().lookup(refName)) + { + if (sym instanceof GlobalVarDeclaration.GlobalVarSymbol || + sym instanceof EnumDefinition.EnumSymbol ) + return sym; + } + + return null; + } + + if (pattern.refName != null) + { + ?VarSymbol symbol = findRefSymbol(notNull(pattern.refName)); + if (symbol instanceof GlobalVarDeclaration.GlobalVarSymbol) + { + if (symbol.getValue() instanceof ConstantExp && symbol.constant) + { + ConstantExp val = cast(symbol.getValue()); + if (Typing.testRigidLeq(val.tc, PrimitiveType.longTC)) + { + pattern.tc = val.tc; + pattern.atValue = val; + return; + } + } + } + User.error(pattern.refName, notNull(pattern.refName).toString() + " is not a global constant with an integer value."); + } + + if (pattern.name == null) + return; + + ?VarSymbol symbol = findRefSymbol(notNull(pattern.name)); + if (symbol == null) + return; + + if (symbol instanceof EnumDefinition.EnumSymbol) + { + NewExp val = cast(symbol.getValue()); + + pattern.tc = val.tc; + pattern.atValue = new ConstantExp(null, pattern.tc, symbol, + notNull(pattern.name).toString(), pattern.location); + pattern.refName = pattern.name; + pattern.name = null; + return; + } + + if (! (symbol instanceof GlobalVarDeclaration.GlobalVarSymbol)) + return; + + if (symbol.getValue() instanceof ConstantExp) + { + if (!symbol.constant) + User.error(pattern.name, "" + pattern.name + " is not constant"); + + ConstantExp val = cast(symbol.getValue()); + + if (val.tc == PrimitiveType.floatTC) + return; + + if (val instanceof StringConstantExp) + pattern.typeConstructor = new TypeIdent(new LocatedString("java.lang.String", + pattern.location)); + pattern.tc = val.tc; + pattern.atValue = val; + pattern.name = null; + } + else if (symbol.getValue() instanceof NewExp) + { + NewExp val = cast(symbol.getValue()); + pattern.tc = val.tc; + pattern.atValue = new ConstantExp(null, pattern.tc, symbol, + notNull(pattern.name).toString(), pattern.location); + pattern.refName = pattern.name; + pattern.name = null; + } + else + User.error(pattern.name, "The value of " + pattern.name + " can't be used as pattern"); + } + // For bootstrap Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** Pattern.java 3 Aug 2004 14:36:05 -0000 1.88 --- Pattern.java 4 Aug 2004 17:09:07 -0000 1.89 *************** *** 169,260 **** } - private static VarSymbol findRefSymbol(LocatedString refName) - { - VarSymbol symbol = null; - for (Iterator it = Node.getGlobalScope().lookup(refName).iterator(); it.hasNext();) - { - Object sym = it.next(); - if (sym instanceof GlobalVarDeclaration.GlobalVarSymbol || - sym instanceof EnumDefinition.EnumSymbol ) - symbol = (VarSymbol)sym; - } - - return symbol; - } - - void resolveGlobalConstants() - { - if (refName != null) - { - VarSymbol sym = findRefSymbol(refName); - if (sym instanceof GlobalVarDeclaration.GlobalVarSymbol) - { - GlobalVarDeclaration.GlobalVarSymbol symbol = (GlobalVarDeclaration.GlobalVarSymbol)sym; - if (symbol.getValue() instanceof ConstantExp && symbol.constant) - { - ConstantExp val = (ConstantExp)symbol.getValue(); - if (Typing.testRigidLeq(val.tc, PrimitiveType.longTC)) - { - tc = val.tc; - atValue = val; - return; - } - } - } - User.error(refName, refName.toString() + " is not a global constant with an integer value."); - } - - if (name == null) - return; - - VarSymbol sym = findRefSymbol(name); - if (sym == null) - return; - - if (sym instanceof EnumDefinition.EnumSymbol) - { - EnumDefinition.EnumSymbol symbol = (EnumDefinition.EnumSymbol)sym; - NewExp val = (NewExp)symbol.getValue(); - - tc = val.tc; - atValue = new ConstantExp(null, tc, symbol, - name.toString(), location); - refName = name; - name = null; - return; - } - - GlobalVarDeclaration.GlobalVarSymbol symbol = (GlobalVarDeclaration.GlobalVarSymbol)sym; - if (symbol.getValue() instanceof ConstantExp) - { - if (!symbol.constant) - User.error(name, "" + name + " is not constant"); - - ConstantExp val = (ConstantExp)symbol.getValue(); - - if (val.tc == PrimitiveType.floatTC) - return; - - if (val instanceof StringConstantExp) - typeConstructor = new TypeIdent(new LocatedString("java.lang.String", - location)); - tc = val.tc; - atValue = val; - name = null; - } - else if (symbol.getValue() instanceof NewExp) - { - NewExp val = (NewExp)symbol.getValue(); - - tc = val.tc; - atValue = new ConstantExp(null, tc, symbol, - name.toString(), location); - refName = name; - name = null; - } - else - User.error(name, "The value of " + name + " can't be used as pattern"); - } - static void resolve(TypeScope tscope, VarScope vscope, Pattern[] patterns) { --- 169,172 ---- *************** *** 267,271 **** { for(int i = 0; i < patterns.length; i++) { ! patterns[i].resolveGlobalConstants(); } } --- 179,183 ---- { for(int i = 0; i < patterns.length; i++) { ! bossa.syntax.dispatch.resolveGlobalConstants(patterns[i]); } } *************** *** 808,826 **** Location.nowhere()); ! VarSymbol sym = findRefSymbol(refName); ! NewExp val; ! if (sym instanceof GlobalVarDeclaration.GlobalVarSymbol ) ! { ! GlobalVarDeclaration.GlobalVarSymbol symbol = (GlobalVarDeclaration.GlobalVarSymbol)sym; ! val = (NewExp)symbol.getValue(); ! } ! else ! { ! EnumDefinition.EnumSymbol symbol = (EnumDefinition.EnumSymbol) sym; ! val = (NewExp)symbol.getValue(); ! } ! ! return new Pattern(new ConstantExp(null, val.tc, sym, ! refName.toString(), refName.location())); } } --- 720,726 ---- Location.nowhere()); ! Pattern res = new Pattern(refName); ! bossa.syntax.dispatch.resolveGlobalConstants(res); ! return res; } } *************** *** 905,909 **** LocatedString name,refName; ! private TypeIdent typeConstructor, additional; TypeConstructor tc; TypeConstructor tc2; --- 805,810 ---- LocatedString name,refName; ! TypeIdent typeConstructor; ! private TypeIdent additional; TypeConstructor tc; TypeConstructor tc2; Index: dispatch.java.bootstrap =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/dispatch.java.bootstrap,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** dispatch.java.bootstrap 2 Aug 2004 19:10:58 -0000 1.15 --- dispatch.java.bootstrap 4 Aug 2004 17:09:07 -0000 1.16 *************** *** 36,39 **** --- 36,41 ---- static void resolveCCThis(Statement stmt, bossa.util.Located thisloc, NiceClass classe) {} + static void resolveGlobalConstants(Pattern pattern) {} + static Statement analyse(Statement s, VarScope v, TypeScope t, boolean r) { return null; } |
From: Francis B. <fb...@us...> - 2004-08-04 14:54:46
|
Update of /cvsroot/nice/Nice/src/nice/tools/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4049/src/nice/tools/doc Modified Files: comment.nice htmlwriter.nice Log Message: htmlwriter.nice: Cosmetic changes to the output. comment.nice: typo fixed in one of the doc comments. Index: htmlwriter.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/doc/htmlwriter.nice,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** htmlwriter.nice 31 Jul 2004 08:10:05 -0000 1.12 --- htmlwriter.nice 4 Aug 2004 14:54:21 -0000 1.13 *************** *** 108,116 **** Comment c = new Comment(commentStr: comments); List<(?String, String)> tags = c.tags; writer.write("<table>\n"); for((?String, String) tag : tags) { writer.write("<tr>\n"); (?String x, String y) = tag; ! writer.write("<td>" x "</td>\n"); writer.write("<td>" y "</td>\n"); writer.write("</tr>\n"); --- 108,121 ---- Comment c = new Comment(commentStr: comments); List<(?String, String)> tags = c.tags; + //write the general comment + (?String a, String b) = tags.removeAt(0); + writer.write("<div class='generalComment' >\n"); + writer.write(b + "\n"); + writer.write("</div\n"); writer.write("<table>\n"); for((?String, String) tag : tags) { writer.write("<tr>\n"); (?String x, String y) = tag; ! writer.write("<td style='font-style: italic'>" x ":</td>\n"); writer.write("<td>" y "</td>\n"); writer.write("</tr>\n"); *************** *** 118,124 **** writer.write("</table>\n"); } - else - comments = "null"; - writer.write(comments + "\n"); writer.write("</p>\n"); --- 123,126 ---- Index: comment.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/doc/comment.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** comment.nice 1 Aug 2004 04:42:14 -0000 1.5 --- comment.nice 4 Aug 2004 14:54:21 -0000 1.6 *************** *** 18,22 **** * strings to values. The value <b>null</b> maps to the general comment. * The constructor of this class should be used put a comment block in ! * <i>commentStr</i> (the default value is the empty string. * @author Francis Barber */ --- 18,22 ---- * strings to values. The value <b>null</b> maps to the general comment. * The constructor of this class should be used put a comment block in ! * <i>commentStr</i> (the default value is the empty string). * @author Francis Barber */ |
From: Daniel B. <bo...@us...> - 2004-08-04 08:45:53
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12366/src/bossa/syntax Modified Files: typecheck.nice Log Message: Typos. Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** typecheck.nice 3 Aug 2004 14:36:05 -0000 1.106 --- typecheck.nice 4 Aug 2004 08:45:45 -0000 1.107 *************** *** 672,676 **** if (! target.used) ! bossa.util.User.warning(decl, "Unused local variable " + target.name); ?mlsub.typing.Monotype type = target.getMonotype(); --- 672,676 ---- if (! target.used) ! bossa.util.User.warning(decl, "Unused local variable " + target.name); ?mlsub.typing.Monotype type = target.getMonotype(); *************** *** 742,746 **** if (! target.used) ! bossa.util.User.warning(decl, "Unused local variable " + target.name); ?Expression value = decl.value; --- 742,746 ---- if (! target.used) ! bossa.util.User.warning(decl, "Unused local variable " + target.name); ?Expression value = decl.value; *************** *** 783,787 **** { if (! notNull(decl.left).used) ! bossa.util.User.warning(decl, " Unused local variable " + notNull(decl.left).name); typecheck(decl.value); --- 783,787 ---- { if (! notNull(decl.left).used) ! bossa.util.User.warning(decl, "Unused local variable " + notNull(decl.left).name); typecheck(decl.value); |
From: Arjan B. <ar...@us...> - 2004-08-03 17:27:49
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv848/Nice Modified Files: NEWS Log Message: updated news file. Index: NEWS =================================================================== RCS file: /cvsroot/nice/Nice/NEWS,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** NEWS 30 Jul 2004 19:08:46 -0000 1.39 --- NEWS 3 Aug 2004 17:27:40 -0000 1.40 *************** *** 12,15 **** --- 12,16 ---- This make it possible to write type-safe code that uses reflexion, in particular when using class literals. + * Improved speed of coverage tests for some methods. -- |
From: Arjan B. <ar...@us...> - 2004-08-03 14:36:31
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30944/F:/nice/src/bossa/syntax Modified Files: Expression.java NullExp.java Pattern.java tools.nice typecheck.nice Log Message: Removed explicit use of NullExp. Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** tools.nice 2 Aug 2004 19:10:58 -0000 1.40 --- tools.nice 3 Aug 2004 14:36:05 -0000 1.41 *************** *** 35,42 **** } - boolean isNullExp(Expression); - isNullExp(Expression e) = false; - isNullExp(NullExp e) = true; - ?MonoSymbol localVariable(Expression); localVariable(Expression e) = null; --- 35,38 ---- Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** Pattern.java 3 Aug 2004 10:16:13 -0000 1.87 --- Pattern.java 3 Aug 2004 14:36:05 -0000 1.88 *************** *** 934,938 **** return atValue != null && !atBool() && !atNull() &&!atIntCompare(); } ! public boolean atNull() { return atValue instanceof NullExp; } /** This pattern only specifies that the vlaue is not null. This cannot be explicitely used in source programs, but it is useful --- 934,938 ---- return atValue != null && !atBool() && !atNull() &&!atIntCompare(); } ! public boolean atNull() { return (atValue != null) && atValue.isNull(); } /** This pattern only specifies that the vlaue is not null. This cannot be explicitely used in source programs, but it is useful Index: NullExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NullExp.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** NullExp.java 2 Sep 2003 19:57:52 -0000 1.9 --- NullExp.java 3 Aug 2004 14:36:05 -0000 1.10 *************** *** 43,46 **** --- 43,51 ---- } + public boolean isNull() + { + return true; + } + void computeType() { Index: Expression.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Expression.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** Expression.java 28 Jul 2004 14:40:33 -0000 1.55 --- Expression.java 3 Aug 2004 14:36:05 -0000 1.56 *************** *** 98,101 **** --- 98,106 ---- } + public boolean isNull() + { + return false; + } + /** * Resolves overloading, taking into account the parameters Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** typecheck.nice 30 Jul 2004 19:08:45 -0000 1.105 --- typecheck.nice 3 Aug 2004 14:36:05 -0000 1.106 *************** *** 295,301 **** int varPosition; ! if (isNullExp(notNull(test.arguments.getExp(0)))) varPosition = 1; ! else if (isNullExp(notNull(test.arguments.getExp(1)))) varPosition = 0; else // Give up. --- 295,301 ---- int varPosition; ! if (isNull(notNull(test.arguments.getExp(0)))) varPosition = 1; ! else if (isNull(notNull(test.arguments.getExp(1)))) varPosition = 0; else // Give up. |
From: Arjan B. <ar...@us...> - 2004-08-03 14:36:29
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30944/F:/nice/stdlib/nice/lang/inline Modified Files: ReferenceOp.java Log Message: Removed explicit use of NullExp. Index: ReferenceOp.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/ReferenceOp.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ReferenceOp.java 25 Feb 2004 11:23:27 -0000 1.5 --- ReferenceOp.java 3 Aug 2004 14:36:06 -0000 1.6 *************** *** 177,183 **** { bossa.syntax.Expression exp = null; ! if (arguments[0] instanceof bossa.syntax.NullExp) exp = arguments[1]; ! else if (arguments[1] instanceof bossa.syntax.NullExp) exp = arguments[0]; --- 177,183 ---- { bossa.syntax.Expression exp = null; ! if (arguments[0].isNull()) exp = arguments[1]; ! else if (arguments[1].isNull()) exp = arguments[0]; |