2
0
Nicolas Cannasse 17 жил өмнө
parent
commit
0b84eee662
2 өөрчлөгдсөн 2 нэмэгдсэн , 0 устгасан
  1. 1 0
      doc/CHANGES.txt
  2. 1 0
      typer.ml

+ 1 - 0
doc/CHANGES.txt

@@ -13,6 +13,7 @@
 	bugfix for swf-lib f9 classes ordering
 	bugfix for swf-lib f9 classes ordering
 	added EReg.customReplace
 	added EReg.customReplace
 	added neko.Lib.lazyLoad and improved neko.net.Poll for Neko 1.6.1
 	added neko.Lib.lazyLoad and improved neko.net.Poll for Neko 1.6.1
+	prevented static fields in interfaces
 
 
 2008-01-13: 1.17
 2008-01-13: 1.17
 	fixed Int32.compare, added Int32.read and Int32.write
 	fixed Int32.compare, added Int32.read and Int32.write

+ 1 - 0
typer.ml

@@ -2589,6 +2589,7 @@ let init_class ctx c p herits fields =
 		let access , constr, f , delayed = loop_cf f p in
 		let access , constr, f , delayed = loop_cf f p in
 		let is_static = List.mem AStatic access in
 		let is_static = List.mem AStatic access in
 		if is_static && f.cf_name = "name" && Plugin.defined "js" then error "This identifier cannot be used in Javascript for statics" p;
 		if is_static && f.cf_name = "name" && Plugin.defined "js" then error "This identifier cannot be used in Javascript for statics" p;
+		if (is_static || constr) && c.cl_interface then error "You can't declare static fields in interfaces" p;
 		if constr then begin
 		if constr then begin
 			if c.cl_constructor <> None then error "Duplicate constructor" p;
 			if c.cl_constructor <> None then error "Duplicate constructor" p;
 			c.cl_constructor <- Some f;
 			c.cl_constructor <- Some f;