Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2472/F:/nice/src/bossa/syntax
Modified Files:
if.nice rewrite.nice statementexp.nice typecheck.nice
Removed Files:
ExpressionStmt.java
Log Message:
Converted ExpressionStmt to Nice code.
Index: statementexp.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/statementexp.nice,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** statementexp.nice 13 Aug 2004 21:04:41 -0000 1.2
--- statementexp.nice 3 Sep 2004 18:07:27 -0000 1.3
***************
*** 36,37 ****
--- 36,57 ----
}
+
+ /**
+ Compute an expression and forget the value.
+
+ */
+ public class ExpressionStmt extends Statement
+ {
+ Expression exp;
+
+ generateCode() = exp.generateCode();
+
+ toString() = exp.toString() + ";";
+ }
+
+ Statement createExpressionStmt(Expression exp)
+ {
+ let res = new ExpressionStmt(exp: exp);
+ res.setLocation(exp.location());
+ return res;
+ }
Index: if.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/if.nice,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** if.nice 28 Jul 2004 14:40:33 -0000 1.1
--- if.nice 3 Sep 2004 18:07:27 -0000 1.2
***************
*** 79,82 ****
new StatementExp(statement: elseStmt)));
ifExp.setLocation(loc);
! return new ExpressionStmt(ifExp);
}
\ No newline at end of file
--- 79,82 ----
new StatementExp(statement: elseStmt)));
ifExp.setLocation(loc);
! return createExpressionStmt(ifExp);
}
\ No newline at end of file
--- ExpressionStmt.java DELETED ---
Index: rewrite.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/rewrite.nice,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** rewrite.nice 8 Aug 2004 21:51:54 -0000 1.6
--- rewrite.nice 3 Sep 2004 18:07:27 -0000 1.7
***************
*** 76,80 ****
Statement makeStatement(Expression);
! makeStatement(Expression e) = new ExpressionStmt(e);
makeStatement(StatementExp e) = e.statement;
--- 76,80 ----
Statement makeStatement(Expression);
! makeStatement(Expression e) = createExpressionStmt(e);
makeStatement(StatementExp e) = e.statement;
Index: typecheck.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v
retrieving revision 1.114
retrieving revision 1.115
diff -C2 -d -r1.114 -r1.115
*** typecheck.nice 25 Aug 2004 19:57:20 -0000 1.114
--- typecheck.nice 3 Sep 2004 18:07:27 -0000 1.115
***************
*** 829,833 ****
typecheck(ExpressionStmt s)
{
! s.exp = notNull(s.exp).noOverloading();
typecheck(s.exp);
}
--- 829,833 ----
typecheck(ExpressionStmt s)
{
! s.exp = s.exp.noOverloading();
typecheck(s.exp);
}
|