Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1:/tmp/cvs-serv14447/src/bossa/syntax
Modified Files:
UserOperator.java MethodDeclaration.java IdentExp.java
Contract.java CallExp.java AST.java
Log Message:
Make sure that contracts are not lost when importing packages.
Index: UserOperator.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/UserOperator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** UserOperator.java 24 Jun 2003 15:28:19 -0000 1.5
--- UserOperator.java 28 Nov 2003 13:52:08 -0000 1.6
***************
*** 75,78 ****
--- 75,83 ----
}
+ public String toString()
+ {
+ return super.toString() + contract.toString();
+ }
+
private MonoSymbol[] symbols;
***************
*** 105,107 ****
--- 110,122 ----
}
+ void typecheckCompiled()
+ {
+ /* We only need typechecking if there is a contract, to resolve
+ overloading.
+ We will probably be able to remove this if contracts cen be reloaded
+ from bytecode.
+ */
+ if (contract != Contract.noContract)
+ typecheck();
+ }
}
Index: MethodDeclaration.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodDeclaration.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** MethodDeclaration.java 21 Nov 2003 08:09:58 -0000 1.50
--- MethodDeclaration.java 28 Nov 2003 13:52:08 -0000 1.51
***************
*** 226,229 ****
--- 226,235 ----
}
+ /** Typechecking when the package has already been compiled. */
+ void typecheckCompiled()
+ {
+ // Nothing by default
+ }
+
/****************************************************************
* Module interface
Index: IdentExp.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/IdentExp.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** IdentExp.java 2 Apr 2002 13:06:36 -0000 1.23
--- IdentExp.java 28 Nov 2003 13:52:08 -0000 1.24
***************
*** 63,66 ****
--- 63,74 ----
}
+ public String toString(int param)
+ {
+ if (param == Printable.parsable)
+ return "`" + ident.toString() + "`";
+ else
+ return super.toString(param);
+ }
+
protected LocatedString ident;
Index: Contract.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Contract.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Contract.java 24 Jun 2003 15:28:19 -0000 1.5
--- Contract.java 28 Nov 2003 13:52:08 -0000 1.6
***************
*** 28,31 ****
--- 28,32 ----
{
pre.add(CallExp.create(symbol(assertName, condition), condition));
+ requireRepr.append(condition).append(',');
}
***************
*** 33,36 ****
--- 34,38 ----
{
pre.add(CallExp.create(symbol(assertName, condition), condition, name));
+ requireRepr.append(condition).append(':').append(name).append(',');
}
***************
*** 38,41 ****
--- 40,44 ----
{
post.add(CallExp.create(symbol(assertName, condition), condition));
+ ensureRepr.append(condition);
}
***************
*** 43,46 ****
--- 46,50 ----
{
post.add(CallExp.create(symbol(assertName, condition), condition, name));
+ ensureRepr.append(condition).append(':').append(name).append(',');
}
***************
*** 50,53 ****
--- 54,60 ----
private List post = new LinkedList();
+ private StringBuffer requireRepr = new StringBuffer("requires ");
+ private StringBuffer ensureRepr = new StringBuffer("ensures ");
+
private Expression symbol(String name, Located loc)
{
***************
*** 115,118 ****
--- 122,135 ----
}
+ public String toString()
+ {
+ StringBuffer res = new StringBuffer();
+ if (preExp.length > 0)
+ res.append(requireRepr.toString());
+ if (postExp.length > 0)
+ res.append(ensureRepr.toString());
+ return res.toString();
+ }
+
public static final Contract noContract = new Contract() {
void resolve(VarScope scope, TypeScope typeScope) {}
***************
*** 123,126 ****
--- 140,145 ----
return body;
}
+
+ public String toString() { return ""; }
};
}
Index: CallExp.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CallExp.java,v
retrieving revision 1.84
retrieving revision 1.85
diff -C2 -d -r1.84 -r1.85
*** CallExp.java 25 Aug 2003 18:09:10 -0000 1.84
--- CallExp.java 28 Nov 2003 13:52:08 -0000 1.85
***************
*** 367,371 ****
{
if (!infix)
! return function.toString() + arguments;
if (declaringClass == null)
--- 367,371 ----
{
if (!infix)
! return function.toString(Printable.parsable) + arguments;
if (declaringClass == null)
Index: AST.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/AST.java,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -d -r1.51 -r1.52
*** AST.java 12 Sep 2003 23:20:41 -0000 1.51
--- AST.java 28 Nov 2003 13:52:08 -0000 1.52
***************
*** 164,168 ****
if (! compiling)
! return;
doTypecheck();
--- 164,173 ----
if (! compiling)
! {
! for (int i = 0; i < methods.length; i++)
! methods[i].typecheckCompiled();
!
! return;
! }
doTypecheck();
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
|