Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1:/tmp/cvs-serv5125/F:/nice/src/bossa/syntax
Modified Files:
GlobalVarDeclaration.java typecheck.nice
Log Message:
Require a default value for global variables.
Index: GlobalVarDeclaration.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/GlobalVarDeclaration.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** GlobalVarDeclaration.java 31 Jul 2003 21:59:39 -0000 1.20
--- GlobalVarDeclaration.java 22 Aug 2003 13:36:41 -0000 1.21
***************
*** 33,38 ****
{
super(name, Node.global);
- if (constant && value == null)
- User.error(name,"A global constant needs a default value");
this.left = new GlobalVarSymbol(name,type,constant);
--- 33,36 ----
***************
*** 124,130 ****
{
if (constant)
! s.print( "let " + left + " = " +value.toString() + ";\n");
else
! s.print( "var " + left + ";\n");
}
--- 122,130 ----
{
if (constant)
! s.print( "let ");
else
! s.print( "var ");
!
! s.print(left + " = " +value.toString() + ";\n");
}
Index: typecheck.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v
retrieving revision 1.73
retrieving revision 1.74
diff -C2 -d -r1.73 -r1.74
*** typecheck.nice 13 Jun 2003 21:54:30 -0000 1.73
--- typecheck.nice 22 Aug 2003 13:36:41 -0000 1.74
***************
*** 307,311 ****
*/
! var int ifLevel;
var Stack<int> levels = new Stack();
var Stack<(MonoSymbol, mlsub.typing.Monotype)> conditionalTypes = new Stack();
--- 307,311 ----
*/
! var int ifLevel = 0;
var Stack<int> levels = new Stack();
var Stack<(MonoSymbol, mlsub.typing.Monotype)> conditionalTypes = new Stack();
|