Browse Source

removed alloc_mono (can use typeof(null) instead)

Nicolas Cannasse 14 years ago
parent
commit
570e3aa18b
3 changed files with 8 additions and 18 deletions
  1. 0 3
      interp.ml
  2. 0 7
      std/haxe/macro/Context.hx
  3. 8 8
      std/haxe/web/Dispatch.hx

+ 0 - 3
interp.ml

@@ -1937,9 +1937,6 @@ let macro_lib =
 		"build_fields", Fun0 (fun() ->
 			(get_ctx()).curapi.get_build_fields()
 		);
-		"alloc_mono", Fun0 (fun() ->
-			encode_type (mk_mono())
-		);
 	]
 
 (* ---------------------------------------------------------------------- *)

+ 0 - 7
std/haxe/macro/Context.hx

@@ -184,13 +184,6 @@ class Context {
 		return load("build_fields", 0)();
 	}
 
-	/**
-		Allocate a new monomorphic type (Unknown) that might be inferred later.
-	**/
-	public static function allocMonomorph() : Type {
-		return load("alloc_mono", 0)();
-	}
-
 	static function load( f, nargs ) : Dynamic {
 		#if macro
 		return neko.Lib.load("macro", f, nargs);

+ 8 - 8
std/haxe/web/Dispatch.hx

@@ -79,7 +79,7 @@ class Dispatch {
 		var cfg = makeConfig(obj);
 		return { expr : ECall({ expr : EField(ethis, "runtimeDispatch"), pos : p }, [cfg]), pos : p };
 	}
-	
+
 	@:macro public function getParams( ethis : Expr ) : Expr {
 		var p = Context.currentPos();
 		if( PARAMS == null ) {
@@ -87,7 +87,7 @@ class Dispatch {
 			Context.onGenerate(buildParams);
 		}
 		var index = PARAMS.length;
-		var t = Context.allocMonomorph();
+		var t = Context.typeof({ expr : EConst(CIdent("null")), pos : p });
 		PARAMS.push( { p : p, t : t } );
 		var call = { expr : ECall( { expr : EField(ethis, "runtimeGetParams"), pos : p }, [ { expr : EConst(CInt(Std.string(index))), pos : p } ]), pos : p };
 		var rt = TPath( { pack : ["haxe", "macro"], name : "MacroType", params : [TPExpr(Context.parse("haxe.web.Dispatch.getRunParam("+index+")",p))], sub : null } );
@@ -120,7 +120,7 @@ class Dispatch {
 		loop(args, r);
 		Reflect.callMethod(obj, Reflect.field(obj, name), args);
 	}
-	
+
 	static var GET_RULES;
 	public function runtimeGetParams( cfgIndex : Int ) : Dynamic {
 		if( GET_RULES == null )
@@ -176,7 +176,7 @@ class Dispatch {
 		}
 		return po;
 	}
-	
+
 	function loop( args : Array<Dynamic>, r ) {
 		switch( r ) {
 		case DRArgs(r, params, opt):
@@ -257,7 +257,7 @@ class Dispatch {
 		}
 		return args;
 	}
-	
+
 	static function makeRule( f : ClassField ) : DispatchRule {
 		switch( Context.follow(f.type) ) {
 		case TFun(pl, _):
@@ -347,18 +347,18 @@ class Dispatch {
 		default:
 		}
 	}
-	
+
 	static function serialize( v : Dynamic ) {
 		var s = new haxe.Serializer();
 		s.useEnumIndex = true;
 		s.serialize(v);
 		return s.toString();
 	}
-	
+
 	public static function getRunParam(i:Int) {
 		return PARAMS[i].t;
 	}
-	
+
 	public dynamic static function checkMeta( f : ClassField ) {
 	}