Browse Source

no constructor in interfaces

Nicolas Cannasse 18 years ago
parent
commit
3261a0e1d3

+ 0 - 1
std/flash9/events/IEventDispatcher.hx

@@ -1,7 +1,6 @@
 package flash.events;
 
 extern interface IEventDispatcher {
-	function new() : Void;
 	function addEventListener(type : String, listener : Dynamic -> Void, ?useCapture : Bool, ?priority : Int, ?useWeakReference : Bool) : Void;
 	function dispatchEvent(event : flash.events.Event) : Bool;
 	function hasEventListener(type : String) : Bool;

+ 0 - 1
std/flash9/net/IDynamicPropertyOutput.hx

@@ -1,6 +1,5 @@
 package flash.net;
 
 extern interface IDynamicPropertyOutput {
-	function new() : Void;
 	function writeDynamicProperty(name : String, value : Dynamic) : Void;
 }

+ 0 - 1
std/flash9/net/IDynamicPropertyWriter.hx

@@ -1,6 +1,5 @@
 package flash.net;
 
 extern interface IDynamicPropertyWriter {
-	function new() : Void;
 	function writeDynamicProperties(obj : Dynamic, output : flash.net.IDynamicPropertyOutput) : Void;
 }

+ 0 - 1
std/flash9/utils/IDataInput.hx

@@ -1,7 +1,6 @@
 package flash.utils;
 
 extern interface IDataInput {
-	function new() : Void;
 	var bytesAvailable(default,null) : UInt;
 	var endian : String;
 	var objectEncoding : UInt;

+ 0 - 1
std/flash9/utils/IDataOutput.hx

@@ -1,7 +1,6 @@
 package flash.utils;
 
 extern interface IDataOutput {
-	function new() : Void;
 	var endian : String;
 	var objectEncoding : UInt;
 	function writeBoolean(value : Bool) : Void;

+ 0 - 1
std/flash9/utils/IExternalizable.hx

@@ -1,7 +1,6 @@
 package flash.utils;
 
 extern interface IExternalizable {
-	function new() : Void;
 	function readExternal(input : flash.utils.IDataInput) : Void;
 	function writeExternal(output : flash.utils.IDataOutput) : Void;
 }

+ 1 - 0
typer.ml

@@ -2332,6 +2332,7 @@ let init_class ctx c p herits fields =
 			let args = List.map (fun (name,opt,t) -> name , opt, type_opt ~param:opt ctx p t) f.f_args in
 			let t = TFun (args,ret) in
 			let constr = (name = "new") in
+			if constr && c.cl_interface then error "An interface cannot have a constructor" p;
 			if c.cl_interface && not stat && (match f.f_expr with EBlock [] , _ -> false | _ -> true) then error "An interface method cannot have a body" p;
 			if constr then (match f.f_type with
 				| None | Some (TPNormal { tpackage = []; tname = "Void" }) -> ()