Browse Source

don't allow TMono for..in

Nicolas Cannasse 18 years ago
parent
commit
c509afe73b
4 changed files with 5 additions and 3 deletions
  1. 2 1
      std/flash/Boot.hx
  2. 1 1
      std/js/JsXml__.hx
  3. 1 1
      std/neko/NekoXml__.hx
  4. 1 0
      typer.ml

+ 2 - 1
std/flash/Boot.hx

@@ -70,7 +70,8 @@ class Boot {
 				if( typeof(o) == "movieclip" )
 				if( typeof(o) == "movieclip" )
 					str = "MC("+o._name+") "+str;
 					str = "MC("+o._name+") "+str;
 				s += "    ";
 				s += "    ";
-				for( k in (__keys__(o))["iterator"]() ) {
+				var keys : Array<String> = __keys__(o);
+				for( k in keys.iterator() ) {
 					if( k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" )
 					if( k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" )
 						continue;
 						continue;
 					if( str.length != 2 )
 					if( str.length != 2 )

+ 1 - 1
std/js/JsXml__.hx

@@ -261,7 +261,7 @@ class JsXml__ {
 		return _attributes.keys();
 		return _attributes.keys();
 	}
 	}
 
 
-	public function iterator(){
+	public function iterator() : Iterator<JsXml__> {
 		if( _children == null ) throw "bad nodetype";
 		if( _children == null ) throw "bad nodetype";
 		return untyped {
 		return untyped {
 			cur: 0,
 			cur: 0,

+ 1 - 1
std/neko/NekoXml__.hx

@@ -222,7 +222,7 @@ class NekoXml__ {
 		return Reflect.fields( _attributes ).iterator();
 		return Reflect.fields( _attributes ).iterator();
 	}
 	}
 
 
-	public function iterator() {
+	public function iterator() : Iterator<NekoXml__> {
 		if( _children == null )
 		if( _children == null )
 			throw "bad nodetype";
 			throw "bad nodetype";
 		return untyped {
 		return untyped {

+ 1 - 0
typer.ml

@@ -1741,6 +1741,7 @@ and type_expr ctx ?(need_val=true) (e,p) =
 				| _ ->
 				| _ ->
 					error "The field iterator is not a method" e1.epos
 					error "The field iterator is not a method" e1.epos
 			)
 			)
+		| TMono _
 		| TDynamic _ ->
 		| TDynamic _ ->
 			error "You can't iterate on a Dynamic value, please specify Iterator or Iterable" e1.epos;
 			error "You can't iterate on a Dynamic value, please specify Iterator or Iterable" e1.epos;
 		| _ ->
 		| _ ->