Browse Source

[gencommon] remove commented out IteratorsInterface. tried it - doesn't really work well with other filters. better look into possibility to generate anon structure interfaces in general

Dan Korostelev 8 years ago
parent
commit
ac143fd56a
5 changed files with 0 additions and 190 deletions
  1. 0 105
      src/generators/gencommon.ml
  2. 0 2
      std/cs/Boot.hx
  3. 0 39
      std/cs/internal/Iterator.hx
  4. 0 2
      std/java/Boot.hx
  5. 0 42
      std/java/internal/Iterator.hx

+ 0 - 105
src/generators/gencommon.ml

@@ -8470,111 +8470,6 @@ struct
 		EnumToClassExprf.configure gen t opt_get_native_enum_tag
 end;;
 
-(* ******************************************* *)
-(* IteratorsInterface *)
-(* ******************************************* *)
-(*
-	This module will handle with Iterators and Iterables.
-	At first, a module filter will receive a Iterator<T> and Iterable<T> interface, which will be implemented
-	if hasNext(), next() or iterator() fields are detected with the correct type.
-	At this part a custom function will be called which can adequate the class fields so they are compatible with
-	native Iterators as well
-
-	dependencies:
-		None.
-*)
-module IteratorsInterface =
-struct
-	let name = "iterators_interface"
-	(* TODO later
-	(* ******************************************* *)
-	(* IteratorsInterfaceModf *)
-	(* ******************************************* *)
-	(*
-		The module filter for Iterators Interface, which will implement the iterator/iterable interface on each
-		class that conforms with the typedefs Iterator<> and Iterable<>
-
-		It's a very simple module and it will rely on cast detection to work correctly. This is so that
-		when the
-
-		dependencies:
-			Must run at the Module Filters, so cast detection can detect a cast to the interface and we can
-	*)
-	module IteratorsInterfaceModf =
-	struct
-		let name = "iterators_interface_modf"
-
-		let conforms_cfs has_next next =
-			try (match follow has_next.cf_type with
-				| TFun([],ret) when
-					(match follow ret with | TAbstract({ a_path = ([], "Bool") }, []) -> () | _ -> raise Not_found) ->
-						()
-				| _ -> raise Not_found);
-			(match follow next.cf_type with
-				| TFun([], ret) -> ret
-				| _ -> raise Not_found
-			)
-
-		let conforms_type_iterator t =
-			try match follow t with
-				| TInst(cl,params) ->
-						let has_next = PMap.find "hasNext" cl.cl_fields in
-						let next = PMap.find "next" cl.cl_fields in
-						Some (conforms_cfs has_next next)
-				| TAnon(anon) ->
-						let has_next = PMap.find "hasNext" anon.a_fields in
-						let next = PMap.find "next" anon.a_fields in
-						Some (conforms_cfs has_next next)
-				| _ -> None
-			with | Not_found -> None
-
-		let conforms_as_iterable cl =
-			try
-				let iterator = PMap.find "iterator" cl.cl_fields in
-				match follow iterator.cf_type with
-					| TFun([], ret) -> conforms_type_iterator ret
-					| _ -> None
-			with | Not_found -> None
-
-		let conforms_as_iterator cl =
-			try
-				let has_next = PMap.find "hasNext" cl.cl_fields in
-				let next = PMap.find "next" cl.cl_fields in
-				Some (conforms_cfs has_next next)
-			with | Not_found -> None
-
-		let priority = solve_deps name []
-
-		let traverse gen iterator_iface iterable_iface on_found_iterator on_found_iterable =
-			let rec run md =
-				match md with
-					| TClassDecl cl when not cl.cl_extern && is_hxgen cl ->
-						let conforms_iterator = conforms_as_iterator cl in
-						let conforms_iterable = conforms_as_iterable cl in
-						if is_some conforms_iterator then begin
-							let it_t = get conforms_iterator in
-							cl.cl_interfaces <- (iterator_iface, [it_t]);
-							on_found_iterator cl
-						end;
-						if is_some conforms_iterable then begin
-							let it_t = get conforms_iterable in
-							cl.cl_interfaces <- (iterable_iface, [it_t]);
-							on_found_iterable cl
-						end;
-
-						md
-					| _ -> md
-			in
-			run
-
-		let configure gen (mapping_func:texpr->texpr) =
-			let map e = Some(mapping_func e) in
-			gen.gexpr_filters#add ~name:name ~priority:(PCustom priority) map
-
-	end;;
-	*)
-end;;
-
 
 (* ******************************************* *)
 (* SwitchToIf *)

+ 0 - 2
std/cs/Boot.hx

@@ -25,8 +25,6 @@ import cs.internal.FieldLookup;
 import cs.internal.Function;
 import cs.internal.HxObject;
 import cs.internal.Runtime;
-// TODO (see Gencommon.IteratorsInterfaceModf)
-//import cs.internal.Iterator;
 #if !erase_generics
 import cs.internal.Null;
 #end

+ 0 - 39
std/cs/internal/Iterator.hx

@@ -1,39 +0,0 @@
-/*
- * Copyright (C)2005-2017 Haxe Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-package cs.internal;
-/* TODO (see Gencommon.IteratorsInterfaceModf)
-@:keep @:native('haxe.lang.Iterator') interface Iterator<T>
-{
-
-	public function hasNext():Bool;
-
-	public function next():T;
-
-}
-
-@:keep @:native('haxe.lang.Iterable') interface Iterable<T>
-{
-
-	public function iterator():Iterator<T>;
-
-}
-*/

+ 0 - 2
std/java/Boot.hx

@@ -24,8 +24,6 @@ import java.internal.Exceptions;
 import java.internal.Function;
 import java.internal.HxObject;
 import java.internal.Runtime;
-// TODO (see Gencommon.IteratorsInterfaceModf)
-//import java.internal.Iterator;
 import java.Lib;
 //import java.internal.StringExt;
 import java.StdTypes;

+ 0 - 42
std/java/internal/Iterator.hx

@@ -1,42 +0,0 @@
-/*
- * Copyright (C)2005-2017 Haxe Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-package java.internal;
-/* TODO (see Gencommon.IteratorsInterfaceModf)
-@:native('haxe.lang.Iterator')
-@:keep
-interface Iterator<T>
-{
-
-	public function hasNext():Bool;
-
-	public function next():T;
-
-}
-
-@:native('haxe.lang.Iterable')
-@:keep
-interface Iterable<T>
-{
-
-	public function iterator():Iterator<T>;
-
-}*/